diff --git a/libs/openchallenges/api-client-angular/src/lib/.openapi-generator/FILES b/libs/openchallenges/api-client-angular/src/lib/.openapi-generator/FILES index 2c2e40a414..283efffcd3 100644 --- a/libs/openchallenges/api-client-angular/src/lib/.openapi-generator/FILES +++ b/libs/openchallenges/api-client-angular/src/lib/.openapi-generator/FILES @@ -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 @@ -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 diff --git a/libs/openchallenges/api-client-angular/src/lib/api.module.ts b/libs/openchallenges/api-client-angular/src/lib/api.module.ts index 7b4c2d6a93..cca2a77af2 100644 --- a/libs/openchallenges/api-client-angular/src/lib/api.module.ts +++ b/libs/openchallenges/api-client-angular/src/lib/api.module.ts @@ -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'; diff --git a/libs/openchallenges/api-client-angular/src/lib/api/api.ts b/libs/openchallenges/api-client-angular/src/lib/api/api.ts index ccba8f6bf6..13571d0efc 100644 --- a/libs/openchallenges/api-client-angular/src/lib/api/api.ts +++ b/libs/openchallenges/api-client-angular/src/lib/api/api.ts @@ -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]; diff --git a/libs/openchallenges/api-client-angular/src/lib/api/edamConcept.service.ts b/libs/openchallenges/api-client-angular/src/lib/api/edamConcept.service.ts new file mode 100644 index 0000000000..8c8eecdf76 --- /dev/null +++ b/libs/openchallenges/api-client-angular/src/lib/api/edamConcept.service.ts @@ -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; + public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable>; + public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable>; + public listEdamConcepts(edamConceptSearchQuery?: EdamConceptSearchQuery, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json', context?: HttpContext}): Observable { + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (edamConceptSearchQuery !== undefined && edamConceptSearchQuery !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + 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(`${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + reportProgress: reportProgress + } + ); + } + +} diff --git a/libs/openchallenges/api-client-angular/src/lib/model/edamConcept.ts b/libs/openchallenges/api-client-angular/src/lib/model/edamConcept.ts new file mode 100644 index 0000000000..fd776bccf0 --- /dev/null +++ b/libs/openchallenges/api-client-angular/src/lib/model/edamConcept.ts @@ -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; +} + diff --git a/libs/openchallenges/api-client-angular/src/lib/model/edamConceptSearchQuery.ts b/libs/openchallenges/api-client-angular/src/lib/model/edamConceptSearchQuery.ts new file mode 100644 index 0000000000..d62ec1f9ad --- /dev/null +++ b/libs/openchallenges/api-client-angular/src/lib/model/edamConceptSearchQuery.ts @@ -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; +} + diff --git a/libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPage.ts b/libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPage.ts new file mode 100644 index 0000000000..44a9bf3d8b --- /dev/null +++ b/libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPage.ts @@ -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; +} + diff --git a/libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPageAllOf.ts b/libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPageAllOf.ts new file mode 100644 index 0000000000..095c1f4c58 --- /dev/null +++ b/libs/openchallenges/api-client-angular/src/lib/model/edamConceptsPageAllOf.ts @@ -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; +} + diff --git a/libs/openchallenges/api-client-angular/src/lib/model/models.ts b/libs/openchallenges/api-client-angular/src/lib/model/models.ts index 9e8ff3a35d..4351c231ed 100644 --- a/libs/openchallenges/api-client-angular/src/lib/model/models.ts +++ b/libs/openchallenges/api-client-angular/src/lib/model/models.ts @@ -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';