CP # Generate model via Swagger + Log In test
This commit is contained in:
parent
a03ba63cc2
commit
90b3ff5e49
17
ng-swagger-gen.json
Normal file
17
ng-swagger-gen.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"$schema": "./node_modules/ng-swagger-gen/ng-swagger-gen-schema.json",
|
||||
"swagger": "swagger.json",
|
||||
"output": "src/app/api",
|
||||
"prefix": "Api",
|
||||
"ignoreUnusedModels": true,
|
||||
"minParamsForContainer": 2,
|
||||
"sortParams": "desc",
|
||||
"defaultTag": "Api",
|
||||
"removeStaleFiles": true,
|
||||
"modelIndex": true,
|
||||
"serviceIndex": true,
|
||||
"apiModule": true,
|
||||
"enumModule": true,
|
||||
"generateExamples": false,
|
||||
"camelCase": false
|
||||
}
|
||||
113
package-lock.json
generated
113
package-lock.json
generated
@ -2562,6 +2562,11 @@
|
||||
"resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.2.tgz",
|
||||
"integrity": "sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg=="
|
||||
},
|
||||
"call-me-maybe": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz",
|
||||
"integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms="
|
||||
},
|
||||
"caller-callsite": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz",
|
||||
@ -3005,6 +3010,15 @@
|
||||
"typedarray": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"config-chain": {
|
||||
"version": "1.1.12",
|
||||
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz",
|
||||
"integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==",
|
||||
"requires": {
|
||||
"ini": "^1.3.4",
|
||||
"proto-list": "~1.2.1"
|
||||
}
|
||||
},
|
||||
"connect": {
|
||||
"version": "3.6.6",
|
||||
"resolved": "https://registry.npmjs.org/connect/-/connect-3.6.6.tgz",
|
||||
@ -4554,6 +4568,11 @@
|
||||
"mime-types": "^2.1.12"
|
||||
}
|
||||
},
|
||||
"format-util": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/format-util/-/format-util-1.0.3.tgz",
|
||||
"integrity": "sha1-Ay3KShFiYqEsQ/TD7IVmQWxbLZU="
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz",
|
||||
@ -4657,11 +4676,13 @@
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
@ -4678,7 +4699,8 @@
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"bundled": true
|
||||
"bundled": true,
|
||||
"optional": true
|
||||
},
|
||||
"console-control-strings": {
|
||||
"version": "1.1.0",
|
||||
@ -4807,6 +4829,7 @@
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"bundled": true,
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
@ -5237,6 +5260,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"global-tunnel-ng": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz",
|
||||
"integrity": "sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==",
|
||||
"requires": {
|
||||
"encodeurl": "^1.0.2",
|
||||
"lodash": "^4.17.10",
|
||||
"npm-conf": "^1.1.3",
|
||||
"tunnel": "^0.0.6"
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"version": "9.18.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz",
|
||||
@ -5816,8 +5850,7 @@
|
||||
"ini": {
|
||||
"version": "1.3.5",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
|
||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
|
||||
"dev": true
|
||||
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw=="
|
||||
},
|
||||
"inline-source-map": {
|
||||
"version": "0.6.2",
|
||||
@ -6647,6 +6680,32 @@
|
||||
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
|
||||
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
|
||||
},
|
||||
"json-schema-ref-parser": {
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-ref-parser/-/json-schema-ref-parser-5.1.3.tgz",
|
||||
"integrity": "sha512-CpDFlBwz/6la78hZxyB9FECVKGYjIIl3Ms3KLqFj99W7IIb7D00/RDgc++IGB4BBALl0QRhh5m4q5WNSopvLtQ==",
|
||||
"requires": {
|
||||
"call-me-maybe": "^1.0.1",
|
||||
"debug": "^3.1.0",
|
||||
"js-yaml": "^3.12.0",
|
||||
"ono": "^4.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"json-schema-traverse": {
|
||||
"version": "0.4.1",
|
||||
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
|
||||
@ -7799,6 +7858,11 @@
|
||||
"integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=",
|
||||
"dev": true
|
||||
},
|
||||
"mustache": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/mustache/-/mustache-2.3.2.tgz",
|
||||
"integrity": "sha512-KpMNwdQsYz3O/SBS1qJ/o3sqUJ5wSb8gb0pul8CO0S56b9Y2ALm8zCfsjPXsqGFfoNBkDwZuZIAjhsZI03gYVQ=="
|
||||
},
|
||||
"mute-stream": {
|
||||
"version": "0.0.7",
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz",
|
||||
@ -7845,6 +7909,17 @@
|
||||
"integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==",
|
||||
"dev": true
|
||||
},
|
||||
"ng-swagger-gen": {
|
||||
"version": "1.7.1",
|
||||
"resolved": "https://registry.npmjs.org/ng-swagger-gen/-/ng-swagger-gen-1.7.1.tgz",
|
||||
"integrity": "sha512-54bLd5+7Nnyyw0MNkmbqg0M+ftn/SrbNS09pO3OvVzI7qD51rFR7crk6GkAiKIEUtA7WIPmKEoTvcm7JnlNXjA==",
|
||||
"requires": {
|
||||
"argparse": "^1.0.10",
|
||||
"global-tunnel-ng": "^2.7.1",
|
||||
"json-schema-ref-parser": "^5.1.3",
|
||||
"mustache": "^2.3.2"
|
||||
}
|
||||
},
|
||||
"ngrok": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ngrok/-/ngrok-3.1.1.tgz",
|
||||
@ -8104,6 +8179,15 @@
|
||||
"integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==",
|
||||
"dev": true
|
||||
},
|
||||
"npm-conf": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz",
|
||||
"integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==",
|
||||
"requires": {
|
||||
"config-chain": "^1.1.11",
|
||||
"pify": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"npm-package-arg": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-6.1.0.tgz",
|
||||
@ -8337,6 +8421,14 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ono": {
|
||||
"version": "4.0.11",
|
||||
"resolved": "https://registry.npmjs.org/ono/-/ono-4.0.11.tgz",
|
||||
"integrity": "sha512-jQ31cORBFE6td25deYeD80wxKBMj+zBmHTrVxnc6CKhx8gho6ipmWM5zj/oeoqioZ99yqBls9Z/9Nss7J26G2g==",
|
||||
"requires": {
|
||||
"format-util": "^1.0.3"
|
||||
}
|
||||
},
|
||||
"open": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/open/-/open-6.0.0.tgz",
|
||||
@ -8808,8 +8900,7 @@
|
||||
"pify": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
|
||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
|
||||
"dev": true
|
||||
"integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
|
||||
},
|
||||
"pinkie": {
|
||||
"version": "2.0.4",
|
||||
@ -9015,6 +9106,11 @@
|
||||
"retry": "^0.10.0"
|
||||
}
|
||||
},
|
||||
"proto-list": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
|
||||
"integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk="
|
||||
},
|
||||
"protoduck": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/protoduck/-/protoduck-5.0.1.tgz",
|
||||
@ -11738,6 +11834,11 @@
|
||||
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
|
||||
"integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY="
|
||||
},
|
||||
"tunnel": {
|
||||
"version": "0.0.6",
|
||||
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
|
||||
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
"core-js": "^2.5.4",
|
||||
"font-awesome": "^4.7.0",
|
||||
"jquery": "^3.3.1",
|
||||
"ng-swagger-gen": "^1.7.1",
|
||||
"ngx-bootstrap": "^3.2.0",
|
||||
"popper": "^1.0.1",
|
||||
"primeicons": "^1.0.0",
|
||||
|
||||
16
src/app/api/api-configuration.ts
Normal file
16
src/app/api/api-configuration.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/**
|
||||
* Global configuration for Api services
|
||||
*/
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ApiConfiguration {
|
||||
rootUrl: string = '';
|
||||
}
|
||||
|
||||
export interface ApiConfigurationInterface {
|
||||
rootUrl?: string;
|
||||
}
|
||||
52
src/app/api/api.module.ts
Normal file
52
src/app/api/api.module.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/* tslint:disable */
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { ApiConfiguration, ApiConfigurationInterface } from './api-configuration';
|
||||
|
||||
import { AzureService } from './services/azure.service';
|
||||
import { BooksService } from './services/books.service';
|
||||
import { FacebookService } from './services/facebook.service';
|
||||
import { GoogleService } from './services/google.service';
|
||||
import { IOTService } from './services/iot.service';
|
||||
import { MQTTService } from './services/mqtt.service';
|
||||
import { TokenService } from './services/token.service';
|
||||
import { TwitterService } from './services/twitter.service';
|
||||
import { ValuesService } from './services/values.service';
|
||||
|
||||
/**
|
||||
* Provider for all Api services, plus ApiConfiguration
|
||||
*/
|
||||
@NgModule({
|
||||
imports: [
|
||||
HttpClientModule
|
||||
],
|
||||
exports: [
|
||||
HttpClientModule
|
||||
],
|
||||
declarations: [],
|
||||
providers: [
|
||||
ApiConfiguration,
|
||||
AzureService,
|
||||
BooksService,
|
||||
FacebookService,
|
||||
GoogleService,
|
||||
IOTService,
|
||||
MQTTService,
|
||||
TokenService,
|
||||
TwitterService,
|
||||
ValuesService
|
||||
],
|
||||
})
|
||||
export class ApiModule {
|
||||
static forRoot(customParams: ApiConfigurationInterface): ModuleWithProviders {
|
||||
return {
|
||||
ngModule: ApiModule,
|
||||
providers: [
|
||||
{
|
||||
provide: ApiConfiguration,
|
||||
useValue: {rootUrl: customParams.rootUrl}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
63
src/app/api/base-service.ts
Normal file
63
src/app/api/base-service.ts
Normal file
@ -0,0 +1,63 @@
|
||||
/* tslint:disable */
|
||||
import { HttpClient, HttpParameterCodec, HttpParams } from '@angular/common/http';
|
||||
import { ApiConfiguration } from './api-configuration';
|
||||
|
||||
/**
|
||||
* Custom parameter codec to correctly handle the plus sign in parameter
|
||||
* values. See https://github.com/angular/angular/issues/18261
|
||||
*/
|
||||
class ParameterCodec implements HttpParameterCodec {
|
||||
encodeKey(key: string): string {
|
||||
return encodeURIComponent(key);
|
||||
}
|
||||
|
||||
encodeValue(value: string): string {
|
||||
return encodeURIComponent(value);
|
||||
}
|
||||
|
||||
decodeKey(key: string): string {
|
||||
return decodeURIComponent(key);
|
||||
}
|
||||
|
||||
decodeValue(value: string): string {
|
||||
return decodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
const PARAMETER_CODEC = new ParameterCodec();
|
||||
|
||||
/**
|
||||
* Base class for API services
|
||||
*/
|
||||
export class BaseService {
|
||||
constructor(
|
||||
protected config: ApiConfiguration,
|
||||
protected http: HttpClient
|
||||
) {
|
||||
}
|
||||
|
||||
private _rootUrl: string = '';
|
||||
|
||||
/**
|
||||
* Returns the root url for API operations. If not set directly in this
|
||||
* service, will fallback to ApiConfiguration.rootUrl.
|
||||
*/
|
||||
get rootUrl(): string {
|
||||
return this._rootUrl || this.config.rootUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the root URL for API operations in this service.
|
||||
*/
|
||||
set rootUrl(rootUrl: string) {
|
||||
this._rootUrl = rootUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new `HttpParams` with the correct codec
|
||||
*/
|
||||
protected newParams(): HttpParams {
|
||||
return new HttpParams({
|
||||
encoder: PARAMETER_CODEC
|
||||
});
|
||||
}
|
||||
}
|
||||
8
src/app/api/models.ts
Normal file
8
src/app/api/models.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export { AzureADAuthModel } from './models/azure-adauth-model';
|
||||
export { Book } from './models/book';
|
||||
export { FacebookAuthModel } from './models/facebook-auth-model';
|
||||
export { GoogleAuthModel } from './models/google-auth-model';
|
||||
export { SmartPrinterMessage } from './models/smart-printer-message';
|
||||
export { SmartGardenMessage } from './models/smart-garden-message';
|
||||
export { User } from './models/user';
|
||||
export { TwitterAuthModel } from './models/twitter-auth-model';
|
||||
4
src/app/api/models/azure-adauth-model.ts
Normal file
4
src/app/api/models/azure-adauth-model.ts
Normal file
@ -0,0 +1,4 @@
|
||||
/* tslint:disable */
|
||||
export interface AzureADAuthModel {
|
||||
apiKey?: string;
|
||||
}
|
||||
8
src/app/api/models/book.ts
Normal file
8
src/app/api/models/book.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/* tslint:disable */
|
||||
export interface Book {
|
||||
id?: string;
|
||||
bookName?: string;
|
||||
price?: number;
|
||||
category?: string;
|
||||
author?: string;
|
||||
}
|
||||
4
src/app/api/models/facebook-auth-model.ts
Normal file
4
src/app/api/models/facebook-auth-model.ts
Normal file
@ -0,0 +1,4 @@
|
||||
/* tslint:disable */
|
||||
export interface FacebookAuthModel {
|
||||
userAccessToken?: string;
|
||||
}
|
||||
5
src/app/api/models/google-auth-model.ts
Normal file
5
src/app/api/models/google-auth-model.ts
Normal file
@ -0,0 +1,5 @@
|
||||
/* tslint:disable */
|
||||
export interface GoogleAuthModel {
|
||||
authorizationCode?: string;
|
||||
apiKey?: string;
|
||||
}
|
||||
11
src/app/api/models/smart-garden-message.ts
Normal file
11
src/app/api/models/smart-garden-message.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/* tslint:disable */
|
||||
export interface SmartGardenMessage {
|
||||
id?: string;
|
||||
type?: string;
|
||||
time?: string;
|
||||
temperature?: number;
|
||||
pressure?: number;
|
||||
humidity?: number;
|
||||
water?: number;
|
||||
light?: number;
|
||||
}
|
||||
9
src/app/api/models/smart-printer-message.ts
Normal file
9
src/app/api/models/smart-printer-message.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/* tslint:disable */
|
||||
export interface SmartPrinterMessage {
|
||||
id?: string;
|
||||
type?: string;
|
||||
time?: string;
|
||||
temperature?: number;
|
||||
pressure?: number;
|
||||
smoke?: number;
|
||||
}
|
||||
4
src/app/api/models/twitter-auth-model.ts
Normal file
4
src/app/api/models/twitter-auth-model.ts
Normal file
@ -0,0 +1,4 @@
|
||||
/* tslint:disable */
|
||||
export interface TwitterAuthModel {
|
||||
apiKey?: string;
|
||||
}
|
||||
5
src/app/api/models/user.ts
Normal file
5
src/app/api/models/user.ts
Normal file
@ -0,0 +1,5 @@
|
||||
/* tslint:disable */
|
||||
export interface User {
|
||||
id?: string;
|
||||
password?: string;
|
||||
}
|
||||
9
src/app/api/services.ts
Normal file
9
src/app/api/services.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export { AzureService } from './services/azure.service';
|
||||
export { BooksService } from './services/books.service';
|
||||
export { FacebookService } from './services/facebook.service';
|
||||
export { GoogleService } from './services/google.service';
|
||||
export { IOTService } from './services/iot.service';
|
||||
export { MQTTService } from './services/mqtt.service';
|
||||
export { TokenService } from './services/token.service';
|
||||
export { TwitterService } from './services/twitter.service';
|
||||
export { ValuesService } from './services/values.service';
|
||||
62
src/app/api/services/azure.service.ts
Normal file
62
src/app/api/services/azure.service.ts
Normal file
@ -0,0 +1,62 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { AzureADAuthModel } from '../models/azure-adauth-model';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class AzureService extends __BaseService {
|
||||
static readonly CreatePath = '/azure';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
CreateResponse(user?: AzureADAuthModel): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = user;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/azure`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
Create(user?: AzureADAuthModel): __Observable<null> {
|
||||
return this.CreateResponse(user).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module AzureService {
|
||||
}
|
||||
|
||||
export { AzureService }
|
||||
222
src/app/api/services/books.service.ts
Normal file
222
src/app/api/services/books.service.ts
Normal file
@ -0,0 +1,222 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { Book } from '../models/book';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class BooksService extends __BaseService {
|
||||
static readonly GetPath = '/api/books';
|
||||
static readonly CreatePath = '/api/books';
|
||||
static readonly GetBookPath = '/api/books/{id}';
|
||||
static readonly UpdatePath = '/api/books/{id}';
|
||||
static readonly DeletePath = '/api/books/{id}';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Success
|
||||
*/
|
||||
GetResponse(): __Observable<__StrictHttpResponse<Array<Book>>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
let req = new HttpRequest<any>(
|
||||
'GET',
|
||||
this.rootUrl + `/api/books`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<Array<Book>>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return Success
|
||||
*/
|
||||
Get(): __Observable<Array<Book>> {
|
||||
return this.GetResponse().pipe(
|
||||
__map(_r => _r.body as Array<Book>)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param book undefined
|
||||
* @return Success
|
||||
*/
|
||||
CreateResponse(book?: Book): __Observable<__StrictHttpResponse<Book>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = book;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/api/books`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<Book>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param book undefined
|
||||
* @return Success
|
||||
*/
|
||||
Create(book?: Book): __Observable<Book> {
|
||||
return this.CreateResponse(book).pipe(
|
||||
__map(_r => _r.body as Book)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id undefined
|
||||
* @return Success
|
||||
*/
|
||||
GetBookResponse(id: string): __Observable<__StrictHttpResponse<Book>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
let req = new HttpRequest<any>(
|
||||
'GET',
|
||||
this.rootUrl + `/api/books/${id}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<Book>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param id undefined
|
||||
* @return Success
|
||||
*/
|
||||
GetBook(id: string): __Observable<Book> {
|
||||
return this.GetBookResponse(id).pipe(
|
||||
__map(_r => _r.body as Book)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params The `BooksService.UpdateParams` containing the following parameters:
|
||||
*
|
||||
* - `id`:
|
||||
*
|
||||
* - `bookIn`:
|
||||
*/
|
||||
UpdateResponse(params: BooksService.UpdateParams): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
__body = params.bookIn;
|
||||
let req = new HttpRequest<any>(
|
||||
'PUT',
|
||||
this.rootUrl + `/api/books/${params.id}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param params The `BooksService.UpdateParams` containing the following parameters:
|
||||
*
|
||||
* - `id`:
|
||||
*
|
||||
* - `bookIn`:
|
||||
*/
|
||||
Update(params: BooksService.UpdateParams): __Observable<null> {
|
||||
return this.UpdateResponse(params).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id undefined
|
||||
*/
|
||||
DeleteResponse(id: string): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
let req = new HttpRequest<any>(
|
||||
'DELETE',
|
||||
this.rootUrl + `/api/books/${id}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param id undefined
|
||||
*/
|
||||
Delete(id: string): __Observable<null> {
|
||||
return this.DeleteResponse(id).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module BooksService {
|
||||
|
||||
/**
|
||||
* Parameters for Update
|
||||
*/
|
||||
export interface UpdateParams {
|
||||
id: string;
|
||||
bookIn?: Book;
|
||||
}
|
||||
}
|
||||
|
||||
export { BooksService }
|
||||
62
src/app/api/services/facebook.service.ts
Normal file
62
src/app/api/services/facebook.service.ts
Normal file
@ -0,0 +1,62 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { FacebookAuthModel } from '../models/facebook-auth-model';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class FacebookService extends __BaseService {
|
||||
static readonly CreatePath = '/facebook';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
CreateResponse(user?: FacebookAuthModel): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = user;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/facebook`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
Create(user?: FacebookAuthModel): __Observable<null> {
|
||||
return this.CreateResponse(user).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module FacebookService {
|
||||
}
|
||||
|
||||
export { FacebookService }
|
||||
62
src/app/api/services/google.service.ts
Normal file
62
src/app/api/services/google.service.ts
Normal file
@ -0,0 +1,62 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { GoogleAuthModel } from '../models/google-auth-model';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class GoogleService extends __BaseService {
|
||||
static readonly CreatePath = '/google';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
CreateResponse(user?: GoogleAuthModel): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = user;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/google`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
Create(user?: GoogleAuthModel): __Observable<null> {
|
||||
return this.CreateResponse(user).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module GoogleService {
|
||||
}
|
||||
|
||||
export { GoogleService }
|
||||
200
src/app/api/services/iot.service.ts
Normal file
200
src/app/api/services/iot.service.ts
Normal file
@ -0,0 +1,200 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { SmartPrinterMessage } from '../models/smart-printer-message';
|
||||
import { SmartGardenMessage } from '../models/smart-garden-message';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class IOTService extends __BaseService {
|
||||
static readonly GetSmartPrinterMessagesPath = '/api/iot/smartprinter/{idDevice}';
|
||||
static readonly PostToDBPrinterPath = '/api/iot/smartprinter/{idDevice}';
|
||||
static readonly PostToDBSmartGardenPath = '/api/iot/smartgarden/{idDevice}';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params The `IOTService.GetSmartPrinterMessagesParams` containing the following parameters:
|
||||
*
|
||||
* - `idDevice`:
|
||||
*
|
||||
* - `id`: Id of the smart printer message
|
||||
*
|
||||
* @return Success
|
||||
*/
|
||||
GetSmartPrinterMessagesResponse(params: IOTService.GetSmartPrinterMessagesParams): __Observable<__StrictHttpResponse<Array<SmartPrinterMessage>>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
if (params.id != null) __params = __params.set('id', params.id.toString());
|
||||
let req = new HttpRequest<any>(
|
||||
'GET',
|
||||
this.rootUrl + `/api/iot/smartprinter/${params.idDevice}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<Array<SmartPrinterMessage>>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param params The `IOTService.GetSmartPrinterMessagesParams` containing the following parameters:
|
||||
*
|
||||
* - `idDevice`:
|
||||
*
|
||||
* - `id`: Id of the smart printer message
|
||||
*
|
||||
* @return Success
|
||||
*/
|
||||
GetSmartPrinterMessages(params: IOTService.GetSmartPrinterMessagesParams): __Observable<Array<SmartPrinterMessage>> {
|
||||
return this.GetSmartPrinterMessagesResponse(params).pipe(
|
||||
__map(_r => _r.body as Array<SmartPrinterMessage>)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params The `IOTService.PostToDBPrinterParams` containing the following parameters:
|
||||
*
|
||||
* - `idDevice`: Id of the device to upload to DB
|
||||
*
|
||||
* - `content`: Content that will be uploaded
|
||||
*/
|
||||
PostToDBPrinterResponse(params: IOTService.PostToDBPrinterParams): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
__body = params.content;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/api/iot/smartprinter/${params.idDevice}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param params The `IOTService.PostToDBPrinterParams` containing the following parameters:
|
||||
*
|
||||
* - `idDevice`: Id of the device to upload to DB
|
||||
*
|
||||
* - `content`: Content that will be uploaded
|
||||
*/
|
||||
PostToDBPrinter(params: IOTService.PostToDBPrinterParams): __Observable<null> {
|
||||
return this.PostToDBPrinterResponse(params).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params The `IOTService.PostToDBSmartGardenParams` containing the following parameters:
|
||||
*
|
||||
* - `idDevice`:
|
||||
*
|
||||
* - `content`:
|
||||
*/
|
||||
PostToDBSmartGardenResponse(params: IOTService.PostToDBSmartGardenParams): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
__body = params.content;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/api/iot/smartgarden/${params.idDevice}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param params The `IOTService.PostToDBSmartGardenParams` containing the following parameters:
|
||||
*
|
||||
* - `idDevice`:
|
||||
*
|
||||
* - `content`:
|
||||
*/
|
||||
PostToDBSmartGarden(params: IOTService.PostToDBSmartGardenParams): __Observable<null> {
|
||||
return this.PostToDBSmartGardenResponse(params).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module IOTService {
|
||||
|
||||
/**
|
||||
* Parameters for GetSmartPrinterMessages
|
||||
*/
|
||||
export interface GetSmartPrinterMessagesParams {
|
||||
idDevice: string;
|
||||
|
||||
/**
|
||||
* Id of the smart printer message
|
||||
*/
|
||||
id?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters for PostToDBPrinter
|
||||
*/
|
||||
export interface PostToDBPrinterParams {
|
||||
|
||||
/**
|
||||
* Id of the device to upload to DB
|
||||
*/
|
||||
idDevice: number;
|
||||
|
||||
/**
|
||||
* Content that will be uploaded
|
||||
*/
|
||||
content?: Array<SmartPrinterMessage>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parameters for PostToDBSmartGarden
|
||||
*/
|
||||
export interface PostToDBSmartGardenParams {
|
||||
idDevice: number;
|
||||
content?: Array<SmartGardenMessage>;
|
||||
}
|
||||
}
|
||||
|
||||
export { IOTService }
|
||||
52
src/app/api/services/mqtt.service.ts
Normal file
52
src/app/api/services/mqtt.service.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class MQTTService extends __BaseService {
|
||||
static readonly GetToPublishMqttPath = '/api/mqtt';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
GetToPublishMqttResponse(): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
let req = new HttpRequest<any>(
|
||||
'GET',
|
||||
this.rootUrl + `/api/mqtt`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
} GetToPublishMqtt(): __Observable<null> {
|
||||
return this.GetToPublishMqttResponse().pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module MQTTService {
|
||||
}
|
||||
|
||||
export { MQTTService }
|
||||
114
src/app/api/services/token.service.ts
Normal file
114
src/app/api/services/token.service.ts
Normal file
@ -0,0 +1,114 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { User } from '../models/user';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class TokenService extends __BaseService {
|
||||
static readonly CreatePath = '/api/token';
|
||||
static readonly Create_1Path = '/token';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params The `TokenService.CreateParams` containing the following parameters:
|
||||
*
|
||||
* - `username`:
|
||||
*
|
||||
* - `password`:
|
||||
*/
|
||||
CreateResponse(params: TokenService.CreateParams): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
if (params.username != null) __params = __params.set('username', params.username.toString());
|
||||
if (params.password != null) __params = __params.set('password', params.password.toString());
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/api/token`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param params The `TokenService.CreateParams` containing the following parameters:
|
||||
*
|
||||
* - `username`:
|
||||
*
|
||||
* - `password`:
|
||||
*/
|
||||
Create(params: TokenService.CreateParams): __Observable<null> {
|
||||
return this.CreateResponse(params).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
Create_1Response(user?: User): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = user;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/token`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
Create_1(user?: User): __Observable<null> {
|
||||
return this.Create_1Response(user).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module TokenService {
|
||||
|
||||
/**
|
||||
* Parameters for Create
|
||||
*/
|
||||
export interface CreateParams {
|
||||
username?: string;
|
||||
password?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export { TokenService }
|
||||
62
src/app/api/services/twitter.service.ts
Normal file
62
src/app/api/services/twitter.service.ts
Normal file
@ -0,0 +1,62 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
import { TwitterAuthModel } from '../models/twitter-auth-model';
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class TwitterService extends __BaseService {
|
||||
static readonly CreatePath = '/twitter';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
CreateResponse(user?: TwitterAuthModel): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = user;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/twitter`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param user undefined
|
||||
*/
|
||||
Create(user?: TwitterAuthModel): __Observable<null> {
|
||||
return this.CreateResponse(user).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module TwitterService {
|
||||
}
|
||||
|
||||
export { TwitterService }
|
||||
219
src/app/api/services/values.service.ts
Normal file
219
src/app/api/services/values.service.ts
Normal file
@ -0,0 +1,219 @@
|
||||
/* tslint:disable */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
|
||||
import { BaseService as __BaseService } from '../base-service';
|
||||
import { ApiConfiguration as __Configuration } from '../api-configuration';
|
||||
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
|
||||
import { Observable as __Observable } from 'rxjs';
|
||||
import { map as __map, filter as __filter } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
class ValuesService extends __BaseService {
|
||||
static readonly GetPath = '/api/test';
|
||||
static readonly PostPath = '/api/test';
|
||||
static readonly Get_1Path = '/api/test/{id}';
|
||||
static readonly PutPath = '/api/test/{id}';
|
||||
static readonly DeletePath = '/api/test/{id}';
|
||||
|
||||
constructor(
|
||||
config: __Configuration,
|
||||
http: HttpClient
|
||||
) {
|
||||
super(config, http);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Success
|
||||
*/
|
||||
GetResponse(): __Observable<__StrictHttpResponse<Array<string>>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
let req = new HttpRequest<any>(
|
||||
'GET',
|
||||
this.rootUrl + `/api/test`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<Array<string>>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return Success
|
||||
*/
|
||||
Get(): __Observable<Array<string>> {
|
||||
return this.GetResponse().pipe(
|
||||
__map(_r => _r.body as Array<string>)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value undefined
|
||||
*/
|
||||
PostResponse(value?: string): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
__body = value;
|
||||
let req = new HttpRequest<any>(
|
||||
'POST',
|
||||
this.rootUrl + `/api/test`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param value undefined
|
||||
*/
|
||||
Post(value?: string): __Observable<null> {
|
||||
return this.PostResponse(value).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id undefined
|
||||
* @return Success
|
||||
*/
|
||||
Get_1Response(id: number): __Observable<__StrictHttpResponse<string>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
let req = new HttpRequest<any>(
|
||||
'GET',
|
||||
this.rootUrl + `/api/test/${id}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'text'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<string>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param id undefined
|
||||
* @return Success
|
||||
*/
|
||||
Get_1(id: number): __Observable<string> {
|
||||
return this.Get_1Response(id).pipe(
|
||||
__map(_r => _r.body as string)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params The `ValuesService.PutParams` containing the following parameters:
|
||||
*
|
||||
* - `id`:
|
||||
*
|
||||
* - `value`:
|
||||
*/
|
||||
PutResponse(params: ValuesService.PutParams): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
__body = params.value;
|
||||
let req = new HttpRequest<any>(
|
||||
'PUT',
|
||||
this.rootUrl + `/api/test/${params.id}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param params The `ValuesService.PutParams` containing the following parameters:
|
||||
*
|
||||
* - `id`:
|
||||
*
|
||||
* - `value`:
|
||||
*/
|
||||
Put(params: ValuesService.PutParams): __Observable<null> {
|
||||
return this.PutResponse(params).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id undefined
|
||||
*/
|
||||
DeleteResponse(id: number): __Observable<__StrictHttpResponse<null>> {
|
||||
let __params = this.newParams();
|
||||
let __headers = new HttpHeaders();
|
||||
let __body: any = null;
|
||||
|
||||
let req = new HttpRequest<any>(
|
||||
'DELETE',
|
||||
this.rootUrl + `/api/test/${id}`,
|
||||
__body,
|
||||
{
|
||||
headers: __headers,
|
||||
params: __params,
|
||||
responseType: 'json'
|
||||
});
|
||||
|
||||
return this.http.request<any>(req).pipe(
|
||||
__filter(_r => _r instanceof HttpResponse),
|
||||
__map((_r) => {
|
||||
return _r as __StrictHttpResponse<null>;
|
||||
})
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @param id undefined
|
||||
*/
|
||||
Delete(id: number): __Observable<null> {
|
||||
return this.DeleteResponse(id).pipe(
|
||||
__map(_r => _r.body as null)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module ValuesService {
|
||||
|
||||
/**
|
||||
* Parameters for Put
|
||||
*/
|
||||
export interface PutParams {
|
||||
id: number;
|
||||
value?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export { ValuesService }
|
||||
9
src/app/api/strict-http-response.ts
Normal file
9
src/app/api/strict-http-response.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/* tslint:disable */
|
||||
import { HttpResponse } from '@angular/common/http';
|
||||
|
||||
/**
|
||||
* Constrains the http to not expand the response type with `| null`
|
||||
*/
|
||||
export type StrictHttpResponse<T> = HttpResponse<T> & {
|
||||
readonly body: T;
|
||||
}
|
||||
@ -23,8 +23,6 @@ p-toolbar {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
p-toolbar .ui-button {
|
||||
background-color: transparent ;
|
||||
opacity: 1;
|
||||
|
||||
@ -10,8 +10,8 @@
|
||||
<button pButton type="button" label="TEAM" ></button>
|
||||
<button pButton type="button" label="CONTACT" ></button>
|
||||
|
||||
<button pButton type="button" label="SIGN UP" icon="pi pi-pencil" iconPos="right" (click)="signUp()"></button>
|
||||
<button pButton type="button" label="LOG IN" icon="pi pi-sign-in" iconPos="right" (click)="logIn()"></button>
|
||||
<button pButton type="button" label="SIGN UP" icon="pi pi-pencil" iconPos="right" (click)="SignUp()"></button>
|
||||
<button pButton type="button" label="LOG IN" icon="pi pi-sign-in" iconPos="right" (click)="DisplayModalLogin = true"></button>
|
||||
|
||||
<p-splitButton *ngIf="Connected" class="btnDeMerde" type="button" label="Nom du gars"></p-splitButton>
|
||||
|
||||
@ -20,22 +20,22 @@
|
||||
|
||||
</p-toolbar>
|
||||
|
||||
<p-dialog [(visible)]="display" [style]="">
|
||||
<p-dialog [(visible)]="DisplayModalLogin" [style]="">
|
||||
<p-header>
|
||||
Log In
|
||||
</p-header>
|
||||
|
||||
<div class="ui-inputgroup">
|
||||
<span class="ui-inputgroup-addon"><i class="fa fa-user"></i></span>
|
||||
<input type="text" pInputText placeholder="Username">
|
||||
<input type="text" [(ngModel)]="Username" pInputText placeholder="Username" >
|
||||
</div>
|
||||
<div class="ui-inputgroup">
|
||||
<span class="ui-inputgroup-addon"><i class="fa fa-lock"></i></span>
|
||||
<input type="password" pInputText placeholder="Password">
|
||||
<input type="password" [(ngModel)]="Password" pInputText placeholder="Password" >
|
||||
</div>
|
||||
|
||||
<p-footer>
|
||||
<button pButton type="button" label="Identify"></button>
|
||||
<button pButton type="button" label="Identify" (click)="LogIn()"></button>
|
||||
</p-footer>
|
||||
</p-dialog>
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {MenuItem} from 'primeng/api';
|
||||
import { MenuItem } from 'primeng/api';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -13,9 +14,13 @@ export class AppComponent implements OnInit{
|
||||
items : MenuItem[];
|
||||
|
||||
public Connected : false;
|
||||
display: boolean = false;
|
||||
public DisplayModalLogin: boolean = false;
|
||||
public Username: string = null;
|
||||
public Password: string = null;
|
||||
|
||||
constructor(){}
|
||||
constructor(
|
||||
private _appService: AppService
|
||||
){}
|
||||
ngOnInit(){
|
||||
this.items = [
|
||||
{label: 'Update', icon: 'pi pi-refresh'},
|
||||
@ -24,10 +29,15 @@ export class AppComponent implements OnInit{
|
||||
}
|
||||
|
||||
|
||||
public logIn()
|
||||
public LogIn()
|
||||
{
|
||||
this.display = true;
|
||||
console.log('helloooo');
|
||||
this._appService.GetToken(this.Username, this.Password)
|
||||
.subscribe(res => {
|
||||
console.log(res.Token);
|
||||
}, () => {
|
||||
console.log('ERROR');
|
||||
});
|
||||
|
||||
// change route -> /login
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule, Provider, APP_INITIALIZER } from '@angular/core';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { HomePageComponent } from './home-page/home-page.component';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { AlertModule } from 'ngx-bootstrap/alert';
|
||||
import { BsDatepickerModule } from 'ngx-bootstrap/datepicker';
|
||||
@ -14,11 +15,25 @@ import { BorderCardDirective } from './directives/border-card.directive';
|
||||
import { ToolbarModule } from 'primeng/toolbar';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { SplitButtonModule } from 'primeng/splitbutton';
|
||||
import {DialogModule} from 'primeng/dialog';
|
||||
import {InputTextModule} from 'primeng/inputtext';
|
||||
import { DialogModule } from 'primeng/dialog';
|
||||
import { InputTextModule } from 'primeng/inputtext';
|
||||
import { ApiConfiguration } from './api/api-configuration';
|
||||
import { AppService } from './app.service';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
|
||||
export function initApiConfiguration(config: ApiConfiguration): Function {
|
||||
return () => {
|
||||
config.rootUrl='https://localhost:5001'; // None = same rooturl
|
||||
};
|
||||
}
|
||||
|
||||
export const INIT_API_CONFIGURATION: Provider = {
|
||||
provide:APP_INITIALIZER,
|
||||
useFactory:initApiConfiguration,
|
||||
deps: [ApiConfiguration],
|
||||
multi:true
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -40,11 +55,14 @@ import {InputTextModule} from 'primeng/inputtext';
|
||||
ButtonModule,
|
||||
SplitButtonModule,
|
||||
DialogModule,
|
||||
InputTextModule
|
||||
|
||||
|
||||
InputTextModule,
|
||||
HttpClientModule,
|
||||
FormsModule
|
||||
],
|
||||
providers: [
|
||||
INIT_API_CONFIGURATION,
|
||||
AppService
|
||||
],
|
||||
providers: [],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
21
src/app/app.service.ts
Normal file
21
src/app/app.service.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TokenService } from './api/services/token.service';
|
||||
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class AppService {
|
||||
constructor(
|
||||
protected http: HttpClient,
|
||||
private _tokenService: TokenService
|
||||
) { }
|
||||
|
||||
public GetToken(username: string, password: string): Observable<any> {
|
||||
return this._tokenService.Create({username: username, password: password});
|
||||
}
|
||||
|
||||
}
|
||||
1
swagger.json
Normal file
1
swagger.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user