Initial Commit
This commit is contained in:
commit
9bcd4e2e39
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@ -0,0 +1,17 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
ij_typescript_use_double_quotes = false
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
44
.gitignore
vendored
Normal file
44
.gitignore
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.
|
||||
|
||||
# Compiled output
|
||||
/dist
|
||||
/tmp
|
||||
/out-tsc
|
||||
/bazel-out
|
||||
|
||||
# Node
|
||||
/node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# IDEs and editors
|
||||
.idea/
|
||||
.project
|
||||
.classpath
|
||||
.c9/
|
||||
*.launch
|
||||
.settings/
|
||||
*.sublime-workspace
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
!.vscode/mcp.json
|
||||
.history/*
|
||||
|
||||
# Miscellaneous
|
||||
/.angular/cache
|
||||
.sass-cache/
|
||||
/connect.lock
|
||||
/coverage
|
||||
/libpeerconnection.log
|
||||
testem.log
|
||||
/typings
|
||||
__screenshots__/
|
||||
|
||||
# System files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
12
.prettierrc
Normal file
12
.prettierrc
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"singleQuote": true,
|
||||
"overrides": [
|
||||
{
|
||||
"files": "*.html",
|
||||
"options": {
|
||||
"parser": "angular"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
4
.vscode/extensions.json
vendored
Normal file
4
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
|
||||
"recommendations": ["angular.ng-template"]
|
||||
}
|
||||
20
.vscode/launch.json
vendored
Normal file
20
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "ng serve",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: start",
|
||||
"url": "http://localhost:4200/"
|
||||
},
|
||||
{
|
||||
"name": "ng test",
|
||||
"type": "chrome",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "npm: test",
|
||||
"url": "http://localhost:9876/debug.html"
|
||||
}
|
||||
]
|
||||
}
|
||||
42
.vscode/tasks.json
vendored
Normal file
42
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "start",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "Changes detected"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation (complete|failed)"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "npm",
|
||||
"script": "test",
|
||||
"isBackground": true,
|
||||
"problemMatcher": {
|
||||
"owner": "typescript",
|
||||
"pattern": "$tsc",
|
||||
"background": {
|
||||
"activeOnStart": true,
|
||||
"beginsPattern": {
|
||||
"regexp": "Changes detected"
|
||||
},
|
||||
"endsPattern": {
|
||||
"regexp": "bundle generation (complete|failed)"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
59
README.md
Normal file
59
README.md
Normal file
@ -0,0 +1,59 @@
|
||||
# WetterHub
|
||||
|
||||
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 22.0.4.
|
||||
|
||||
## Development server
|
||||
|
||||
To start a local development server, run:
|
||||
|
||||
```bash
|
||||
ng serve
|
||||
```
|
||||
|
||||
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
|
||||
|
||||
## Code scaffolding
|
||||
|
||||
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
||||
|
||||
```bash
|
||||
ng generate component component-name
|
||||
```
|
||||
|
||||
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
||||
|
||||
```bash
|
||||
ng generate --help
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To build the project run:
|
||||
|
||||
```bash
|
||||
ng build
|
||||
```
|
||||
|
||||
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
|
||||
|
||||
## Running unit tests
|
||||
|
||||
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
|
||||
|
||||
```bash
|
||||
ng test
|
||||
```
|
||||
|
||||
## Running end-to-end tests
|
||||
|
||||
For end-to-end (e2e) testing, run:
|
||||
|
||||
```bash
|
||||
ng e2e
|
||||
```
|
||||
|
||||
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
||||
|
||||
## Additional Resources
|
||||
|
||||
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
||||
71
angular.json
Normal file
71
angular.json
Normal file
@ -0,0 +1,71 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"cli": {
|
||||
"packageManager": "npm"
|
||||
},
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"WetterHub": {
|
||||
"projectType": "application",
|
||||
"schematics": {},
|
||||
"root": "",
|
||||
"sourceRoot": "src",
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular/build:application",
|
||||
"options": {
|
||||
"browser": "src/main.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
"assets": [
|
||||
{
|
||||
"glob": "**/*",
|
||||
"input": "public"
|
||||
}
|
||||
],
|
||||
"styles": ["src/material-theme.scss", "src/styles.css"]
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kB",
|
||||
"maximumError": "1MB"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "4kB",
|
||||
"maximumError": "8kB"
|
||||
}
|
||||
],
|
||||
"outputHashing": "all"
|
||||
},
|
||||
"development": {
|
||||
"optimization": false,
|
||||
"extractLicenses": false,
|
||||
"sourceMap": true
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular/build:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "WetterHub:build:production"
|
||||
},
|
||||
"development": {
|
||||
"buildTarget": "WetterHub:build:development"
|
||||
}
|
||||
},
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular/build:unit-test"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
openapitools.json
Normal file
7
openapitools.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||
"spaces": 2,
|
||||
"generator-cli": {
|
||||
"version": "7.23.0"
|
||||
}
|
||||
}
|
||||
10231
package-lock.json
generated
Normal file
10231
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
35
package.json
Normal file
35
package.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "wetter-hub",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test"
|
||||
},
|
||||
"private": true,
|
||||
"packageManager": "npm@11.17.0",
|
||||
"dependencies": {
|
||||
"@angular/cdk": "^22.0.2",
|
||||
"@angular/common": "^22.0.0",
|
||||
"@angular/compiler": "^22.0.0",
|
||||
"@angular/core": "^22.0.0",
|
||||
"@angular/forms": "^22.0.0",
|
||||
"@angular/material": "^22.0.2",
|
||||
"@angular/platform-browser": "^22.0.0",
|
||||
"@angular/router": "^22.0.0",
|
||||
"rxjs": "~7.8.0",
|
||||
"tslib": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/build": "^22.0.4",
|
||||
"@angular/cli": "^22.0.4",
|
||||
"@angular/compiler-cli": "^22.0.0",
|
||||
"@openapitools/openapi-generator-cli": "^2.39.0",
|
||||
"jsdom": "^28.0.0",
|
||||
"prettier": "^3.8.1",
|
||||
"typescript": "~6.0.2",
|
||||
"vitest": "^4.0.8"
|
||||
}
|
||||
}
|
||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
4
src/app/api/.gitignore
vendored
Normal file
4
src/app/api/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
wwwroot/*.js
|
||||
node_modules
|
||||
typings
|
||||
dist
|
||||
23
src/app/api/.openapi-generator-ignore
Normal file
23
src/app/api/.openapi-generator-ignore
Normal file
@ -0,0 +1,23 @@
|
||||
# OpenAPI Generator Ignore
|
||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||
|
||||
# Use this file to prevent files from being overwritten by the generator.
|
||||
# The patterns follow closely to .gitignore or .dockerignore.
|
||||
|
||||
# As an example, the C# client generator defines ApiClient.cs.
|
||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||
#ApiClient.cs
|
||||
|
||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||
#foo/*/qux
|
||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||
|
||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||
#foo/**/qux
|
||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||
|
||||
# You can also negate patterns with an exclamation (!).
|
||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
29
src/app/api/.openapi-generator/FILES
Normal file
29
src/app/api/.openapi-generator/FILES
Normal file
@ -0,0 +1,29 @@
|
||||
.gitignore
|
||||
README.md
|
||||
api.base.service.ts
|
||||
api.module.ts
|
||||
api/api.ts
|
||||
api/default.service.ts
|
||||
configuration.ts
|
||||
encoder.ts
|
||||
git_push.sh
|
||||
index.ts
|
||||
model/hTTPValidationError.ts
|
||||
model/indoorMeasurementCreateRequest.ts
|
||||
model/locationInner.ts
|
||||
model/measurementListResponse.ts
|
||||
model/measurementResolution.ts
|
||||
model/measurementResponse.ts
|
||||
model/models.ts
|
||||
model/outdoorMeasurementCreateRequest.ts
|
||||
model/stationCreateRequest.ts
|
||||
model/stationCreateResponse.ts
|
||||
model/stationListResponse.ts
|
||||
model/stationMeasurementResponse.ts
|
||||
model/stationUpdateRequest.ts
|
||||
model/stationUpdateResponse.ts
|
||||
model/validationError.ts
|
||||
param.ts
|
||||
provide-api.ts
|
||||
query.params.ts
|
||||
variables.ts
|
||||
1
src/app/api/.openapi-generator/VERSION
Normal file
1
src/app/api/.openapi-generator/VERSION
Normal file
@ -0,0 +1 @@
|
||||
7.23.0
|
||||
185
src/app/api/README.md
Normal file
185
src/app/api/README.md
Normal file
@ -0,0 +1,185 @@
|
||||
# @
|
||||
|
||||
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
|
||||
The version of the OpenAPI document: 0.1.0
|
||||
|
||||
## Building
|
||||
|
||||
To install the required dependencies and to build the typescript sources run:
|
||||
|
||||
```console
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Publishing
|
||||
|
||||
First build the package then run `npm publish dist` (don't forget to specify the `dist` folder!)
|
||||
|
||||
## Consuming
|
||||
|
||||
Navigate to the folder of your consuming project and run one of next commands.
|
||||
|
||||
_published:_
|
||||
|
||||
```console
|
||||
npm install @ --save
|
||||
```
|
||||
|
||||
_without publishing (not recommended):_
|
||||
|
||||
```console
|
||||
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
|
||||
```
|
||||
|
||||
_It's important to take the tgz file, otherwise you'll get trouble with links on windows_
|
||||
|
||||
_using `npm link`:_
|
||||
|
||||
In PATH_TO_GENERATED_PACKAGE/dist:
|
||||
|
||||
```console
|
||||
npm link
|
||||
```
|
||||
|
||||
In your project:
|
||||
|
||||
```console
|
||||
npm link
|
||||
```
|
||||
|
||||
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
|
||||
Please refer to this issue <https://github.com/angular/angular-cli/issues/8284> for a solution / workaround.
|
||||
Published packages are not effected by this issue.
|
||||
|
||||
### General usage
|
||||
|
||||
In your Angular project:
|
||||
|
||||
```typescript
|
||||
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideApi()
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
**NOTE**
|
||||
If you're still using `AppModule` and haven't [migrated](https://angular.dev/reference/migrations/standalone) yet, you can still import an Angular module:
|
||||
```typescript
|
||||
import { ApiModule } from '';
|
||||
```
|
||||
|
||||
If different from the generated base path, during app bootstrap, you can provide the base path to your service.
|
||||
|
||||
```typescript
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideApi('http://localhost:9999')
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```typescript
|
||||
// with a custom configuration
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideApi({
|
||||
withCredentials: true,
|
||||
username: 'user',
|
||||
password: 'password'
|
||||
})
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```typescript
|
||||
// with factory building a custom configuration
|
||||
import { ApplicationConfig } from '@angular/core';
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { provideApi, Configuration } from '';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
{
|
||||
provide: Configuration,
|
||||
useFactory: (authService: AuthService) => new Configuration({
|
||||
basePath: 'http://localhost:9999',
|
||||
withCredentials: true,
|
||||
username: authService.getUsername(),
|
||||
password: authService.getPassword(),
|
||||
}),
|
||||
deps: [AuthService],
|
||||
multi: false
|
||||
}
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Using multiple OpenAPI files / APIs
|
||||
|
||||
In order to use multiple APIs generated from different OpenAPI files,
|
||||
you can create an alias name when importing the modules
|
||||
in order to avoid naming conflicts:
|
||||
|
||||
```typescript
|
||||
import { provideApi as provideUserApi } from 'my-user-api-path';
|
||||
import { provideApi as provideAdminApi } from 'my-admin-api-path';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
// ...
|
||||
provideHttpClient(),
|
||||
provideUserApi(environment.basePath),
|
||||
provideAdminApi(environment.basePath),
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
### Customizing path parameter encoding
|
||||
|
||||
Without further customization, only [path-parameters][parameter-locations-url] of [style][style-values-url] 'simple'
|
||||
and Dates for format 'date-time' are encoded correctly.
|
||||
|
||||
Other styles (e.g. "matrix") are not that easy to encode
|
||||
and thus are best delegated to other libraries (e.g.: [@honoluluhenk/http-param-expander]).
|
||||
|
||||
To implement your own parameter encoding (or call another library),
|
||||
pass an arrow-function or method-reference to the `encodeParam` property of the Configuration-object
|
||||
(see [General Usage](#general-usage) above).
|
||||
|
||||
Example value for use in your Configuration-Provider:
|
||||
|
||||
```typescript
|
||||
new Configuration({
|
||||
encodeParam: (param: Param) => myFancyParamEncoder(param),
|
||||
})
|
||||
```
|
||||
|
||||
[parameter-locations-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#parameter-locations
|
||||
[style-values-url]: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values
|
||||
[@honoluluhenk/http-param-expander]: https://www.npmjs.com/package/@honoluluhenk/http-param-expander
|
||||
96
src/app/api/api.base.service.ts
Normal file
96
src/app/api/api.base.service.ts
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { HttpHeaders, HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec } from './encoder';
|
||||
import { Configuration } from './configuration';
|
||||
import { OpenApiHttpParams, QueryParamStyle, concatHttpParamsObject} from './query.params';
|
||||
|
||||
export class BaseService {
|
||||
protected basePath = 'http://localhost';
|
||||
public defaultHeaders = new HttpHeaders();
|
||||
public configuration: Configuration;
|
||||
public encoder: HttpParameterCodec;
|
||||
|
||||
constructor(basePath?: string|string[], configuration?: Configuration) {
|
||||
this.configuration = configuration || new Configuration();
|
||||
if (typeof this.configuration.basePath !== 'string') {
|
||||
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
|
||||
if (firstBasePath != undefined) {
|
||||
basePath = firstBasePath;
|
||||
}
|
||||
|
||||
if (typeof basePath !== 'string') {
|
||||
basePath = this.basePath;
|
||||
}
|
||||
this.configuration.basePath = basePath;
|
||||
}
|
||||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
|
||||
}
|
||||
|
||||
protected canConsumeForm(consumes: string[]): boolean {
|
||||
return consumes.indexOf('multipart/form-data') !== -1;
|
||||
}
|
||||
|
||||
protected addToHttpParams(httpParams: OpenApiHttpParams, key: string, value: any | null | undefined, paramStyle: QueryParamStyle, explode: boolean): OpenApiHttpParams {
|
||||
if (value === null || value === undefined) {
|
||||
return httpParams;
|
||||
}
|
||||
|
||||
if (paramStyle === QueryParamStyle.DeepObject) {
|
||||
if (typeof value !== 'object') {
|
||||
throw Error(`An object must be provided for key ${key} as it is a deep object`);
|
||||
}
|
||||
|
||||
return Object.keys(value as Record<string, any>).reduce(
|
||||
(hp, k) => hp.append(`${key}[${k}]`, value[k]),
|
||||
httpParams,
|
||||
);
|
||||
} else if (paramStyle === QueryParamStyle.Json) {
|
||||
return httpParams.append(key, JSON.stringify(value));
|
||||
} else {
|
||||
// Form-style, SpaceDelimited or PipeDelimited
|
||||
|
||||
if (Object(value) !== value) {
|
||||
// If it is a primitive type, add its string representation
|
||||
return httpParams.append(key, value.toString());
|
||||
} else if (value instanceof Date) {
|
||||
return httpParams.append(key, value.toISOString());
|
||||
} else if (Array.isArray(value) || value instanceof Set) {
|
||||
// Otherwise, if it's an array or set, add each element.
|
||||
const array = Array.isArray(value) ? value : Array.from(value);
|
||||
if (paramStyle === QueryParamStyle.Form) {
|
||||
return httpParams.set(key, array, {explode: explode, delimiter: ','});
|
||||
} else if (paramStyle === QueryParamStyle.SpaceDelimited) {
|
||||
return httpParams.set(key, array, {explode: explode, delimiter: ' '});
|
||||
} else {
|
||||
// PipeDelimited
|
||||
return httpParams.set(key, array, {explode: explode, delimiter: '|'});
|
||||
}
|
||||
} else {
|
||||
// Otherwise, if it's an object, add each field.
|
||||
if (paramStyle === QueryParamStyle.Form) {
|
||||
if (explode) {
|
||||
Object.keys(value).forEach(k => {
|
||||
httpParams = this.addToHttpParams(httpParams, k, value[k], paramStyle, explode);
|
||||
});
|
||||
return httpParams;
|
||||
} else {
|
||||
return concatHttpParamsObject(httpParams, key, value, ',');
|
||||
}
|
||||
} else if (paramStyle === QueryParamStyle.SpaceDelimited) {
|
||||
return concatHttpParamsObject(httpParams, key, value, ' ');
|
||||
} else {
|
||||
// PipeDelimited
|
||||
return concatHttpParamsObject(httpParams, key, value, '|');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/app/api/api.module.ts
Normal file
30
src/app/api/api.module.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
|
||||
import { Configuration } from './configuration';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [],
|
||||
exports: [],
|
||||
providers: []
|
||||
})
|
||||
export class ApiModule {
|
||||
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders<ApiModule> {
|
||||
return {
|
||||
ngModule: ApiModule,
|
||||
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
|
||||
};
|
||||
}
|
||||
|
||||
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
|
||||
@Optional() http: HttpClient) {
|
||||
if (parentModule) {
|
||||
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
|
||||
}
|
||||
if (!http) {
|
||||
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
|
||||
'See also https://github.com/angular/angular/issues/20575');
|
||||
}
|
||||
}
|
||||
}
|
||||
3
src/app/api/api/api.ts
Normal file
3
src/app/api/api/api.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export * from './default.service';
|
||||
import { DefaultService } from './default.service';
|
||||
export const APIS = [DefaultService];
|
||||
543
src/app/api/api/default.service.ts
Normal file
543
src/app/api/api/default.service.ts
Normal file
@ -0,0 +1,543 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
/* tslint:disable:no-unused-variable member-ordering */
|
||||
|
||||
import { Inject, Injectable, Optional } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams,
|
||||
HttpResponse, HttpEvent, HttpContext
|
||||
} from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
|
||||
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { IndoorMeasurementCreateRequest } from '../model/indoorMeasurementCreateRequest';
|
||||
// @ts-ignore
|
||||
import { MeasurementListResponse } from '../model/measurementListResponse';
|
||||
// @ts-ignore
|
||||
import { MeasurementResolution } from '../model/measurementResolution';
|
||||
// @ts-ignore
|
||||
import { OutdoorMeasurementCreateRequest } from '../model/outdoorMeasurementCreateRequest';
|
||||
// @ts-ignore
|
||||
import { StationCreateRequest } from '../model/stationCreateRequest';
|
||||
// @ts-ignore
|
||||
import { StationCreateResponse } from '../model/stationCreateResponse';
|
||||
// @ts-ignore
|
||||
import { StationListResponse } from '../model/stationListResponse';
|
||||
// @ts-ignore
|
||||
import { StationUpdateRequest } from '../model/stationUpdateRequest';
|
||||
// @ts-ignore
|
||||
import { StationUpdateResponse } from '../model/stationUpdateResponse';
|
||||
|
||||
// @ts-ignore
|
||||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
||||
import { Configuration } from '../configuration';
|
||||
import { BaseService } from '../api.base.service';
|
||||
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DefaultService extends BaseService {
|
||||
|
||||
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Indoor Measurement
|
||||
* @endpoint post /measurements/indoor
|
||||
* @param indoorMeasurementCreateRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public createIndoorMeasurementMeasurementsIndoorPost(indoorMeasurementCreateRequest: IndoorMeasurementCreateRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public createIndoorMeasurementMeasurementsIndoorPost(indoorMeasurementCreateRequest: IndoorMeasurementCreateRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public createIndoorMeasurementMeasurementsIndoorPost(indoorMeasurementCreateRequest: IndoorMeasurementCreateRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public createIndoorMeasurementMeasurementsIndoorPost(indoorMeasurementCreateRequest: IndoorMeasurementCreateRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (indoorMeasurementCreateRequest === null || indoorMeasurementCreateRequest === undefined) {
|
||||
throw new Error('Required parameter indoorMeasurementCreateRequest was null or undefined when calling createIndoorMeasurementMeasurementsIndoorPost.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/measurements/indoor`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: indoorMeasurementCreateRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Outdoor Measurement
|
||||
* @endpoint post /measurements/outdoor
|
||||
* @param outdoorMeasurementCreateRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public createOutdoorMeasurementMeasurementsOutdoorPost(outdoorMeasurementCreateRequest: OutdoorMeasurementCreateRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public createOutdoorMeasurementMeasurementsOutdoorPost(outdoorMeasurementCreateRequest: OutdoorMeasurementCreateRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public createOutdoorMeasurementMeasurementsOutdoorPost(outdoorMeasurementCreateRequest: OutdoorMeasurementCreateRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public createOutdoorMeasurementMeasurementsOutdoorPost(outdoorMeasurementCreateRequest: OutdoorMeasurementCreateRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (outdoorMeasurementCreateRequest === null || outdoorMeasurementCreateRequest === undefined) {
|
||||
throw new Error('Required parameter outdoorMeasurementCreateRequest was null or undefined when calling createOutdoorMeasurementMeasurementsOutdoorPost.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/measurements/outdoor`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: outdoorMeasurementCreateRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Station
|
||||
* @endpoint post /stations/create
|
||||
* @param stationCreateRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public createStationStationsCreatePost(stationCreateRequest: StationCreateRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<StationCreateResponse>;
|
||||
public createStationStationsCreatePost(stationCreateRequest: StationCreateRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<StationCreateResponse>>;
|
||||
public createStationStationsCreatePost(stationCreateRequest: StationCreateRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<StationCreateResponse>>;
|
||||
public createStationStationsCreatePost(stationCreateRequest: StationCreateRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (stationCreateRequest === null || stationCreateRequest === undefined) {
|
||||
throw new Error('Required parameter stationCreateRequest was null or undefined when calling createStationStationsCreatePost.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/stations/create`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<StationCreateResponse>('post', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: stationCreateRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Station
|
||||
* @endpoint delete /stations/{station_id}
|
||||
* @param stationId
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public deleteStationStationsStationIdDelete(stationId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
||||
public deleteStationStationsStationIdDelete(stationId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
||||
public deleteStationStationsStationIdDelete(stationId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
||||
public deleteStationStationsStationIdDelete(stationId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (stationId === null || stationId === undefined) {
|
||||
throw new Error('Required parameter stationId was null or undefined when calling deleteStationStationsStationIdDelete.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/stations/${this.configuration.encodeParam({name: "stationId", value: stationId, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Measurements
|
||||
* @endpoint get /measurements
|
||||
* @param stationIds
|
||||
* @param indoor
|
||||
* @param fromTimestamp
|
||||
* @param toTimestamp
|
||||
* @param resolution
|
||||
* @param limit
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public getMeasurementsMeasurementsGet(stationIds?: Array<number>, indoor?: boolean, fromTimestamp?: string, toTimestamp?: string, resolution?: MeasurementResolution, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<MeasurementListResponse>;
|
||||
public getMeasurementsMeasurementsGet(stationIds?: Array<number>, indoor?: boolean, fromTimestamp?: string, toTimestamp?: string, resolution?: MeasurementResolution, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<MeasurementListResponse>>;
|
||||
public getMeasurementsMeasurementsGet(stationIds?: Array<number>, indoor?: boolean, fromTimestamp?: string, toTimestamp?: string, resolution?: MeasurementResolution, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<MeasurementListResponse>>;
|
||||
public getMeasurementsMeasurementsGet(stationIds?: Array<number>, indoor?: boolean, fromTimestamp?: string, toTimestamp?: string, resolution?: MeasurementResolution, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarQueryParameters = new OpenApiHttpParams(this.encoder);
|
||||
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
'station_ids',
|
||||
<any>stationIds,
|
||||
QueryParamStyle.Form,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
'indoor',
|
||||
<any>indoor,
|
||||
QueryParamStyle.Form,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
'from_timestamp',
|
||||
<any>fromTimestamp,
|
||||
QueryParamStyle.Form,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
'to_timestamp',
|
||||
<any>toTimestamp,
|
||||
QueryParamStyle.Form,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
'resolution',
|
||||
<any>resolution,
|
||||
QueryParamStyle.Form,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
'limit',
|
||||
<any>limit,
|
||||
QueryParamStyle.Form,
|
||||
true,
|
||||
);
|
||||
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/measurements`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<MeasurementListResponse>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters.toHttpParams(),
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List Stations
|
||||
* @endpoint get /stations/list
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public listStationsStationsListGet(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Array<StationListResponse>>;
|
||||
public listStationsStationsListGet(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Array<StationListResponse>>>;
|
||||
public listStationsStationsListGet(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Array<StationListResponse>>>;
|
||||
public listStationsStationsListGet(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/stations/list`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<StationListResponse>>('get', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Station
|
||||
* @endpoint patch /stations/update
|
||||
* @param stationUpdateRequest
|
||||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
||||
* @param reportProgress flag to report request and response progress.
|
||||
* @param options additional options
|
||||
*/
|
||||
public updateStationStationsUpdatePatch(stationUpdateRequest: StationUpdateRequest, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<StationUpdateResponse>;
|
||||
public updateStationStationsUpdatePatch(stationUpdateRequest: StationUpdateRequest, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<StationUpdateResponse>>;
|
||||
public updateStationStationsUpdatePatch(stationUpdateRequest: StationUpdateRequest, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<StationUpdateResponse>>;
|
||||
public updateStationStationsUpdatePatch(stationUpdateRequest: StationUpdateRequest, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
||||
if (stationUpdateRequest === null || stationUpdateRequest === undefined) {
|
||||
throw new Error('Required parameter stationUpdateRequest was null or undefined when calling updateStationStationsUpdatePatch.');
|
||||
}
|
||||
|
||||
let localVarHeaders = this.defaultHeaders;
|
||||
|
||||
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
|
||||
'application/json'
|
||||
]);
|
||||
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
|
||||
}
|
||||
|
||||
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
|
||||
|
||||
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
||||
|
||||
|
||||
// to determine the Content-Type header
|
||||
const consumes: string[] = [
|
||||
'application/json'
|
||||
];
|
||||
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
||||
if (httpContentTypeSelected !== undefined) {
|
||||
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
||||
}
|
||||
|
||||
let responseType_: 'text' | 'json' | 'blob' = 'json';
|
||||
if (localVarHttpHeaderAcceptSelected) {
|
||||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
|
||||
responseType_ = 'text';
|
||||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
|
||||
responseType_ = 'json';
|
||||
} else {
|
||||
responseType_ = 'blob';
|
||||
}
|
||||
}
|
||||
|
||||
let localVarPath = `/stations/update`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<StationUpdateResponse>('patch', `${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
body: stationUpdateRequest,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
||||
reportProgress: reportProgress
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
185
src/app/api/configuration.ts
Normal file
185
src/app/api/configuration.ts
Normal file
@ -0,0 +1,185 @@
|
||||
import { HttpHeaders, HttpParameterCodec } from '@angular/common/http';
|
||||
import { Param } from './param';
|
||||
import { OpenApiHttpParams } from './query.params';
|
||||
|
||||
export interface ConfigurationParameters {
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
accessToken?: string | (() => string);
|
||||
basePath?: string;
|
||||
withCredentials?: boolean;
|
||||
/**
|
||||
* Takes care of encoding query- and form-parameters.
|
||||
*/
|
||||
encoder?: HttpParameterCodec;
|
||||
/**
|
||||
* Override the default method for encoding path parameters in various
|
||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
||||
* <p>
|
||||
* See {@link README.md} for more details
|
||||
* </p>
|
||||
*/
|
||||
encodeParam?: (param: Param) => string;
|
||||
/**
|
||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
||||
* document. They should map to the value used for authentication
|
||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
||||
*/
|
||||
credentials?: {[ key: string ]: string | (() => string | undefined)};
|
||||
}
|
||||
|
||||
export class Configuration {
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
apiKeys?: {[ key: string ]: string};
|
||||
username?: string;
|
||||
password?: string;
|
||||
/**
|
||||
* @deprecated Since 5.0. Use credentials instead
|
||||
*/
|
||||
accessToken?: string | (() => string);
|
||||
basePath?: string;
|
||||
withCredentials?: boolean;
|
||||
/**
|
||||
* Takes care of encoding query- and form-parameters.
|
||||
*/
|
||||
encoder?: HttpParameterCodec;
|
||||
/**
|
||||
* Encoding of various path parameter
|
||||
* <a href="https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values">styles</a>.
|
||||
* <p>
|
||||
* See {@link README.md} for more details
|
||||
* </p>
|
||||
*/
|
||||
encodeParam: (param: Param) => string;
|
||||
/**
|
||||
* The keys are the names in the securitySchemes section of the OpenAPI
|
||||
* document. They should map to the value used for authentication
|
||||
* minus any standard prefixes such as 'Basic' or 'Bearer'.
|
||||
*/
|
||||
credentials: {[ key: string ]: string | (() => string | undefined)};
|
||||
|
||||
constructor({ accessToken, apiKeys, basePath, credentials, encodeParam, encoder, password, username, withCredentials }: ConfigurationParameters = {}) {
|
||||
if (apiKeys) {
|
||||
this.apiKeys = apiKeys;
|
||||
}
|
||||
if (username !== undefined) {
|
||||
this.username = username;
|
||||
}
|
||||
if (password !== undefined) {
|
||||
this.password = password;
|
||||
}
|
||||
if (accessToken !== undefined) {
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
if (basePath !== undefined) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
if (withCredentials !== undefined) {
|
||||
this.withCredentials = withCredentials;
|
||||
}
|
||||
if (encoder) {
|
||||
this.encoder = encoder;
|
||||
}
|
||||
this.encodeParam = encodeParam ?? (param => this.defaultEncodeParam(param));
|
||||
this.credentials = credentials ?? {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the correct content-type to use for a request.
|
||||
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
|
||||
* If no content type is found return the first found type if the contentTypes is not empty
|
||||
* @param contentTypes - the array of content types that are available for selection
|
||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||
*/
|
||||
public selectHeaderContentType (contentTypes: string[]): string | undefined {
|
||||
if (contentTypes.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = contentTypes.find((x: string) => this.isJsonMime(x));
|
||||
if (type === undefined) {
|
||||
return contentTypes[0];
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the correct accept content-type to use for a request.
|
||||
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
|
||||
* If no content type is found return the first found type if the contentTypes is not empty
|
||||
* @param accepts - the array of content types that are available for selection.
|
||||
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
|
||||
*/
|
||||
public selectHeaderAccept(accepts: string[]): string | undefined {
|
||||
if (accepts.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const type = accepts.find((x: string) => this.isJsonMime(x));
|
||||
if (type === undefined) {
|
||||
return accepts[0];
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given MIME is a JSON MIME.
|
||||
* JSON MIME examples:
|
||||
* application/json
|
||||
* application/json; charset=UTF8
|
||||
* APPLICATION/JSON
|
||||
* application/vnd.company+json
|
||||
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
||||
* @return True if the given MIME is JSON, false otherwise.
|
||||
*/
|
||||
public isJsonMime(mime: string): boolean {
|
||||
const jsonMime: RegExp = /^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$/i;
|
||||
return mime !== null && jsonMime.test(mime);
|
||||
}
|
||||
|
||||
public lookupCredential(key: string): string | undefined {
|
||||
const value = this.credentials[key];
|
||||
return typeof value === 'function'
|
||||
? value()
|
||||
: value;
|
||||
}
|
||||
|
||||
public addCredentialToHeaders(credentialKey: string, headerName: string, headers: HttpHeaders, prefix?: string): HttpHeaders {
|
||||
const value = this.lookupCredential(credentialKey);
|
||||
return value
|
||||
? headers.set(headerName, (prefix ?? '') + value)
|
||||
: headers;
|
||||
}
|
||||
|
||||
public addCredentialToQuery(credentialKey: string, paramName: string, query: OpenApiHttpParams): OpenApiHttpParams {
|
||||
const value = this.lookupCredential(credentialKey);
|
||||
return value
|
||||
? query.set(paramName, value)
|
||||
: query;
|
||||
}
|
||||
|
||||
private defaultEncodeParam(param: Param): string {
|
||||
// This implementation exists as fallback for missing configuration
|
||||
// and for backwards compatibility to older typescript-angular generator versions.
|
||||
// It only works for the 'simple' parameter style.
|
||||
// Date-handling only works for the 'date-time' format.
|
||||
// All other styles and Date-formats are probably handled incorrectly.
|
||||
//
|
||||
// But: if that's all you need (i.e.: the most common use-case): no need for customization!
|
||||
|
||||
const value = param.dataFormat === 'date-time' && param.value instanceof Date
|
||||
? (param.value as Date).toISOString()
|
||||
: param.value;
|
||||
|
||||
return encodeURIComponent(String(value));
|
||||
}
|
||||
}
|
||||
35
src/app/api/encoder.ts
Normal file
35
src/app/api/encoder.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import { HttpParameterCodec } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* Custom HttpParameterCodec
|
||||
* Workaround for https://github.com/angular/angular/issues/18261
|
||||
*/
|
||||
export class CustomHttpParameterCodec implements HttpParameterCodec {
|
||||
encodeKey(k: string): string {
|
||||
return encodeURIComponent(k);
|
||||
}
|
||||
encodeValue(v: string): string {
|
||||
return encodeURIComponent(v);
|
||||
}
|
||||
decodeKey(k: string): string {
|
||||
return decodeURIComponent(k);
|
||||
}
|
||||
decodeValue(v: string): string {
|
||||
return decodeURIComponent(v);
|
||||
}
|
||||
}
|
||||
|
||||
export class IdentityHttpParameterCodec implements HttpParameterCodec {
|
||||
encodeKey(k: string): string {
|
||||
return k;
|
||||
}
|
||||
encodeValue(v: string): string {
|
||||
return v;
|
||||
}
|
||||
decodeKey(k: string): string {
|
||||
return k;
|
||||
}
|
||||
decodeValue(v: string): string {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
57
src/app/api/git_push.sh
Normal file
57
src/app/api/git_push.sh
Normal file
@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||
#
|
||||
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||
|
||||
git_user_id=$1
|
||||
git_repo_id=$2
|
||||
release_note=$3
|
||||
git_host=$4
|
||||
|
||||
if [ "$git_host" = "" ]; then
|
||||
git_host="github.com"
|
||||
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||
fi
|
||||
|
||||
if [ "$git_user_id" = "" ]; then
|
||||
git_user_id="GIT_USER_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||
fi
|
||||
|
||||
if [ "$git_repo_id" = "" ]; then
|
||||
git_repo_id="GIT_REPO_ID"
|
||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||
fi
|
||||
|
||||
if [ "$release_note" = "" ]; then
|
||||
release_note="Minor update"
|
||||
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||
fi
|
||||
|
||||
# Initialize the local directory as a Git repository
|
||||
git init
|
||||
|
||||
# Adds the files in the local repository and stages them for commit.
|
||||
git add .
|
||||
|
||||
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||
git commit -m "$release_note"
|
||||
|
||||
# Sets the new remote
|
||||
git_remote=$(git remote)
|
||||
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||
|
||||
if [ "$GIT_TOKEN" = "" ]; then
|
||||
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
else
|
||||
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
git pull origin master
|
||||
|
||||
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||
git push origin master 2>&1 | grep -v 'To https'
|
||||
7
src/app/api/index.ts
Normal file
7
src/app/api/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export * from './api/api';
|
||||
export * from './model/models';
|
||||
export * from './variables';
|
||||
export * from './configuration';
|
||||
export * from './api.module';
|
||||
export * from './provide-api';
|
||||
export * from './param';
|
||||
16
src/app/api/model/hTTPValidationError.ts
Normal file
16
src/app/api/model/hTTPValidationError.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { ValidationError } from './validationError';
|
||||
|
||||
|
||||
export interface HTTPValidationError {
|
||||
detail?: Array<ValidationError>;
|
||||
}
|
||||
|
||||
17
src/app/api/model/indoorMeasurementCreateRequest.ts
Normal file
17
src/app/api/model/indoorMeasurementCreateRequest.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface IndoorMeasurementCreateRequest {
|
||||
mac: string;
|
||||
temperature: number;
|
||||
humidity: number;
|
||||
}
|
||||
|
||||
14
src/app/api/model/locationInner.ts
Normal file
14
src/app/api/model/locationInner.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface LocationInner {
|
||||
}
|
||||
|
||||
16
src/app/api/model/measurementListResponse.ts
Normal file
16
src/app/api/model/measurementListResponse.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { StationMeasurementResponse } from './stationMeasurementResponse';
|
||||
|
||||
|
||||
export interface MeasurementListResponse {
|
||||
stations: Array<StationMeasurementResponse>;
|
||||
}
|
||||
|
||||
21
src/app/api/model/measurementResolution.ts
Normal file
21
src/app/api/model/measurementResolution.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export const MeasurementResolution = {
|
||||
Raw: 'raw',
|
||||
Hourly: 'hourly',
|
||||
Daily: 'daily',
|
||||
Weekly: 'weekly',
|
||||
Monthly: 'monthly',
|
||||
Yearly: 'yearly'
|
||||
} as const;
|
||||
export type MeasurementResolution = typeof MeasurementResolution[keyof typeof MeasurementResolution];
|
||||
|
||||
18
src/app/api/model/measurementResponse.ts
Normal file
18
src/app/api/model/measurementResponse.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface MeasurementResponse {
|
||||
temperature: number;
|
||||
humidity?: number | null;
|
||||
pressure?: number | null;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
14
src/app/api/model/models.ts
Normal file
14
src/app/api/model/models.ts
Normal file
@ -0,0 +1,14 @@
|
||||
export * from './hTTPValidationError';
|
||||
export * from './indoorMeasurementCreateRequest';
|
||||
export * from './locationInner';
|
||||
export * from './measurementListResponse';
|
||||
export * from './measurementResolution';
|
||||
export * from './measurementResponse';
|
||||
export * from './outdoorMeasurementCreateRequest';
|
||||
export * from './stationCreateRequest';
|
||||
export * from './stationCreateResponse';
|
||||
export * from './stationListResponse';
|
||||
export * from './stationMeasurementResponse';
|
||||
export * from './stationUpdateRequest';
|
||||
export * from './stationUpdateResponse';
|
||||
export * from './validationError';
|
||||
18
src/app/api/model/outdoorMeasurementCreateRequest.ts
Normal file
18
src/app/api/model/outdoorMeasurementCreateRequest.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface OutdoorMeasurementCreateRequest {
|
||||
mac: string;
|
||||
temperature: number;
|
||||
humidity?: number | null;
|
||||
pressure?: number | null;
|
||||
}
|
||||
|
||||
16
src/app/api/model/stationCreateRequest.ts
Normal file
16
src/app/api/model/stationCreateRequest.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface StationCreateRequest {
|
||||
name: string;
|
||||
mac: string;
|
||||
}
|
||||
|
||||
16
src/app/api/model/stationCreateResponse.ts
Normal file
16
src/app/api/model/stationCreateResponse.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface StationCreateResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
18
src/app/api/model/stationListResponse.ts
Normal file
18
src/app/api/model/stationListResponse.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface StationListResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
mac: string;
|
||||
indoor_only: boolean;
|
||||
}
|
||||
|
||||
19
src/app/api/model/stationMeasurementResponse.ts
Normal file
19
src/app/api/model/stationMeasurementResponse.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { MeasurementResponse } from './measurementResponse';
|
||||
import { StationListResponse } from './stationListResponse';
|
||||
|
||||
|
||||
export interface StationMeasurementResponse {
|
||||
station: StationListResponse;
|
||||
measurements: Array<MeasurementResponse>;
|
||||
indoor: boolean;
|
||||
}
|
||||
|
||||
16
src/app/api/model/stationUpdateRequest.ts
Normal file
16
src/app/api/model/stationUpdateRequest.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface StationUpdateRequest {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
16
src/app/api/model/stationUpdateResponse.ts
Normal file
16
src/app/api/model/stationUpdateResponse.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
export interface StationUpdateResponse {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
20
src/app/api/model/validationError.ts
Normal file
20
src/app/api/model/validationError.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/**
|
||||
* FastAPI
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
import { LocationInner } from './locationInner';
|
||||
|
||||
|
||||
export interface ValidationError {
|
||||
loc: Array<LocationInner>;
|
||||
msg: string;
|
||||
type: string;
|
||||
input?: any | null;
|
||||
ctx?: object;
|
||||
}
|
||||
|
||||
69
src/app/api/param.ts
Normal file
69
src/app/api/param.ts
Normal file
@ -0,0 +1,69 @@
|
||||
/**
|
||||
* Standard parameter styles defined by OpenAPI spec
|
||||
*/
|
||||
export type StandardParamStyle =
|
||||
| 'matrix'
|
||||
| 'label'
|
||||
| 'form'
|
||||
| 'simple'
|
||||
| 'spaceDelimited'
|
||||
| 'pipeDelimited'
|
||||
| 'deepObject'
|
||||
;
|
||||
|
||||
/**
|
||||
* The OpenAPI standard {@link StandardParamStyle}s may be extended by custom styles by the user.
|
||||
*/
|
||||
export type ParamStyle = StandardParamStyle | string;
|
||||
|
||||
/**
|
||||
* Standard parameter locations defined by OpenAPI spec
|
||||
*/
|
||||
export type ParamLocation = 'query' | 'header' | 'path' | 'cookie';
|
||||
|
||||
/**
|
||||
* Standard types as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
|
||||
*/
|
||||
export type StandardDataType =
|
||||
| "integer"
|
||||
| "number"
|
||||
| "boolean"
|
||||
| "string"
|
||||
| "object"
|
||||
| "array"
|
||||
;
|
||||
|
||||
/**
|
||||
* Standard {@link DataType}s plus your own types/classes.
|
||||
*/
|
||||
export type DataType = StandardDataType | string;
|
||||
|
||||
/**
|
||||
* Standard formats as defined in <a href="https://swagger.io/specification/#data-types">OpenAPI Specification: Data Types</a>
|
||||
*/
|
||||
export type StandardDataFormat =
|
||||
| "int32"
|
||||
| "int64"
|
||||
| "float"
|
||||
| "double"
|
||||
| "byte"
|
||||
| "binary"
|
||||
| "date"
|
||||
| "date-time"
|
||||
| "password"
|
||||
;
|
||||
|
||||
export type DataFormat = StandardDataFormat | string;
|
||||
|
||||
/**
|
||||
* The parameter to encode.
|
||||
*/
|
||||
export interface Param {
|
||||
name: string;
|
||||
value: unknown;
|
||||
in: ParamLocation;
|
||||
style: ParamStyle,
|
||||
explode: boolean;
|
||||
dataType: DataType;
|
||||
dataFormat: DataFormat | undefined;
|
||||
}
|
||||
15
src/app/api/provide-api.ts
Normal file
15
src/app/api/provide-api.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { EnvironmentProviders, makeEnvironmentProviders } from "@angular/core";
|
||||
import { Configuration, ConfigurationParameters } from './configuration';
|
||||
import { BASE_PATH } from './variables';
|
||||
|
||||
// Returns the service class providers, to be used in the [ApplicationConfig](https://angular.dev/api/core/ApplicationConfig).
|
||||
export function provideApi(configOrBasePath: string | ConfigurationParameters): EnvironmentProviders {
|
||||
return makeEnvironmentProviders([
|
||||
typeof configOrBasePath === "string"
|
||||
? { provide: BASE_PATH, useValue: configOrBasePath }
|
||||
: {
|
||||
provide: Configuration,
|
||||
useValue: new Configuration({ ...configOrBasePath }),
|
||||
},
|
||||
]);
|
||||
}
|
||||
160
src/app/api/query.params.ts
Normal file
160
src/app/api/query.params.ts
Normal file
@ -0,0 +1,160 @@
|
||||
import { HttpParams, HttpParameterCodec } from '@angular/common/http';
|
||||
import { CustomHttpParameterCodec, IdentityHttpParameterCodec } from './encoder';
|
||||
|
||||
export enum QueryParamStyle {
|
||||
Json,
|
||||
Form,
|
||||
DeepObject,
|
||||
SpaceDelimited,
|
||||
PipeDelimited,
|
||||
}
|
||||
|
||||
export type Delimiter = "," | " " | "|" | "\t";
|
||||
|
||||
export interface ParamOptions {
|
||||
/** When true, serialized as multiple repeated key=value pairs. When false, serialized as a single key with joined values using `delimiter`. */
|
||||
explode?: boolean;
|
||||
/** Delimiter used when explode=false. The delimiter itself is inserted unencoded between encoded values. */
|
||||
delimiter?: Delimiter;
|
||||
}
|
||||
|
||||
interface ParamEntry {
|
||||
values: string[];
|
||||
options: Required<ParamOptions>;
|
||||
}
|
||||
|
||||
export class OpenApiHttpParams {
|
||||
private params: Map<string, ParamEntry> = new Map();
|
||||
private defaults: Required<ParamOptions>;
|
||||
private encoder: HttpParameterCodec;
|
||||
|
||||
/**
|
||||
* @param encoder Parameter serializer
|
||||
* @param defaults Global defaults used when a specific parameter has no explicit options.
|
||||
* By OpenAPI default, explode is true for query params with style=form.
|
||||
*/
|
||||
constructor(encoder?: HttpParameterCodec, defaults?: { explode?: boolean; delimiter?: Delimiter }) {
|
||||
this.encoder = encoder || new CustomHttpParameterCodec();
|
||||
this.defaults = {
|
||||
explode: defaults?.explode ?? true,
|
||||
delimiter: defaults?.delimiter ?? ",",
|
||||
};
|
||||
}
|
||||
|
||||
private resolveOptions(local?: ParamOptions): Required<ParamOptions> {
|
||||
return {
|
||||
explode: local?.explode ?? this.defaults.explode,
|
||||
delimiter: local?.delimiter ?? this.defaults.delimiter,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the parameter's values and (optionally) its options.
|
||||
* Options are stored per-parameter (not global).
|
||||
*/
|
||||
set(key: string, values: string[] | string, options?: ParamOptions): this {
|
||||
const arr = Array.isArray(values) ? values.slice() : [values];
|
||||
const opts = this.resolveOptions(options);
|
||||
this.params.set(key, {values: arr, options: opts});
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append a single value to the parameter. If the parameter didn't exist it will be created
|
||||
* and use resolved options (global defaults merged with any provided options).
|
||||
*/
|
||||
append(key: string, value: string, options?: ParamOptions): this {
|
||||
const entry = this.params.get(key);
|
||||
if (entry) {
|
||||
// If new options provided, override the stored options for subsequent serialization
|
||||
if (options) {
|
||||
entry.options = this.resolveOptions({...entry.options, ...options});
|
||||
}
|
||||
entry.values.push(value);
|
||||
} else {
|
||||
this.set(key, [value], options);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize to a query string according to per-parameter OpenAPI options.
|
||||
* - If explode=true for that parameter → repeated key=value pairs (each value encoded).
|
||||
* - If explode=false for that parameter → single key=value where values are individually encoded
|
||||
* and joined using the configured delimiter. The delimiter character is inserted AS-IS
|
||||
* (not percent-encoded).
|
||||
*/
|
||||
toString(): string {
|
||||
const records = this.toRecord();
|
||||
const parts: string[] = [];
|
||||
|
||||
for (const key in records) {
|
||||
parts.push(`${key}=${records[key]}`);
|
||||
}
|
||||
|
||||
return parts.join("&");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return parameters as a plain record.
|
||||
* - If a parameter has exactly one value, returns that value directly.
|
||||
* - If a parameter has multiple values, returns a readonly array of values.
|
||||
*/
|
||||
toRecord(): Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>> {
|
||||
const parts: Record<string, string | number | boolean | ReadonlyArray<string | number | boolean>> = {};
|
||||
|
||||
for (const [key, entry] of this.params.entries()) {
|
||||
const encodedKey = this.encoder.encodeKey(key);
|
||||
|
||||
if (entry.options.explode) {
|
||||
parts[encodedKey] = entry.values.map((v) => this.encoder.encodeValue(v));
|
||||
} else {
|
||||
const encodedValues = entry.values.map((v) => this.encoder.encodeValue(v));
|
||||
|
||||
// join with the delimiter *unencoded*
|
||||
parts[encodedKey] = encodedValues.join(entry.options.delimiter);
|
||||
}
|
||||
}
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an Angular's HttpParams with an identity parameter codec as the parameters are already encoded.
|
||||
*/
|
||||
toHttpParams(): HttpParams {
|
||||
const records = this.toRecord();
|
||||
|
||||
let httpParams = new HttpParams({encoder: new IdentityHttpParameterCodec()});
|
||||
|
||||
return httpParams.appendAll(records);
|
||||
}
|
||||
}
|
||||
|
||||
export function concatHttpParamsObject(httpParams: OpenApiHttpParams, key: string, item: {
|
||||
[index: string]: any
|
||||
}, delimiter: Delimiter): OpenApiHttpParams {
|
||||
let keyAndValues: string[] = [];
|
||||
|
||||
for (const k in item) {
|
||||
keyAndValues.push(k);
|
||||
|
||||
const value = item[k];
|
||||
|
||||
if (Array.isArray(value)) {
|
||||
keyAndValues.push(...value.map(convertToString));
|
||||
} else {
|
||||
keyAndValues.push(convertToString(value));
|
||||
}
|
||||
}
|
||||
|
||||
return httpParams.set(key, keyAndValues, {explode: false, delimiter: delimiter});
|
||||
}
|
||||
|
||||
function convertToString(value: any): string {
|
||||
if (value instanceof Date) {
|
||||
return value.toISOString();
|
||||
} else {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
9
src/app/api/variables.ts
Normal file
9
src/app/api/variables.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { InjectionToken } from '@angular/core';
|
||||
|
||||
export const BASE_PATH = new InjectionToken<string>('basePath');
|
||||
export const COLLECTION_FORMATS = {
|
||||
'csv': ',',
|
||||
'tsv': ' ',
|
||||
'ssv': ' ',
|
||||
'pipes': '|'
|
||||
}
|
||||
24
src/app/app.config.ts
Normal file
24
src/app/app.config.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { ApplicationConfig, provideBrowserGlobalErrorListeners } from '@angular/core';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
import { routes } from './app.routes';
|
||||
import {provideHttpClient} from '@angular/common/http';
|
||||
import {Configuration} from './api';
|
||||
|
||||
export function apiConfigFactory() {
|
||||
return new Configuration({
|
||||
basePath: 'http://localhost:8000'
|
||||
});
|
||||
}
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
provideBrowserGlobalErrorListeners(),
|
||||
provideRouter(routes),
|
||||
provideHttpClient(),
|
||||
{
|
||||
provide: Configuration,
|
||||
useFactory: apiConfigFactory,
|
||||
}
|
||||
]
|
||||
};
|
||||
11
src/app/app.css
Normal file
11
src/app/app.css
Normal file
@ -0,0 +1,11 @@
|
||||
.example-spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.example-container {
|
||||
width: auto;
|
||||
min-height: calc(100vh - 64px);
|
||||
border: 1px solid #555;
|
||||
/* The background property is added to clearly distinguish the borders between drawer and main
|
||||
content */
|
||||
}
|
||||
43
src/app/app.html
Normal file
43
src/app/app.html
Normal file
@ -0,0 +1,43 @@
|
||||
<main class="main">
|
||||
<mat-toolbar>
|
||||
<button matIconButton style="color: white" aria-label="Example icon-button with menu icon" [routerLink]="'/'">
|
||||
<mat-icon fontSet="material-symbols-outlined">
|
||||
weather_mix
|
||||
</mat-icon>
|
||||
</button>
|
||||
<span>Wetter</span>
|
||||
<span style="color: cornflowerblue;">Hub</span>
|
||||
<button matButton="outlined" style="margin-left: 2em">
|
||||
<mat-icon>dashboard</mat-icon>
|
||||
<span>Übersicht</span>
|
||||
</button>
|
||||
<button matButton="outlined" style="margin-left: 2em">
|
||||
<mat-icon>settings</mat-icon>
|
||||
<span>Einstellungen</span>
|
||||
</button>
|
||||
<span class="example-spacer"></span>
|
||||
<button matButton="filled" style="margin-right: 1em">24h</button>
|
||||
<button matButton="filled" style="margin-right: 1em">7d</button>
|
||||
<button matButton="filled" style="margin-right: 1em">30d</button>
|
||||
<button matButton="filled" style="margin-right: 1em">1J</button>
|
||||
</mat-toolbar>
|
||||
<mat-drawer-container class="example-container">
|
||||
<mat-drawer mode="side" opened>
|
||||
<app-station-list></app-station-list>
|
||||
</mat-drawer>
|
||||
<mat-drawer-content>Main Cointent</mat-drawer-content>
|
||||
</mat-drawer-container>
|
||||
|
||||
|
||||
</main>
|
||||
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * * The content above * * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * is only a placeholder * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * and can be replaced. * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * * -->
|
||||
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
|
||||
|
||||
|
||||
<router-outlet />
|
||||
3
src/app/app.routes.ts
Normal file
3
src/app/app.routes.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
export const routes: Routes = [];
|
||||
23
src/app/app.spec.ts
Normal file
23
src/app/app.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { App } from './app';
|
||||
|
||||
describe('App', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [App],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
it('should create the app', () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
const app = fixture.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should render title', async () => {
|
||||
const fixture = TestBed.createComponent(App);
|
||||
await fixture.whenStable();
|
||||
const compiled = fixture.nativeElement as HTMLElement;
|
||||
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, WetterHub');
|
||||
});
|
||||
});
|
||||
17
src/app/app.ts
Normal file
17
src/app/app.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { Component, signal } from '@angular/core';
|
||||
import {RouterLink, RouterOutlet} from '@angular/router';
|
||||
import {MatToolbar} from '@angular/material/toolbar';
|
||||
import {MatIcon} from '@angular/material/icon';
|
||||
import {MatButton, MatIconButton} from '@angular/material/button';
|
||||
import {MatDrawer, MatDrawerContainer, MatDrawerContent} from '@angular/material/sidenav';
|
||||
import {StationList} from './station-list/station-list';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [RouterOutlet, MatToolbar, MatIcon, MatIconButton, RouterLink, MatButton, MatDrawerContainer, MatDrawer, MatDrawerContent, StationList],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.css'
|
||||
})
|
||||
export class App {
|
||||
protected readonly title = signal('WetterHub');
|
||||
}
|
||||
71
src/app/station-list/station-list.css
Normal file
71
src/app/station-list/station-list.css
Normal file
@ -0,0 +1,71 @@
|
||||
.group-title {
|
||||
font-size: 11px;
|
||||
letter-spacing: 1px;
|
||||
opacity: 0.6;
|
||||
margin: 16px 8px 6px;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
padding: 10px 12px;
|
||||
margin: 4px 0;
|
||||
|
||||
border-radius: 10px;
|
||||
|
||||
cursor: pointer;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.item:hover {
|
||||
background: rgba(255, 255, 255, 0.06);
|
||||
}
|
||||
|
||||
.item.active {
|
||||
background: #062a55;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
background: #888;
|
||||
}
|
||||
|
||||
.dot.blue { background: #4aa3ff; }
|
||||
.dot.purple { background: #7a5cff; }
|
||||
.dot.orange { background: #ffb020; }
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 11px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.badge {
|
||||
font-size: 11px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.badge.green {
|
||||
background: rgba(0, 255, 100, 0.15);
|
||||
color: #4dff88;
|
||||
}
|
||||
|
||||
.badge.blue {
|
||||
background: rgba(80, 160, 255, 0.15);
|
||||
color: #6bb6ff;
|
||||
}
|
||||
38
src/app/station-list/station-list.html
Normal file
38
src/app/station-list/station-list.html
Normal file
@ -0,0 +1,38 @@
|
||||
<div class="group-title">STATIONEN</div>
|
||||
|
||||
<div class="item active">
|
||||
<span class="dot"></span>
|
||||
<div class="content">
|
||||
<div class="title">Alle</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="group-title">INNEN</div>
|
||||
|
||||
@for (station of indoor_stations; track $index) {
|
||||
<div class="item">
|
||||
<span class="dot blue"></span>
|
||||
|
||||
<div class="content">
|
||||
<div class="title">{{station.name}}</div>
|
||||
<div class="subtitle">{{station.mac}}</div>
|
||||
</div>
|
||||
|
||||
<span class="badge green">innen</span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="group-title">AUSSEN</div>
|
||||
|
||||
@for (station of outdoor_stations; track $index) {
|
||||
<div class="item">
|
||||
<span class="dot orange"></span>
|
||||
|
||||
<div class="content">
|
||||
<div class="title">{{station.name}}</div>
|
||||
<div class="subtitle">{{station.mac}}</div>
|
||||
</div>
|
||||
|
||||
<span class="badge blue">außen</span>
|
||||
</div>
|
||||
}
|
||||
22
src/app/station-list/station-list.spec.ts
Normal file
22
src/app/station-list/station-list.spec.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { StationList } from './station-list';
|
||||
|
||||
describe('StationList', () => {
|
||||
let component: StationList;
|
||||
let fixture: ComponentFixture<StationList>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [StationList],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(StationList);
|
||||
component = fixture.componentInstance;
|
||||
await fixture.whenStable();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
29
src/app/station-list/station-list.ts
Normal file
29
src/app/station-list/station-list.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
|
||||
import {DefaultService, StationListResponse} from '../api';
|
||||
|
||||
@Component({
|
||||
selector: 'app-station-list',
|
||||
imports: [],
|
||||
templateUrl: './station-list.html',
|
||||
styleUrl: './station-list.css',
|
||||
})
|
||||
export class StationList implements OnInit {
|
||||
|
||||
indoor_stations: StationListResponse[] = []
|
||||
outdoor_stations: StationListResponse[] = []
|
||||
|
||||
|
||||
constructor(private apiService: DefaultService, private cdr: ChangeDetectorRef) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.apiService.listStationsStationsListGet().subscribe({
|
||||
next: data => {
|
||||
this.indoor_stations = data
|
||||
this.outdoor_stations = data.filter(item => !item.indoor_only)
|
||||
console.log(this.indoor_stations)
|
||||
this.cdr.detectChanges()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
22
src/index.html
Normal file
22
src/index.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>WetterHub</title>
|
||||
<base href="/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<link rel="stylesheet"
|
||||
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined" />
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
6
src/main.ts
Normal file
6
src/main.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { appConfig } from './app/app.config';
|
||||
import { App } from './app/app';
|
||||
|
||||
bootstrapApplication(App, appConfig)
|
||||
.catch((err) => console.error(err));
|
||||
38
src/material-theme.scss
Normal file
38
src/material-theme.scss
Normal file
@ -0,0 +1,38 @@
|
||||
// Include theming for Angular Material with `mat.theme()`.
|
||||
// This Sass mixin will define CSS variables that are used for styling Angular Material
|
||||
// components according to the Material 3 design spec.
|
||||
// Learn more about theming and how to use it for your application's
|
||||
// custom components at https://material.angular.dev/guide/theming
|
||||
@use '@angular/material' as mat;
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
@include mat.theme(
|
||||
(
|
||||
color: (
|
||||
primary: mat.$cyan-palette,
|
||||
tertiary: mat.$orange-palette,
|
||||
),
|
||||
typography: Roboto,
|
||||
density: 0,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
body {
|
||||
// Default the application to a light color theme. This can be changed to
|
||||
// `dark` to enable the dark color theme, or to `light dark` to defer to the
|
||||
// user's system settings.
|
||||
color-scheme: dark;
|
||||
|
||||
// Set a default background, font and text colors for the application using
|
||||
// Angular Material's system-level CSS variables. Learn more about these
|
||||
// variables at https://material.angular.dev/guide/system-variables
|
||||
background-color: var(--mat-sys-surface);
|
||||
color: var(--mat-sys-on-surface);
|
||||
font: var(--mat-sys-body-medium);
|
||||
|
||||
// Reset the user agent margin.
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
1
src/styles.css
Normal file
1
src/styles.css
Normal file
@ -0,0 +1 @@
|
||||
/* You can add global styles to this file, and also import other style files */
|
||||
15
tsconfig.app.json
Normal file
15
tsconfig.app.json
Normal file
@ -0,0 +1,15 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app",
|
||||
"types": []
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"src/**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
31
tsconfig.json
Normal file
31
tsconfig.json
Normal file
@ -0,0 +1,31 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"compileOnSave": false,
|
||||
"compilerOptions": {
|
||||
"noImplicitOverride": true,
|
||||
"noPropertyAccessFromIndexSignature": true,
|
||||
"noImplicitReturns": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"skipLibCheck": true,
|
||||
"isolatedModules": true,
|
||||
"experimentalDecorators": true,
|
||||
"importHelpers": true,
|
||||
"target": "ES2022",
|
||||
"module": "preserve"
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"enableI18nLegacyMessageIdFormat": false,
|
||||
"strictInjectionParameters": true,
|
||||
"strictInputAccessModifiers": true
|
||||
},
|
||||
"files": [],
|
||||
"references": [
|
||||
{
|
||||
"path": "./tsconfig.app.json"
|
||||
},
|
||||
{
|
||||
"path": "./tsconfig.spec.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
15
tsconfig.spec.json
Normal file
15
tsconfig.spec.json
Normal file
@ -0,0 +1,15 @@
|
||||
/* To learn more about Typescript configuration file: https://www.typescriptlang.org/docs/handbook/tsconfig-json.html. */
|
||||
/* To learn more about Angular compiler options: https://angular.dev/reference/configs/angular-compiler-options. */
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/spec",
|
||||
"types": [
|
||||
"vitest/globals"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user