Skip to content

Commit

Permalink
regenerate the OC API client for Angular
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaffter committed Apr 9, 2024
1 parent 7317fd4 commit f77550d
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ api/challenge.service.ts
api/challengeAnalytics.service.ts
api/challengeContribution.service.ts
api/challengePlatform.service.ts
api/edamConcept.service.ts
api/image.service.ts
api/organization.service.ts
api/user.service.ts
Expand Down Expand Up @@ -35,6 +36,10 @@ model/challengeSubmissionType.ts
model/challengesPage.ts
model/challengesPageAllOf.ts
model/challengesPerYear.ts
model/edamConcept.ts
model/edamConceptSearchQuery.ts
model/edamConceptsPage.ts
model/edamConceptsPageAllOf.ts
model/edamData.ts
model/edamOperation.ts
model/image.ts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ChallengeService } from './api/challenge.service';
import { ChallengeAnalyticsService } from './api/challengeAnalytics.service';
import { ChallengeContributionService } from './api/challengeContribution.service';
import { ChallengePlatformService } from './api/challengePlatform.service';
import { EdamConceptService } from './api/edamConcept.service';
import { ImageService } from './api/image.service';
import { OrganizationService } from './api/organization.service';
import { UserService } from './api/user.service';
Expand Down
4 changes: 3 additions & 1 deletion libs/openchallenges/api-client-angular/src/lib/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ export * from './challengeContribution.service';
import { ChallengeContributionService } from './challengeContribution.service';
export * from './challengePlatform.service';
import { ChallengePlatformService } from './challengePlatform.service';
export * from './edamConcept.service';
import { EdamConceptService } from './edamConcept.service';
export * from './image.service';
import { ImageService } from './image.service';
export * from './organization.service';
import { OrganizationService } from './organization.service';
export * from './user.service';
import { UserService } from './user.service';
export const APIS = [ChallengeService, ChallengeAnalyticsService, ChallengeContributionService, ChallengePlatformService, ImageService, OrganizationService, UserService];
export const APIS = [ChallengeService, ChallengeAnalyticsService, ChallengeContributionService, ChallengePlatformService, EdamConceptService, ImageService, OrganizationService, UserService];
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
}
);
}

}
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;
}

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;
}

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>;
}

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>;
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export * from './challengeSubmissionType';
export * from './challengesPage';
export * from './challengesPageAllOf';
export * from './challengesPerYear';
export * from './edamConcept';
export * from './edamConceptSearchQuery';
export * from './edamConceptsPage';
export * from './edamConceptsPageAllOf';
export * from './edamData';
export * from './edamOperation';
export * from './image';
Expand Down

0 comments on commit f77550d

Please sign in to comment.