@agravity/public
Version:
The Agravity GlobalDAM API which allowes API key authenticated access the Agravity GlobalDAM Backend
762 lines (696 loc) • 33.5 kB
text/typescript
/**
* Agravity OpenAPI Documentation - Public Functions
*
* Contact: office@agravity.io
*
* 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 { AgravityErrorResponse } from '../model/agravityErrorResponse.pub.agravity';
// @ts-ignore
import { Asset } from '../model/asset.pub.agravity';
// @ts-ignore
import { AssetPageResult } from '../model/assetPageResult.pub.agravity';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { AgravityPublicConfiguration } from '../configuration';
export interface HttpAssetUploadFileRequestParams {
/** The requested language of the response. If not matching it falls back to default language. */
acceptLanguage?: string;
name?: string;
collectionid?: string;
file?: Blob;
filename?: string;
previewof?: string;
}
export interface HttpAssetsCreateRequestParams {
/** The ID of the collection where this assets should be assigned. */
collectionid: string;
/** This endpoint creates an unique asset ID and adds the information to the database. */
asset: Asset;
/** When default language should be returned and the translation dictionary is delivered. (Ignores the \"Accept-Language\" header) */
translations?: boolean;
/** The requested language of the response. If not matching it falls back to default language. */
acceptLanguage?: string;
}
export interface HttpAssetsGetRequestParams {
/** The ID of the collection where these assets should come from. (Is not required when \'collectiontypeid\' is set.) */
collectionid?: string;
/** The ID of the collection type where these assets should come from. (Is not required when \'collectionid\' is set.) CAUTION: The assets returned are not distinct => Duplicates are possible if assets are in multiple collections in this collection type! */
collectiontypeid?: string;
/** This limits the fields which are returned, separated by comma (\',\'). Blobs can be limited with \'.\' on their container. (i.e. fields=blobs.thumbnails). Only if \'thumbnails\' is set, the placeholder of this asset type are returned if no thumbnail blob is found. */
fields?: string;
/** This indicates if the given blobs should have URLs where these can be requested. (If not limited through \'fields\' parameter it will expose all URLs of all blobs.) */
expose?: boolean;
/** Each result returns the continous token if more results are available than requested. With this token, the next page could be fetched. (URL encoded!) */
continuationToken?: string;
/** This number limits the page result of assets. */
limit?: number;
/** How the return assets are sorted. Default is property: modified_date (newest first). */
orderby?: string;
/** This will limit the output on specific parameters which are separated by \':\', \'!:\', \'>\', \'>=\', \'<\', \'<=\' */
filter?: string;
/** The items can be extended to fully filled items. */
items?: boolean;
/** When default language should be returned and the translation dictionary is delivered. (Ignores the \"Accept-Language\" header) */
translations?: boolean;
/** The requested language of the response. If not matching it falls back to default language. */
acceptLanguage?: string;
}
export interface HttpAssetsGetByIdRequestParams {
/** The ID of the asset. */
id: string;
/** Which fields are need to be filled out with comma separated. If one is set all non mandatory fields are left out. No validation if field exist. */
fields?: string;
/** This indicates if the given blobs should have URLs where these can be requested. It will expose placeholder blobs if no \'thumbnail\' is found. */
expose?: boolean;
/** When default language should be returned and the translation dictionary is delivered. (Ignores the \"Accept-Language\" header) */
translations?: boolean;
/** The requested language of the response. If not matching it falls back to default language. */
acceptLanguage?: string;
}
export interface HttpPublicAssetsUpdateByIdRequestParams {
/** The ID of the asset. */
id: string;
/** The body has to contain one of the mentioned elements and a valid json. Not fitting properties are ignored. */
asset: Asset;
/** When default language should be returned and the translation dictionary is delivered. (Ignores the \"Accept-Language\" header) */
translations?: boolean;
/** The requested language of the response. If not matching it falls back to default language. */
acceptLanguage?: string;
}
export class PublicAssetManagementService {
protected basePath = 'http://localhost:7072/api';
public defaultHeaders = new HttpHeaders();
public configuration = new AgravityPublicConfiguration();
public encoder: HttpParameterCodec;
constructor(
protected httpClient: HttpClient,
basePath: string | string[],
configuration: AgravityPublicConfiguration
) {
if (configuration) {
this.configuration = configuration;
}
if (typeof this.configuration.basePath !== 'string') {
const firstBasePath = Array.isArray(basePath) ? basePath[0] : undefined;
if (firstBasePath != undefined) {
basePath = firstBasePath;
}
if (typeof basePath !== 'string') {
basePath = this.basePath;
}
this.configuration.basePath = basePath;
}
this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
// @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().substring(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;
}
/**
* @param requestParameters
* @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 httpAssetUploadFile(
requestParameters?: HttpAssetUploadFileRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<Asset>;
public httpAssetUploadFile(
requestParameters?: HttpAssetUploadFileRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<Asset>>;
public httpAssetUploadFile(
requestParameters?: HttpAssetUploadFileRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<Asset>>;
public httpAssetUploadFile(
requestParameters?: HttpAssetUploadFileRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const acceptLanguage = requestParameters?.acceptLanguage;
const name = requestParameters?.name;
const collectionid = requestParameters?.collectionid;
const file = requestParameters?.file;
const filename = requestParameters?.filename;
const previewof = requestParameters?.previewof;
let localVarHeaders = this.defaultHeaders;
if (acceptLanguage !== undefined && acceptLanguage !== null) {
localVarHeaders = localVarHeaders.set('Accept-Language', String(acceptLanguage));
}
let localVarCredential: string | undefined;
// authentication (function_key) required
localVarCredential = this.configuration.lookupCredential('function_key');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('x-functions-key', localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/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 localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = true;
}
// to determine the Content-Type header
const consumes: string[] = ['multipart/form-data'];
const canConsumeForm = this.canConsumeForm(consumes);
let localVarFormParams: { append(param: string, value: any): any };
let localVarUseForm = false;
let localVarConvertFormParamsToString = false;
// use FormData to transmit files using content-type "multipart/form-data"
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
localVarUseForm = canConsumeForm;
if (localVarUseForm) {
localVarFormParams = new FormData();
} else {
localVarFormParams = new HttpParams({ encoder: this.encoder });
}
if (name !== undefined) {
localVarFormParams = (localVarFormParams.append('name', <any>name) as any) || localVarFormParams;
}
if (collectionid !== undefined) {
localVarFormParams = (localVarFormParams.append('collectionid', <any>collectionid) as any) || localVarFormParams;
}
if (file !== undefined) {
localVarFormParams = (localVarFormParams.append('file', <any>file) as any) || localVarFormParams;
}
if (filename !== undefined) {
localVarFormParams = (localVarFormParams.append('filename', <any>filename) as any) || localVarFormParams;
}
if (previewof !== undefined) {
localVarFormParams = (localVarFormParams.append('previewof', <any>previewof) as any) || localVarFormParams;
}
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 = `/assetsupload`;
return this.httpClient.request<Asset>('post', `${this.configuration.basePath}${localVarPath}`, {
context: localVarHttpContext,
body: localVarConvertFormParamsToString ? localVarFormParams.toString() : localVarFormParams,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
/**
* This endpoint creates one asset entry in the database.
* @param requestParameters
* @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 httpAssetsCreate(
requestParameters?: HttpAssetsCreateRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<Asset>;
public httpAssetsCreate(
requestParameters?: HttpAssetsCreateRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<Asset>>;
public httpAssetsCreate(
requestParameters?: HttpAssetsCreateRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<Asset>>;
public httpAssetsCreate(
requestParameters?: HttpAssetsCreateRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const collectionid = requestParameters?.collectionid;
if (collectionid === null || collectionid === undefined) {
throw new Error('Required parameter collectionid was null or undefined when calling httpAssetsCreate.');
}
const asset = requestParameters?.asset;
if (asset === null || asset === undefined) {
throw new Error('Required parameter asset was null or undefined when calling httpAssetsCreate.');
}
const translations = requestParameters?.translations;
const acceptLanguage = requestParameters?.acceptLanguage;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (collectionid !== undefined && collectionid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectionid, 'collectionid');
}
if (translations !== undefined && translations !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>translations, 'translations');
}
let localVarHeaders = this.defaultHeaders;
if (acceptLanguage !== undefined && acceptLanguage !== null) {
localVarHeaders = localVarHeaders.set('Accept-Language', String(acceptLanguage));
}
let localVarCredential: string | undefined;
// authentication (function_key) required
localVarCredential = this.configuration.lookupCredential('function_key');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('x-functions-key', localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/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 localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = 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 = `/assets`;
return this.httpClient.request<Asset>('post', `${this.configuration.basePath}${localVarPath}`, {
context: localVarHttpContext,
body: asset,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
/**
* This endpoint lists all the assets, which are stored in the database and not deleted (status \"A\")
* @param requestParameters
* @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 httpAssetsGet(
requestParameters?: HttpAssetsGetRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<AssetPageResult>;
public httpAssetsGet(
requestParameters?: HttpAssetsGetRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<AssetPageResult>>;
public httpAssetsGet(
requestParameters?: HttpAssetsGetRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<AssetPageResult>>;
public httpAssetsGet(
requestParameters?: HttpAssetsGetRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const collectionid = requestParameters?.collectionid;
const collectiontypeid = requestParameters?.collectiontypeid;
const fields = requestParameters?.fields;
const expose = requestParameters?.expose;
const continuationToken = requestParameters?.continuationToken;
const limit = requestParameters?.limit;
const orderby = requestParameters?.orderby;
const filter = requestParameters?.filter;
const items = requestParameters?.items;
const translations = requestParameters?.translations;
const acceptLanguage = requestParameters?.acceptLanguage;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (collectionid !== undefined && collectionid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectionid, 'collectionid');
}
if (collectiontypeid !== undefined && collectiontypeid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectiontypeid, 'collectiontypeid');
}
if (fields !== undefined && fields !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>fields, 'fields');
}
if (expose !== undefined && expose !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>expose, 'expose');
}
if (continuationToken !== undefined && continuationToken !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>continuationToken, 'continuation_token');
}
if (limit !== undefined && limit !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>limit, 'limit');
}
if (orderby !== undefined && orderby !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>orderby, 'orderby');
}
if (filter !== undefined && filter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>filter, 'filter');
}
if (items !== undefined && items !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>items, 'items');
}
if (translations !== undefined && translations !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>translations, 'translations');
}
let localVarHeaders = this.defaultHeaders;
if (acceptLanguage !== undefined && acceptLanguage !== null) {
localVarHeaders = localVarHeaders.set('Accept-Language', String(acceptLanguage));
}
let localVarCredential: string | undefined;
// authentication (function_key) required
localVarCredential = this.configuration.lookupCredential('function_key');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('x-functions-key', localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/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 localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = 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 = `/assets`;
return this.httpClient.request<AssetPageResult>('get', `${this.configuration.basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
/**
* This endpoint returns one single asset (from ID). If the returned asset is from a special asset type (e.g. \"AssetImage\") it returns the full entity.
* @param requestParameters
* @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 httpAssetsGetById(
requestParameters?: HttpAssetsGetByIdRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<Asset>;
public httpAssetsGetById(
requestParameters?: HttpAssetsGetByIdRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<Asset>>;
public httpAssetsGetById(
requestParameters?: HttpAssetsGetByIdRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<Asset>>;
public httpAssetsGetById(
requestParameters?: HttpAssetsGetByIdRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const id = requestParameters?.id;
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling httpAssetsGetById.');
}
const fields = requestParameters?.fields;
const expose = requestParameters?.expose;
const translations = requestParameters?.translations;
const acceptLanguage = requestParameters?.acceptLanguage;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (fields !== undefined && fields !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>fields, 'fields');
}
if (expose !== undefined && expose !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>expose, 'expose');
}
if (translations !== undefined && translations !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>translations, 'translations');
}
let localVarHeaders = this.defaultHeaders;
if (acceptLanguage !== undefined && acceptLanguage !== null) {
localVarHeaders = localVarHeaders.set('Accept-Language', String(acceptLanguage));
}
let localVarCredential: string | undefined;
// authentication (function_key) required
localVarCredential = this.configuration.lookupCredential('function_key');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('x-functions-key', localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/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 localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = 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 = `/assets/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
return this.httpClient.request<Asset>('get', `${this.configuration.basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
/**
* This endpoint updates one single asset (from ID)
* @param requestParameters
* @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 httpPublicAssetsUpdateById(
requestParameters?: HttpPublicAssetsUpdateByIdRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<Asset>;
public httpPublicAssetsUpdateById(
requestParameters?: HttpPublicAssetsUpdateByIdRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<Asset>>;
public httpPublicAssetsUpdateById(
requestParameters?: HttpPublicAssetsUpdateByIdRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<Asset>>;
public httpPublicAssetsUpdateById(
requestParameters?: HttpPublicAssetsUpdateByIdRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const id = requestParameters?.id;
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling httpPublicAssetsUpdateById.');
}
const asset = requestParameters?.asset;
if (asset === null || asset === undefined) {
throw new Error('Required parameter asset was null or undefined when calling httpPublicAssetsUpdateById.');
}
const translations = requestParameters?.translations;
const acceptLanguage = requestParameters?.acceptLanguage;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (translations !== undefined && translations !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>translations, 'translations');
}
let localVarHeaders = this.defaultHeaders;
if (acceptLanguage !== undefined && acceptLanguage !== null) {
localVarHeaders = localVarHeaders.set('Accept-Language', String(acceptLanguage));
}
let localVarCredential: string | undefined;
// authentication (function_key) required
localVarCredential = this.configuration.lookupCredential('function_key');
if (localVarCredential) {
localVarHeaders = localVarHeaders.set('x-functions-key', localVarCredential);
}
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = ['application/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 localVarTransferCache: boolean | undefined = options && options.transferCache;
if (localVarTransferCache === undefined) {
localVarTransferCache = 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 = `/assets/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
return this.httpClient.request<Asset>('post', `${this.configuration.basePath}${localVarPath}`, {
context: localVarHttpContext,
body: asset,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
}