diff --git a/src/app/_api/api.module.ts b/src/app/_api/api.module.ts index f39c1ce..8c793a1 100644 --- a/src/app/_api/api.module.ts +++ b/src/app/_api/api.module.ts @@ -5,6 +5,7 @@ import { ApiConfiguration, ApiConfigurationInterface } from './api-configuration import { AzureService } from './services/azure.service'; import { BooksService } from './services/books.service'; +import { DeviceService } from './services/device.service'; import { FacebookService } from './services/facebook.service'; import { GoogleService } from './services/google.service'; import { IOTService } from './services/iot.service'; @@ -29,6 +30,7 @@ import { ValuesService } from './services/values.service'; ApiConfiguration, AzureService, BooksService, + DeviceService, FacebookService, GoogleService, IOTService, diff --git a/src/app/_api/models.ts b/src/app/_api/models.ts index b8743ec..aa77a18 100644 --- a/src/app/_api/models.ts +++ b/src/app/_api/models.ts @@ -1,9 +1,12 @@ export { AzureADAuthModel } from './models/azure-adauth-model'; export { Book } from './models/book'; +export { Device } from './models/device'; 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 { UserInfo } from './models/user-info'; +export { ScreenConfiguration } from './models/screen-configuration'; +export { Widget } from './models/widget'; export { User } from './models/user'; export { TwitterAuthModel } from './models/twitter-auth-model'; -export { UserInfo } from './models/user-info'; diff --git a/src/app/_api/models/device.ts b/src/app/_api/models/device.ts new file mode 100644 index 0000000..785330c --- /dev/null +++ b/src/app/_api/models/device.ts @@ -0,0 +1,10 @@ +/* tslint:disable */ +export interface Device { + id?: string; + name?: string; + type?: string; + location?: string; + locationExplanation?: string; + height?: number; + width?: number; +} diff --git a/src/app/_api/models/screen-configuration.ts b/src/app/_api/models/screen-configuration.ts new file mode 100644 index 0000000..9b84ec6 --- /dev/null +++ b/src/app/_api/models/screen-configuration.ts @@ -0,0 +1,10 @@ +/* tslint:disable */ +import { Widget } from './widget'; +export interface ScreenConfiguration { + id?: string; + name?: string; + type?: string; + widgets?: Array; + height?: number; + width?: number; +} diff --git a/src/app/_api/models/user-info.ts b/src/app/_api/models/user-info.ts index 189050d..c56d908 100644 --- a/src/app/_api/models/user-info.ts +++ b/src/app/_api/models/user-info.ts @@ -1,11 +1,21 @@ /* tslint:disable */ +import { ScreenConfiguration } from './screen-configuration'; +import { Device } from './device'; export interface UserInfo { + address?: string; id?: string; - role?: string; - username?: string; + email?: string; password?: string; firstName?: string; lastName?: string; token?: string; birthday?: string; + role?: string; + city?: string; + state?: string; + language?: string; + timeZone?: string; + postalCode?: number; + screenConfigurationIds?: Array; + deviceIds?: Array; } diff --git a/src/app/_api/models/widget.ts b/src/app/_api/models/widget.ts new file mode 100644 index 0000000..4e75860 --- /dev/null +++ b/src/app/_api/models/widget.ts @@ -0,0 +1,16 @@ +/* tslint:disable */ +export interface Widget { + font?: string; + id?: string; + displayName?: string; + type?: string; + activated?: boolean; + form?: string; + name?: string; + color?: string; + size?: string; + width?: number; + height?: number; + positionX?: number; + positionY?: number; +} diff --git a/src/app/_api/services.ts b/src/app/_api/services.ts index e2aa904..14f2824 100644 --- a/src/app/_api/services.ts +++ b/src/app/_api/services.ts @@ -1,5 +1,6 @@ export { AzureService } from './services/azure.service'; export { BooksService } from './services/books.service'; +export { DeviceService } from './services/device.service'; export { FacebookService } from './services/facebook.service'; export { GoogleService } from './services/google.service'; export { IOTService } from './services/iot.service'; diff --git a/src/app/_api/services/device.service.ts b/src/app/_api/services/device.service.ts new file mode 100644 index 0000000..eb29fa9 --- /dev/null +++ b/src/app/_api/services/device.service.ts @@ -0,0 +1,254 @@ +/* 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 { Device } from '../models/device'; +@Injectable({ + providedIn: 'root', +}) +class DeviceService extends __BaseService { + static readonly GetAllDevicesPath = '/api/device'; + static readonly CreateDevicePath = '/api/device'; + static readonly GetDeviceInfoPath = '/api/device/{idDevice}'; + static readonly UpdateDevicePath = '/api/device/{idDevice}'; + static readonly DeleteDevicePath = '/api/device/{idDevice}'; + + constructor( + config: __Configuration, + http: HttpClient + ) { + super(config, http); + } + + /** + * @return Success + */ + GetAllDevicesResponse(): __Observable<__StrictHttpResponse>> { + let __params = this.newParams(); + let __headers = new HttpHeaders(); + let __body: any = null; + let req = new HttpRequest( + 'GET', + this.rootUrl + `/api/device`, + __body, + { + headers: __headers, + params: __params, + responseType: 'json' + }); + + return this.http.request(req).pipe( + __filter(_r => _r instanceof HttpResponse), + __map((_r) => { + return _r as __StrictHttpResponse>; + }) + ); + } + /** + * @return Success + */ + GetAllDevices(): __Observable> { + return this.GetAllDevicesResponse().pipe( + __map(_r => _r.body as Array) + ); + } + + /** + * @param params The `DeviceService.CreateDeviceParams` containing the following parameters: + * + * - `idDevice`: + * + * - `device`: + */ + CreateDeviceResponse(params: DeviceService.CreateDeviceParams): __Observable<__StrictHttpResponse> { + let __params = this.newParams(); + let __headers = new HttpHeaders(); + let __body: any = null; + if (params.idDevice != null) __params = __params.set('idDevice', params.idDevice.toString()); + __body = params.device; + let req = new HttpRequest( + 'POST', + this.rootUrl + `/api/device`, + __body, + { + headers: __headers, + params: __params, + responseType: 'json' + }); + + return this.http.request(req).pipe( + __filter(_r => _r instanceof HttpResponse), + __map((_r) => { + return _r as __StrictHttpResponse; + }) + ); + } + /** + * @param params The `DeviceService.CreateDeviceParams` containing the following parameters: + * + * - `idDevice`: + * + * - `device`: + */ + CreateDevice(params: DeviceService.CreateDeviceParams): __Observable { + return this.CreateDeviceResponse(params).pipe( + __map(_r => _r.body as null) + ); + } + + /** + * @param idDevice Id of the device you want to get information + * @return Success + */ + GetDeviceInfoResponse(idDevice: string): __Observable<__StrictHttpResponse> { + let __params = this.newParams(); + let __headers = new HttpHeaders(); + let __body: any = null; + + let req = new HttpRequest( + 'GET', + this.rootUrl + `/api/device/${idDevice}`, + __body, + { + headers: __headers, + params: __params, + responseType: 'json' + }); + + return this.http.request(req).pipe( + __filter(_r => _r instanceof HttpResponse), + __map((_r) => { + return _r as __StrictHttpResponse; + }) + ); + } + /** + * @param idDevice Id of the device you want to get information + * @return Success + */ + GetDeviceInfo(idDevice: string): __Observable { + return this.GetDeviceInfoResponse(idDevice).pipe( + __map(_r => _r.body as Device) + ); + } + + /** + * @param params The `DeviceService.UpdateDeviceParams` containing the following parameters: + * + * - `idDevice`: + * + * - `device`: + */ + UpdateDeviceResponse(params: DeviceService.UpdateDeviceParams): __Observable<__StrictHttpResponse> { + let __params = this.newParams(); + let __headers = new HttpHeaders(); + let __body: any = null; + + __body = params.device; + let req = new HttpRequest( + 'PUT', + this.rootUrl + `/api/device/${params.idDevice}`, + __body, + { + headers: __headers, + params: __params, + responseType: 'json' + }); + + return this.http.request(req).pipe( + __filter(_r => _r instanceof HttpResponse), + __map((_r) => { + return _r as __StrictHttpResponse; + }) + ); + } + /** + * @param params The `DeviceService.UpdateDeviceParams` containing the following parameters: + * + * - `idDevice`: + * + * - `device`: + */ + UpdateDevice(params: DeviceService.UpdateDeviceParams): __Observable { + return this.UpdateDeviceResponse(params).pipe( + __map(_r => _r.body as null) + ); + } + + /** + * @param params The `DeviceService.DeleteDeviceParams` containing the following parameters: + * + * - `idDevice`: + * + * - `deviceId`: + */ + DeleteDeviceResponse(params: DeviceService.DeleteDeviceParams): __Observable<__StrictHttpResponse> { + let __params = this.newParams(); + let __headers = new HttpHeaders(); + let __body: any = null; + + __body = params.deviceId; + let req = new HttpRequest( + 'DELETE', + this.rootUrl + `/api/device/${params.idDevice}`, + __body, + { + headers: __headers, + params: __params, + responseType: 'json' + }); + + return this.http.request(req).pipe( + __filter(_r => _r instanceof HttpResponse), + __map((_r) => { + return _r as __StrictHttpResponse; + }) + ); + } + /** + * @param params The `DeviceService.DeleteDeviceParams` containing the following parameters: + * + * - `idDevice`: + * + * - `deviceId`: + */ + DeleteDevice(params: DeviceService.DeleteDeviceParams): __Observable { + return this.DeleteDeviceResponse(params).pipe( + __map(_r => _r.body as null) + ); + } +} + +module DeviceService { + + /** + * Parameters for CreateDevice + */ + export interface CreateDeviceParams { + idDevice?: number; + device?: Device; + } + + /** + * Parameters for UpdateDevice + */ + export interface UpdateDeviceParams { + idDevice: number; + device?: Device; + } + + /** + * Parameters for DeleteDevice + */ + export interface DeleteDeviceParams { + idDevice: number; + deviceId?: string; + } +} + +export { DeviceService } diff --git a/src/app/_api/services/token.service.ts b/src/app/_api/services/token.service.ts index f64dbf3..bc388dc 100644 --- a/src/app/_api/services/token.service.ts +++ b/src/app/_api/services/token.service.ts @@ -7,6 +7,7 @@ import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-respo import { Observable as __Observable } from 'rxjs'; import { map as __map, filter as __filter } from 'rxjs/operators'; +import { UserInfo } from '../models/user-info'; import { User } from '../models/user'; @Injectable({ providedIn: 'root', @@ -25,16 +26,18 @@ class TokenService extends __BaseService { /** * @param params The `TokenService.CreateParams` containing the following parameters: * - * - `username`: - * * - `password`: + * + * - `email`: + * + * @return Success */ - CreateResponse(params: TokenService.CreateParams): __Observable<__StrictHttpResponse> { + CreateResponse(params: TokenService.CreateParams): __Observable<__StrictHttpResponse> { 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()); + if (params.email != null) __params = __params.set('email', params.email.toString()); let req = new HttpRequest( 'POST', this.rootUrl + `/api/token`, @@ -48,20 +51,22 @@ class TokenService extends __BaseService { return this.http.request(req).pipe( __filter(_r => _r instanceof HttpResponse), __map((_r) => { - return _r as __StrictHttpResponse; + return _r as __StrictHttpResponse; }) ); } /** * @param params The `TokenService.CreateParams` containing the following parameters: * - * - `username`: - * * - `password`: + * + * - `email`: + * + * @return Success */ - Create(params: TokenService.CreateParams): __Observable { + Create(params: TokenService.CreateParams): __Observable { return this.CreateResponse(params).pipe( - __map(_r => _r.body as null) + __map(_r => _r.body as UserInfo) ); } @@ -106,8 +111,8 @@ module TokenService { * Parameters for Create */ export interface CreateParams { - username?: string; password?: string; + email?: string; } } diff --git a/src/app/_api/services/user.service.ts b/src/app/_api/services/user.service.ts index df316d8..9a05a9e 100644 --- a/src/app/_api/services/user.service.ts +++ b/src/app/_api/services/user.service.ts @@ -13,6 +13,7 @@ import { UserInfo } from '../models/user-info'; }) class UserService extends __BaseService { static readonly GetPath = '/api/user'; + static readonly CreateUserPath = '/api/user'; static readonly Get_1Path = '/api/user/{id}'; constructor( @@ -55,6 +56,42 @@ class UserService extends __BaseService { ); } + /** + * @param newUser undefined + * @return Success + */ + CreateUserResponse(newUser?: UserInfo): __Observable<__StrictHttpResponse> { + let __params = this.newParams(); + let __headers = new HttpHeaders(); + let __body: any = null; + __body = newUser; + let req = new HttpRequest( + 'POST', + this.rootUrl + `/api/user`, + __body, + { + headers: __headers, + params: __params, + responseType: 'json' + }); + + return this.http.request(req).pipe( + __filter(_r => _r instanceof HttpResponse), + __map((_r) => { + return _r as __StrictHttpResponse; + }) + ); + } + /** + * @param newUser undefined + * @return Success + */ + CreateUser(newUser?: UserInfo): __Observable { + return this.CreateUserResponse(newUser).pipe( + __map(_r => _r.body as UserInfo) + ); + } + /** * @param id id user * @return Success diff --git a/src/app/_helpers/error.interceptor.ts b/src/app/_helpers/error.interceptor.ts index 8ba1034..d61761d 100644 --- a/src/app/_helpers/error.interceptor.ts +++ b/src/app/_helpers/error.interceptor.ts @@ -19,6 +19,6 @@ export class ErrorInterceptor implements HttpInterceptor { const error = err.error.message || err.statusText; return throwError(error); - })) + })); } -} \ No newline at end of file +} diff --git a/src/app/_services/authentication.service.ts b/src/app/_services/authentication.service.ts index 914d1d1..635fbce 100644 --- a/src/app/_services/authentication.service.ts +++ b/src/app/_services/authentication.service.ts @@ -24,16 +24,16 @@ export class AuthenticationService { this.currentUser = this.currentUserSubject.asObservable(); } - public GetToken(username: string, password: string): Observable { - return this._tokenService.Create({username: username, password: password}); + public GetToken(user: UserInfo): Observable { + return this._tokenService.Create(user); } public GetAuthStatus() { return this.IsLoggedIn; } - public Login(username: string, password: string) { - return this._tokenService.Create({username: username, password: password}) + public Login(user: UserInfo) { + return this._tokenService.Create(user) .pipe(map(user => { // store user details and jwt token in local storage to keep user logged in between page refreshes localStorage.setItem('currentUser', JSON.stringify(user)); diff --git a/src/app/app.component.html b/src/app/app.component.html index 7dc9b11..a748151 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -23,7 +23,7 @@
- +
@@ -43,13 +43,13 @@
- +
- +
@@ -62,7 +62,7 @@
- +
@@ -105,18 +105,19 @@
- +
- + +
- + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 994c6d0..5241a76 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -6,6 +6,7 @@ import { AuthenticationService } from './_services/authentication.service'; import { Router } from '@angular/router'; import { first } from 'rxjs/operators'; import { UserInfo } from './_api/models'; +import { UserService } from './_api/services'; @Component({ @@ -26,11 +27,14 @@ export class AppComponent implements OnInit { public DisplayPersonalField = false; // Login - public Username: string = null; + public Email: string = null; public Password: string = null; public birthday: Date; + public CreateUser: UserInfo = {}; + public UserTryingToLogin: UserInfo = {}; + // Label public LabelDropDownLogout: string; public LabelDropDownModifyUser: string; @@ -39,6 +43,7 @@ export class AppComponent implements OnInit { private _appService: AppService, private _translateService: TranslateService, private _authService: AuthenticationService, + private _userService: UserService, private _router: Router ) {} @@ -69,12 +74,10 @@ export class AppComponent implements OnInit { this.ConnectedUser = currentUser; this.Connected = true; this.DisplayLoginModal = false; - this.Username = null; + this.Email = null; this.Password = null; this._authService.IsLoggedIn = true; } - - } @@ -93,7 +96,9 @@ export class AppComponent implements OnInit { console.log('ERROR'); });*/ - this._authService.Login(this.Username, this.Password) + this.UserTryingToLogin.email = this.Email; + this.UserTryingToLogin.password = this.Password; + this._authService.Login(this.UserTryingToLogin) .pipe(first()) .subscribe( data => { @@ -101,7 +106,7 @@ export class AppComponent implements OnInit { this.ConnectedUser = data; this.Connected = true; this.DisplayLoginModal = false; - this.Username = null; + this.Email = null; this.Password = null; this._authService.IsLoggedIn = true; this._router.navigate(['/profile/01']); @@ -116,7 +121,7 @@ export class AppComponent implements OnInit { public Logout() { this._authService.Logout(); this.Connected = false; - this.Username = null; + this.Email = null; this.Password = null; this._authService.IsLoggedIn = false; this._router.navigate(['/home']); @@ -129,4 +134,27 @@ export class AppComponent implements OnInit { public GoHome() { this._router.navigate(['/home']); } + + public CreateProfile() { + // ADD FIELDS VERIFICATION + console.log('GHelfoudlkfhj'); + this.CreateUser.deviceIds = []; + this._userService.CreateUser(this.CreateUser) + .subscribe( + data => { + // TO CHANGE + console.log(data); + this.ConnectedUser = data; + this.Connected = true; + this.DisplayLoginModal = false; + this.Email = null; + this.Password = null; + this._authService.IsLoggedIn = true; + // this._router.navigate(['/profile/01']); + }, + error => { + console.log('ERROR'); + }); + } + } diff --git a/swagger.json b/swagger.json index abe177a..72370b0 100644 --- a/swagger.json +++ b/swagger.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"version":"v1","title":"MyCoreApi"},"paths":{"/azure":{"post":{"tags":["Azure"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/AzureADAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/books":{"get":{"tags":["Books"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Book"}}}}},"post":{"tags":["Books"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"book","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}}},"/api/books/{id}":{"get":{"tags":["Books"],"operationId":"GetBook","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}},"put":{"tags":["Books"],"operationId":"Update","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"},{"name":"bookIn","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Books"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/facebook":{"post":{"tags":["Facebook"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/FacebookAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/google":{"post":{"tags":["Google"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/GoogleAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/iot/smartprinter/{idDevice}":{"get":{"tags":["IOT"],"summary":"Retrieve all SmartPrinterMessage","operationId":"GetSmartPrinterMessages","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"query","description":"Id of the smart printer message","required":false,"type":"integer","format":"int32"},{"name":"idDevice","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}}},"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBPrinter","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","description":"Id of the device to upload to DB","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","description":"Content that will be uploaded","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}],"responses":{"200":{"description":"Success"},"201":{"description":"Content successfully posted to DB"},"500":{"description":"Unexpected error"}}}},"/api/iot/smartgarden/{idDevice}":{"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBSmartGarden","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartGardenMessage"}}}],"responses":{"200":{"description":"Success"}}}},"/api/mqtt":{"get":{"tags":["MQTT"],"summary":"It's a mqtt publish test ! :)","operationId":"GetToPublishMqtt","consumes":[],"produces":[],"parameters":[],"responses":{"200":{"description":"Success"}}}},"/api/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":[],"produces":[],"parameters":[{"name":"username","in":"query","required":false,"type":"string"},{"name":"password","in":"query","required":false,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/User"}}],"responses":{"200":{"description":"Success"}}}},"/twitter":{"post":{"tags":["Twitter"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/TwitterAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/user":{"get":{"tags":["User"],"summary":"Get a list of user","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/UserInfo"}}}}}},"/api/user/{id}":{"get":{"tags":["User"],"summary":"Get a specific user","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","description":"id user","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/UserInfo"}}}}},"/api/test":{"get":{"tags":["Values"],"summary":"It's a test ! :)","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"type":"string"}}}}},"post":{"tags":["Values"],"operationId":"Post","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}}},"/api/test/{id}":{"get":{"tags":["Values"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success","schema":{"type":"string"}}}},"put":{"tags":["Values"],"operationId":"Put","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"},{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Values"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success"}}}}},"definitions":{"AzureADAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}},"Book":{"type":"object","properties":{"id":{"type":"string"},"bookName":{"type":"string"},"price":{"format":"double","type":"number"},"category":{"type":"string"},"author":{"type":"string"}}},"FacebookAuthModel":{"type":"object","properties":{"userAccessToken":{"type":"string"}}},"GoogleAuthModel":{"type":"object","properties":{"authorizationCode":{"type":"string"},"apiKey":{"type":"string"}}},"SmartPrinterMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"smoke":{"format":"int32","type":"integer"}}},"SmartGardenMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"humidity":{"format":"double","type":"number"},"water":{"format":"int32","type":"integer"},"light":{"format":"int32","type":"integer"}}},"User":{"type":"object","properties":{"id":{"type":"string"},"password":{"type":"string"}}},"TwitterAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}},"UserInfo":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"token":{"type":"string"},"birthday":{"type":"string"}}}},"securityDefinitions":{"Bearer":{"name":"Authorization","in":"header","type":"apiKey","description":"Please enter JWT with Bearer into field"}},"security":[{"Bearer":[]}]} \ No newline at end of file +{"swagger":"2.0","info":{"version":"v1","title":"MyCoreApi"},"paths":{"/azure":{"post":{"tags":["Azure"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/AzureADAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/books":{"get":{"tags":["Books"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Book"}}}}},"post":{"tags":["Books"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"book","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}}},"/api/books/{id}":{"get":{"tags":["Books"],"operationId":"GetBook","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}},"put":{"tags":["Books"],"operationId":"Update","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"},{"name":"bookIn","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Books"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/api/device":{"get":{"tags":["Device"],"summary":"","operationId":"GetAllDevices","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Device"}}}}},"post":{"tags":["Device"],"summary":"","operationId":"CreateDevice","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"query","required":false,"type":"integer","format":"int32"},{"name":"device","in":"body","required":false,"schema":{"$ref":"#/definitions/Device"}}],"responses":{"200":{"description":"Success"}}}},"/api/device/{idDevice}":{"get":{"tags":["Device"],"summary":"","operationId":"GetDeviceInfo","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"idDevice","in":"path","description":"Id of the device you want to get information","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Device"}}}},"put":{"tags":["Device"],"summary":"","operationId":"UpdateDevice","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","required":true,"type":"integer","format":"int32"},{"name":"device","in":"body","required":false,"schema":{"$ref":"#/definitions/Device"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Device"],"summary":"","operationId":"DeleteDevice","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","required":true,"type":"integer","format":"int32"},{"name":"deviceId","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}}},"/facebook":{"post":{"tags":["Facebook"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/FacebookAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/google":{"post":{"tags":["Google"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/GoogleAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/iot/smartprinter/{idDevice}":{"get":{"tags":["IOT"],"summary":"Retrieve all SmartPrinterMessage","operationId":"GetSmartPrinterMessages","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"query","description":"Id of the smart printer message","required":false,"type":"integer","format":"int32"},{"name":"idDevice","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}}},"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBPrinter","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","description":"Id of the device to upload to DB","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","description":"Content that will be uploaded","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}],"responses":{"200":{"description":"Success"},"201":{"description":"Content successfully posted to DB"},"500":{"description":"Unexpected error"}}}},"/api/iot/smartgarden/{idDevice}":{"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBSmartGarden","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartGardenMessage"}}}],"responses":{"200":{"description":"Success"}}}},"/api/mqtt":{"get":{"tags":["MQTT"],"summary":"It's a mqtt publish test ! :)","operationId":"GetToPublishMqtt","consumes":[],"produces":[],"parameters":[],"responses":{"200":{"description":"Success"}}}},"/api/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"email","in":"query","required":false,"type":"string"},{"name":"password","in":"query","required":false,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/UserInfo"}}}}},"/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/User"}}],"responses":{"200":{"description":"Success"}}}},"/twitter":{"post":{"tags":["Twitter"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/TwitterAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/user":{"get":{"tags":["User"],"summary":"Get a list of user","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/UserInfo"}}}}},"post":{"tags":["User"],"summary":"","operationId":"CreateUser","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"newUser","in":"body","required":false,"schema":{"$ref":"#/definitions/UserInfo"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/UserInfo"}}}}},"/api/user/{id}":{"get":{"tags":["User"],"summary":"Get a specific user","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","description":"id user","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/UserInfo"}}}}},"/api/test":{"get":{"tags":["Values"],"summary":"It's a test ! :)","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"type":"string"}}}}},"post":{"tags":["Values"],"operationId":"Post","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}}},"/api/test/{id}":{"get":{"tags":["Values"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success","schema":{"type":"string"}}}},"put":{"tags":["Values"],"operationId":"Put","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"},{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Values"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success"}}}}},"definitions":{"AzureADAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}},"Book":{"type":"object","properties":{"id":{"type":"string"},"bookName":{"type":"string"},"price":{"format":"double","type":"number"},"category":{"type":"string"},"author":{"type":"string"}}},"Device":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"location":{"type":"string"},"locationExplanation":{"type":"string"},"height":{"format":"int32","type":"integer"},"width":{"format":"int32","type":"integer"}}},"FacebookAuthModel":{"type":"object","properties":{"userAccessToken":{"type":"string"}}},"GoogleAuthModel":{"type":"object","properties":{"authorizationCode":{"type":"string"},"apiKey":{"type":"string"}}},"SmartPrinterMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"smoke":{"format":"int32","type":"integer"}}},"SmartGardenMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"humidity":{"format":"double","type":"number"},"water":{"format":"int32","type":"integer"},"light":{"format":"int32","type":"integer"}}},"UserInfo":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"email":{"type":"string"},"password":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"token":{"type":"string"},"birthday":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"language":{"type":"string"},"timeZone":{"type":"string"},"postalCode":{"format":"int32","type":"integer"},"screenConfigurationIds":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/ScreenConfiguration"}},"deviceIds":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Device"}}}},"ScreenConfiguration":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string"},"widgets":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Widget"}},"height":{"format":"int32","type":"integer"},"width":{"format":"int32","type":"integer"}}},"Widget":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"displayName":{"type":"string"},"type":{"type":"string"},"activated":{"type":"boolean"},"form":{"type":"string"},"font":{"type":"string"},"color":{"type":"string"},"size":{"type":"string"},"width":{"format":"int32","type":"integer"},"height":{"format":"int32","type":"integer"},"positionX":{"format":"int32","type":"integer"},"positionY":{"format":"int32","type":"integer"}}},"User":{"type":"object","properties":{"id":{"type":"string"},"password":{"type":"string"}}},"TwitterAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}}},"securityDefinitions":{"Bearer":{"name":"Authorization","in":"header","type":"apiKey","description":"Please enter JWT with Bearer into field"}},"security":[{"Bearer":[]}]} \ No newline at end of file