-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c253894
commit 723c46f
Showing
39 changed files
with
1,710 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { Injectable } from '@angular/core'; | ||
|
||
/** | ||
* Global configuration | ||
*/ | ||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class ApiConfiguration { | ||
rootUrl: string = 'http://localhost:8080/api/v1'; | ||
} | ||
|
||
/** | ||
* Parameters for `ApiModule.forRoot()` | ||
*/ | ||
export interface ApiConfigurationParams { | ||
rootUrl?: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { ApiConfiguration, ApiConfigurationParams } from './api-configuration'; | ||
|
||
import { FeedbackService } from './services/feedback.service'; | ||
import { BookService } from './services/book.service'; | ||
import { AuthenticationService } from './services/authentication.service'; | ||
|
||
/** | ||
* Module that provides all services and configuration. | ||
*/ | ||
@NgModule({ | ||
imports: [], | ||
exports: [], | ||
declarations: [], | ||
providers: [ | ||
FeedbackService, | ||
BookService, | ||
AuthenticationService, | ||
ApiConfiguration | ||
], | ||
}) | ||
export class ApiModule { | ||
static forRoot(params: ApiConfigurationParams): ModuleWithProviders<ApiModule> { | ||
return { | ||
ngModule: ApiModule, | ||
providers: [ | ||
{ | ||
provide: ApiConfiguration, | ||
useValue: params | ||
} | ||
] | ||
} | ||
} | ||
|
||
constructor( | ||
@Optional() @SkipSelf() parentModule: ApiModule, | ||
@Optional() http: HttpClient | ||
) { | ||
if (parentModule) { | ||
throw new Error('ApiModule is already loaded. Import in your base AppModule only.'); | ||
} | ||
if (!http) { | ||
throw new Error('You need to import the HttpClientModule in your AppModule! \n' + | ||
'See also https://github.com/angular/angular/issues/20575'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { Injectable } from '@angular/core'; | ||
import { HttpClient } from '@angular/common/http'; | ||
import { ApiConfiguration } from './api-configuration'; | ||
|
||
/** | ||
* Base class for services | ||
*/ | ||
@Injectable() | ||
export class BaseService { | ||
constructor( | ||
protected config: ApiConfiguration, | ||
protected http: HttpClient | ||
) { | ||
} | ||
|
||
private _rootUrl?: string; | ||
|
||
/** | ||
* Returns the root url for all operations in this service. 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; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
booker-ui/src/app/services/fn/authentication/activate-account.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
|
||
export interface ActivateAccount$Params { | ||
token: string; | ||
} | ||
|
||
export function activateAccount(http: HttpClient, rootUrl: string, params: ActivateAccount$Params, context?: HttpContext): Observable<StrictHttpResponse<{ | ||
}>> { | ||
const rb = new RequestBuilder(rootUrl, activateAccount.PATH, 'get'); | ||
if (params) { | ||
rb.query('token', params.token, {}); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return r as StrictHttpResponse<{ | ||
}>; | ||
}) | ||
); | ||
} | ||
|
||
activateAccount.PATH = '/auth/activate-account'; |
33 changes: 33 additions & 0 deletions
33
booker-ui/src/app/services/fn/authentication/authenticate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
import { LoginCredentials } from '../../models/login-credentials'; | ||
|
||
export interface Authenticate$Params { | ||
body: LoginCredentials | ||
} | ||
|
||
export function authenticate(http: HttpClient, rootUrl: string, params: Authenticate$Params, context?: HttpContext): Observable<StrictHttpResponse<{ | ||
}>> { | ||
const rb = new RequestBuilder(rootUrl, authenticate.PATH, 'post'); | ||
if (params) { | ||
rb.body(params.body, 'application/json'); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return r as StrictHttpResponse<{ | ||
}>; | ||
}) | ||
); | ||
} | ||
|
||
authenticate.PATH = '/auth/login'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
import { ApiResponseObject } from '../../models/api-response-object'; | ||
import { RegistrationRequest } from '../../models/registration-request'; | ||
|
||
export interface Register$Params { | ||
body: RegistrationRequest | ||
} | ||
|
||
export function register(http: HttpClient, rootUrl: string, params: Register$Params, context?: HttpContext): Observable<StrictHttpResponse<ApiResponseObject>> { | ||
const rb = new RequestBuilder(rootUrl, register.PATH, 'post'); | ||
if (params) { | ||
rb.body(params.body, 'application/json'); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return r as StrictHttpResponse<ApiResponseObject>; | ||
}) | ||
); | ||
} | ||
|
||
register.PATH = '/auth/register'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
|
||
export interface ApproveReturnBook$Params { | ||
bookId: number; | ||
} | ||
|
||
export function approveReturnBook(http: HttpClient, rootUrl: string, params: ApproveReturnBook$Params, context?: HttpContext): Observable<StrictHttpResponse<number>> { | ||
const rb = new RequestBuilder(rootUrl, approveReturnBook.PATH, 'patch'); | ||
if (params) { | ||
rb.path('bookId', params.bookId, {}); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return (r as HttpResponse<any>).clone({ body: parseFloat(String((r as HttpResponse<any>).body)) }) as StrictHttpResponse<number>; | ||
}) | ||
); | ||
} | ||
|
||
approveReturnBook.PATH = '/books/borrow/return/approve/{bookId}'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
|
||
export interface BorrowBook$Params { | ||
bookId: number; | ||
} | ||
|
||
export function borrowBook(http: HttpClient, rootUrl: string, params: BorrowBook$Params, context?: HttpContext): Observable<StrictHttpResponse<number>> { | ||
const rb = new RequestBuilder(rootUrl, borrowBook.PATH, 'post'); | ||
if (params) { | ||
rb.path('bookId', params.bookId, {}); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return (r as HttpResponse<any>).clone({ body: parseFloat(String((r as HttpResponse<any>).body)) }) as StrictHttpResponse<number>; | ||
}) | ||
); | ||
} | ||
|
||
borrowBook.PATH = '/books/borrow/{bookId}'; |
33 changes: 33 additions & 0 deletions
33
booker-ui/src/app/services/fn/book/find-all-books-by-owner.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
import { PageResponseBookResponse } from '../../models/page-response-book-response'; | ||
|
||
export interface FindAllBooksByOwner$Params { | ||
page?: number; | ||
size?: number; | ||
} | ||
|
||
export function findAllBooksByOwner(http: HttpClient, rootUrl: string, params?: FindAllBooksByOwner$Params, context?: HttpContext): Observable<StrictHttpResponse<PageResponseBookResponse>> { | ||
const rb = new RequestBuilder(rootUrl, findAllBooksByOwner.PATH, 'get'); | ||
if (params) { | ||
rb.query('page', params.page, {}); | ||
rb.query('size', params.size, {}); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return r as StrictHttpResponse<PageResponseBookResponse>; | ||
}) | ||
); | ||
} | ||
|
||
findAllBooksByOwner.PATH = '/books/owner'; |
33 changes: 33 additions & 0 deletions
33
booker-ui/src/app/services/fn/book/find-all-borrowed-books.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
import { PageResponseBorrowedBooksResponse } from '../../models/page-response-borrowed-books-response'; | ||
|
||
export interface FindAllBorrowedBooks$Params { | ||
page?: number; | ||
size?: number; | ||
} | ||
|
||
export function findAllBorrowedBooks(http: HttpClient, rootUrl: string, params?: FindAllBorrowedBooks$Params, context?: HttpContext): Observable<StrictHttpResponse<PageResponseBorrowedBooksResponse>> { | ||
const rb = new RequestBuilder(rootUrl, findAllBorrowedBooks.PATH, 'get'); | ||
if (params) { | ||
rb.query('page', params.page, {}); | ||
rb.query('size', params.size, {}); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return r as StrictHttpResponse<PageResponseBorrowedBooksResponse>; | ||
}) | ||
); | ||
} | ||
|
||
findAllBorrowedBooks.PATH = '/books/borrowed'; |
34 changes: 34 additions & 0 deletions
34
booker-ui/src/app/services/fn/book/find-all-returned-books.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { filter, map } from 'rxjs/operators'; | ||
import { StrictHttpResponse } from '../../strict-http-response'; | ||
import { RequestBuilder } from '../../request-builder'; | ||
|
||
|
||
export interface FindAllReturnedBooks$Params { | ||
page?: number; | ||
size?: number; | ||
} | ||
|
||
export function findAllReturnedBooks(http: HttpClient, rootUrl: string, params?: FindAllReturnedBooks$Params, context?: HttpContext): Observable<StrictHttpResponse<{ | ||
}>> { | ||
const rb = new RequestBuilder(rootUrl, findAllReturnedBooks.PATH, 'get'); | ||
if (params) { | ||
rb.query('page', params.page, {}); | ||
rb.query('size', params.size, {}); | ||
} | ||
|
||
return http.request( | ||
rb.build({ responseType: 'blob', accept: '*/*', context }) | ||
).pipe( | ||
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse), | ||
map((r: HttpResponse<any>) => { | ||
return r as StrictHttpResponse<{ | ||
}>; | ||
}) | ||
); | ||
} | ||
|
||
findAllReturnedBooks.PATH = '/books/returned'; |
Oops, something went wrong.