-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regenerate the OC API client for Angular
- Loading branch information
1 parent
7317fd4
commit f77550d
Showing
9 changed files
with
300 additions
and
1 deletion.
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
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
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
162 changes: 162 additions & 0 deletions
162
libs/openchallenges/api-client-angular/src/lib/api/edamConcept.service.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,162 @@ | ||
/** | ||
* OpenChallenges REST API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
/* tslint:disable:no-unused-variable member-ordering */ | ||
|
||
import { Inject, Injectable, Optional } from '@angular/core'; | ||
import { HttpClient, HttpHeaders, HttpParams, | ||
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext | ||
} from '@angular/common/http'; | ||
import { CustomHttpParameterCodec } from '../encoder'; | ||
import { Observable } from 'rxjs'; | ||
|
||
// @ts-ignore | ||
import { BasicError } from '../model/basicError'; | ||
// @ts-ignore | ||
import { EdamConceptSearchQuery } from '../model/edamConceptSearchQuery'; | ||
// @ts-ignore | ||
import { EdamConceptsPage } from '../model/edamConceptsPage'; | ||
|
||
// @ts-ignore | ||
import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; | ||
import { Configuration } from '../configuration'; | ||
|
||
|
||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class EdamConceptService { | ||
|
||
protected basePath = 'http://localhost/v1'; | ||
public defaultHeaders = new HttpHeaders(); | ||
public configuration = new Configuration(); | ||
public encoder: HttpParameterCodec; | ||
|
||
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string|string[], @Optional() configuration: Configuration) { | ||
if (configuration) { | ||
this.configuration = configuration; | ||
} | ||
if (typeof this.configuration.basePath !== 'string') { | ||
if (Array.isArray(basePath) && basePath.length > 0) { | ||
basePath = basePath[0]; | ||
} | ||
|
||
if (typeof basePath !== 'string') { | ||
basePath = this.basePath; | ||
} | ||
this.configuration.basePath = basePath; | ||
} | ||
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); | ||
} | ||
|
||
|
||
// @ts-ignore | ||
private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams { | ||
if (typeof value === "object" && value instanceof Date === false) { | ||
httpParams = this.addToHttpParamsRecursive(httpParams, value); | ||
} else { | ||
httpParams = this.addToHttpParamsRecursive(httpParams, value, key); | ||
} | ||
return httpParams; | ||
} | ||
|
||
private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams { | ||
if (value == null) { | ||
return httpParams; | ||
} | ||
|
||
if (typeof value === "object") { | ||
if (Array.isArray(value)) { | ||
(value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key)); | ||
} else if (value instanceof Date) { | ||
if (key != null) { | ||
httpParams = httpParams.append(key, (value as Date).toISOString().substr(0, 10)); | ||
} else { | ||
throw Error("key may not be null if value is Date"); | ||
} | ||
} else { | ||
Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive( | ||
httpParams, value[k], key != null ? `${key}[${k}]` : k)); | ||
} | ||
} else if (key != null) { | ||
httpParams = httpParams.append(key, value); | ||
} else { | ||
throw Error("key may not be null if value is not object or array"); | ||
} | ||
return httpParams; | ||
} | ||
|
||
/** | ||
* List EDAM concepts | ||
* List EDAM concepts | ||
* @param edamConceptSearchQuery The search query used to find EDAM concepts. | ||
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. | ||
* @param reportProgress flag to report request and response progress. | ||
*/ | ||
public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable<EdamConceptsPage>; | ||
public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable<HttpResponse<EdamConceptsPage>>; | ||
public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable<HttpEvent<EdamConceptsPage>>; | ||
public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable<any> { | ||
|
||
let localVarQueryParameters = new HttpParams({encoder: this.encoder}); | ||
if (edamConceptSearchQuery !== undefined && edamConceptSearchQuery !== null) { | ||
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, | ||
<any>edamConceptSearchQuery, 'edamConceptSearchQuery'); | ||
} | ||
|
||
let localVarHeaders = this.defaultHeaders; | ||
|
||
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; | ||
if (localVarHttpHeaderAcceptSelected === undefined) { | ||
// to determine the Accept header | ||
const httpHeaderAccepts: string[] = [ | ||
'application/json', | ||
'application/problem+json' | ||
]; | ||
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); | ||
} | ||
if (localVarHttpHeaderAcceptSelected !== undefined) { | ||
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); | ||
} | ||
|
||
let localVarHttpContext: HttpContext | undefined = options && options.context; | ||
if (localVarHttpContext === undefined) { | ||
localVarHttpContext = new HttpContext(); | ||
} | ||
|
||
|
||
let responseType_: 'text' | 'json' | 'blob' = 'json'; | ||
if (localVarHttpHeaderAcceptSelected) { | ||
if (localVarHttpHeaderAcceptSelected.startsWith('text')) { | ||
responseType_ = 'text'; | ||
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { | ||
responseType_ = 'json'; | ||
} else { | ||
responseType_ = 'blob'; | ||
} | ||
} | ||
|
||
let localVarPath = `/edamConcepts`; | ||
return this.httpClient.get<EdamConceptsPage>(`${this.configuration.basePath}${localVarPath}`, | ||
{ | ||
context: localVarHttpContext, | ||
params: localVarQueryParameters, | ||
responseType: <any>responseType_, | ||
withCredentials: this.configuration.withCredentials, | ||
headers: localVarHeaders, | ||
observe: observe, | ||
reportProgress: reportProgress | ||
} | ||
); | ||
} | ||
|
||
} |
25 changes: 25 additions & 0 deletions
25
libs/openchallenges/api-client-angular/src/lib/model/edamConcept.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,25 @@ | ||
/** | ||
* OpenChallenges REST API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
/** | ||
* The EDAM concept. | ||
*/ | ||
export interface EdamConcept { | ||
/** | ||
* The unique identifier of the EDAM concept. | ||
*/ | ||
id: number; | ||
classId: string; | ||
preferredLabel: string; | ||
} | ||
|
31 changes: 31 additions & 0 deletions
31
libs/openchallenges/api-client-angular/src/lib/model/edamConceptSearchQuery.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,31 @@ | ||
/** | ||
* OpenChallenges REST API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
/** | ||
* An EDAM concept search query. | ||
*/ | ||
export interface EdamConceptSearchQuery { | ||
/** | ||
* The page number. | ||
*/ | ||
pageNumber?: number; | ||
/** | ||
* The number of items in a single page. | ||
*/ | ||
pageSize?: number; | ||
/** | ||
* A string of search terms used to filter the results. | ||
*/ | ||
searchTerms?: string; | ||
} | ||
|
48 changes: 48 additions & 0 deletions
48
libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPage.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,48 @@ | ||
/** | ||
* OpenChallenges REST API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
import { EdamConcept } from './edamConcept'; | ||
|
||
|
||
/** | ||
* A page of EDAM concepts. | ||
*/ | ||
export interface EdamConceptsPage { | ||
/** | ||
* The page number. | ||
*/ | ||
number: number; | ||
/** | ||
* The number of items in a single page. | ||
*/ | ||
size: number; | ||
/** | ||
* Total number of elements in the result set. | ||
*/ | ||
totalElements: number; | ||
/** | ||
* Total number of pages in the result set. | ||
*/ | ||
totalPages: number; | ||
/** | ||
* Returns if there is a next page. | ||
*/ | ||
hasNext: boolean; | ||
/** | ||
* Returns if there is a previous page. | ||
*/ | ||
hasPrevious: boolean; | ||
/** | ||
* A list of EDAM concepts. | ||
*/ | ||
edamConcepts: Array<EdamConcept>; | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPageAllOf.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,21 @@ | ||
/** | ||
* OpenChallenges REST API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
import { EdamConcept } from './edamConcept'; | ||
|
||
|
||
export interface EdamConceptsPageAllOf { | ||
/** | ||
* A list of EDAM concepts. | ||
*/ | ||
edamConcepts: Array<EdamConcept>; | ||
} | ||
|
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