364 lines
19 KiB
TypeScript
364 lines
19 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 { HTTPValidationError } from '../model/hTTPValidationError';
|
|
// @ts-ignore
|
|
import { Item } from '../model/item';
|
|
// @ts-ignore
|
|
import { ItemCreate } from '../model/itemCreate';
|
|
// @ts-ignore
|
|
import { ItemPage } from '../model/itemPage';
|
|
|
|
// @ts-ignore
|
|
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|
import { Configuration } from '../configuration';
|
|
import { BaseService } from '../api.base.service';
|
|
|
|
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class ItemsService extends BaseService {
|
|
|
|
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
|
|
super(basePath, configuration);
|
|
}
|
|
|
|
/**
|
|
* Adds a new item.
|
|
* @endpoint post /api/inse-service/items
|
|
* @param itemCreate
|
|
* @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 addItem(itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
|
public addItem(itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
|
public addItem(itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
|
public addItem(itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (itemCreate === null || itemCreate === undefined) {
|
|
throw new Error('Required parameter itemCreate was null or undefined when calling addItem.');
|
|
}
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
// authentication (bearer) required
|
|
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
|
|
|
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;
|
|
|
|
|
|
// to determine the Content-Type header
|
|
const consumes: string[] = [
|
|
'application/json'
|
|
];
|
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
if (httpContentTypeSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
}
|
|
|
|
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/inse-service/items`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<Item>('post', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
body: itemCreate,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Deletes the item with the id.
|
|
* @endpoint delete /api/inse-service/items/{id}
|
|
* @param id The item id.
|
|
* @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 deleteItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any>;
|
|
public deleteItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<any>>;
|
|
public deleteItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<any>>;
|
|
public deleteItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (id === null || id === undefined) {
|
|
throw new Error('Required parameter id was null or undefined when calling deleteItem.');
|
|
}
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
// authentication (bearer) required
|
|
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
|
|
|
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/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<any>('delete', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns the item with the id.
|
|
* @endpoint get /api/inse-service/items/{id}
|
|
* @param id The item id.
|
|
* @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 getItem(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
|
public getItem(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
|
public getItem(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
|
public getItem(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (id === null || id === undefined) {
|
|
throw new Error('Required parameter id was null or undefined when calling getItem.');
|
|
}
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
// authentication (bearer) required
|
|
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
|
|
|
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/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<Item>('get', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Returns a page of items.
|
|
* @endpoint get /api/inse-service/items
|
|
* @param pageOffset The page offset.
|
|
* @param pageSize The page size.
|
|
* @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 getItems(pageOffset?: number, pageSize?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<ItemPage>;
|
|
public getItems(pageOffset?: number, pageSize?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<ItemPage>>;
|
|
public getItems(pageOffset?: number, pageSize?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<ItemPage>>;
|
|
public getItems(pageOffset?: number, pageSize?: number, 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>pageOffset, 'pageOffset');
|
|
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
|
|
<any>pageSize, 'pageSize');
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
// authentication (bearer) required
|
|
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
|
|
|
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/inse-service/items`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<ItemPage>('get', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
params: localVarQueryParameters,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Updates the item with the id.
|
|
* @endpoint put /api/inse-service/items/{id}
|
|
* @param id The item id.
|
|
* @param itemCreate
|
|
* @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 updateItem(id: number, itemCreate: ItemCreate, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<Item>;
|
|
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<Item>>;
|
|
public updateItem(id: number, itemCreate: ItemCreate, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<Item>>;
|
|
public updateItem(id: number, itemCreate: ItemCreate, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
|
|
if (id === null || id === undefined) {
|
|
throw new Error('Required parameter id was null or undefined when calling updateItem.');
|
|
}
|
|
if (itemCreate === null || itemCreate === undefined) {
|
|
throw new Error('Required parameter itemCreate was null or undefined when calling updateItem.');
|
|
}
|
|
|
|
let localVarHeaders = this.defaultHeaders;
|
|
|
|
// authentication (bearer) required
|
|
localVarHeaders = this.configuration.addCredentialToHeaders('bearer', 'Authorization', localVarHeaders, 'Bearer ');
|
|
|
|
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;
|
|
|
|
|
|
// to determine the Content-Type header
|
|
const consumes: string[] = [
|
|
'application/json'
|
|
];
|
|
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|
if (httpContentTypeSelected !== undefined) {
|
|
localVarHeaders = localVarHeaders.set('Content-Type', httpContentTypeSelected);
|
|
}
|
|
|
|
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/inse-service/items/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`;
|
|
const { basePath, withCredentials } = this.configuration;
|
|
return this.httpClient.request<Item>('put', `${basePath}${localVarPath}`,
|
|
{
|
|
context: localVarHttpContext,
|
|
body: itemCreate,
|
|
responseType: <any>responseType_,
|
|
...(withCredentials ? { withCredentials } : {}),
|
|
headers: localVarHeaders,
|
|
observe: observe,
|
|
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
|
|
reportProgress: reportProgress
|
|
}
|
|
);
|
|
}
|
|
|
|
}
|