377 lines
11 KiB
TypeScript
377 lines
11 KiB
TypeScript
/**
|
|
* Innovation Search Engine API
|
|
*
|
|
*
|
|
*
|
|
* 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 { AutocompleteResponse } from '../model/autocomplete-response';
|
|
// @ts-ignore
|
|
import { HTTPValidationError } from '../model/http-validation-error';
|
|
// @ts-ignore
|
|
import { InstitutionsListResponse } from '../model/institutions-list-response';
|
|
|
|
// @ts-ignore
|
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
import { Configuration } from '../configuration';
|
|
import { BaseService } from '../api.base.service';
|
|
import { InstitutionsServiceInterface } from './institutions.serviceInterface';
|
|
|
|
@Injectable({
|
|
providedIn: 'root',
|
|
})
|
|
export class InstitutionsService
|
|
extends BaseService
|
|
implements InstitutionsServiceInterface
|
|
{
|
|
constructor(
|
|
protected httpClient: HttpClient,
|
|
@Optional() @Inject(BASE_PATH) basePath: string | string[],
|
|
@Optional() configuration?: Configuration,
|
|
) {
|
|
super(basePath, configuration);
|
|
}
|
|
|
|
/**
|
|
* Returns institution options for autocomplete inputs.
|
|
* @endpoint get /api/institutions/autocomplete
|
|
* @param query Institution search text, for example \'Duisburg Essen\'.
|
|
* @param countryCode Optional ISO country code filter.
|
|
* @param type Optional institution type filter.
|
|
* @param limit Maximum number of autocomplete options.
|
|
* @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 autocompleteInstitutions(
|
|
query: string,
|
|
countryCode?: string,
|
|
type?: string,
|
|
limit?: number,
|
|
observe?: 'body',
|
|
reportProgress?: boolean,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<AutocompleteResponse>;
|
|
public autocompleteInstitutions(
|
|
query: string,
|
|
countryCode?: string,
|
|
type?: string,
|
|
limit?: number,
|
|
observe?: 'response',
|
|
reportProgress?: boolean,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<HttpResponse<AutocompleteResponse>>;
|
|
public autocompleteInstitutions(
|
|
query: string,
|
|
countryCode?: string,
|
|
type?: string,
|
|
limit?: number,
|
|
observe?: 'events',
|
|
reportProgress?: boolean,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<HttpEvent<AutocompleteResponse>>;
|
|
public autocompleteInstitutions(
|
|
query: string,
|
|
countryCode?: string,
|
|
type?: string,
|
|
limit?: number,
|
|
observe: any = 'body',
|
|
reportProgress: boolean = false,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<any> {
|
|
if (query === null || query === undefined) {
|
|
throw new Error(
|
|
'Required parameter query was null or undefined when calling autocompleteInstitutions.',
|
|
);
|
|
}
|
|
|
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>query,
|
|
'query',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>countryCode,
|
|
'countryCode',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>type,
|
|
'type',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>limit,
|
|
'limit',
|
|
);
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
options?.httpHeaderAccept ??
|
|
this.configuration.selectHeaderAccept(['application/json']);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set(
|
|
'Accept',
|
|
localVarHttpHeaderAcceptSelected,
|
|
);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext =
|
|
options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
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 = `/api/institutions/autocomplete`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<AutocompleteResponse>(
|
|
'get',
|
|
`${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
params: localVarQueryParameters,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined
|
|
? { transferCache: localVarTransferCache }
|
|
: {}),
|
|
reportProgress: reportProgress,
|
|
},
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns a list of OpenAlex institutions.
|
|
* @endpoint get /api/institutions
|
|
* @param search Full-text search, for example \'Duisburg Essen\'.
|
|
* @param filter OpenAlex filter, for example \'country_code:DE,type:education\'.
|
|
* @param sort Sort field, for example \'works_count:desc\'.
|
|
* @param groupBy OpenAlex group_by field, for example \'country_code\'.
|
|
* @param perPage Results per page.
|
|
* @param page Page number. Use cursor for deep pagination.
|
|
* @param cursor Cursor pagination token. Use \'*\' to start.
|
|
* @param sample Random sample size. Cannot be combined with sort or page.
|
|
* @param select Comma-separated fields to return.
|
|
* @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 listInstitutions(
|
|
search?: string,
|
|
filter?: string,
|
|
sort?: string,
|
|
groupBy?: string,
|
|
perPage?: number,
|
|
page?: number,
|
|
cursor?: string,
|
|
sample?: number,
|
|
select?: string,
|
|
observe?: 'body',
|
|
reportProgress?: boolean,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<InstitutionsListResponse>;
|
|
public listInstitutions(
|
|
search?: string,
|
|
filter?: string,
|
|
sort?: string,
|
|
groupBy?: string,
|
|
perPage?: number,
|
|
page?: number,
|
|
cursor?: string,
|
|
sample?: number,
|
|
select?: string,
|
|
observe?: 'response',
|
|
reportProgress?: boolean,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<HttpResponse<InstitutionsListResponse>>;
|
|
public listInstitutions(
|
|
search?: string,
|
|
filter?: string,
|
|
sort?: string,
|
|
groupBy?: string,
|
|
perPage?: number,
|
|
page?: number,
|
|
cursor?: string,
|
|
sample?: number,
|
|
select?: string,
|
|
observe?: 'events',
|
|
reportProgress?: boolean,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<HttpEvent<InstitutionsListResponse>>;
|
|
public listInstitutions(
|
|
search?: string,
|
|
filter?: string,
|
|
sort?: string,
|
|
groupBy?: string,
|
|
perPage?: number,
|
|
page?: number,
|
|
cursor?: string,
|
|
sample?: number,
|
|
select?: string,
|
|
observe: any = 'body',
|
|
reportProgress: boolean = false,
|
|
options?: {
|
|
httpHeaderAccept?: 'application/json';
|
|
context?: HttpContext;
|
|
transferCache?: boolean;
|
|
},
|
|
): Observable<any> {
|
|
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>search,
|
|
'search',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>filter,
|
|
'filter',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>sort,
|
|
'sort',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>groupBy,
|
|
'group_by',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>perPage,
|
|
'per_page',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>page,
|
|
'page',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>cursor,
|
|
'cursor',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>sample,
|
|
'sample',
|
|
);
|
|
localVarQueryParameters = this.addToHttpParams(
|
|
localVarQueryParameters,
|
|
<any>select,
|
|
'select',
|
|
);
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
const localVarHttpHeaderAcceptSelected: string | undefined =
|
|
options?.httpHeaderAccept ??
|
|
this.configuration.selectHeaderAccept(['application/json']);
|
|
if (localVarHttpHeaderAcceptSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set(
|
|
'Accept',
|
|
localVarHttpHeaderAcceptSelected,
|
|
);
|
|
}
|
|
|
|
const localVarHttpContext: HttpContext =
|
|
options?.context ?? new HttpContext();
|
|
|
|
const localVarTransferCache: boolean = options?.transferCache ?? true;
|
|
|
|
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 = `/api/institutions`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<InstitutionsListResponse>(
|
|
'get',
|
|
`${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
params: localVarQueryParameters,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined
|
|
? { transferCache: localVarTransferCache }
|
|
: {}),
|
|
reportProgress: reportProgress,
|
|
},
|
|
);
|
|
}
|
|
}
|