@agravity/public
Version:
The Agravity GlobalDAM API which allowes API key authenticated access the Agravity GlobalDAM Backend
305 lines (269 loc) • 14.5 kB
text/typescript
/**
* Agravity OpenAPI Documentation - Public Functions
*
* Contact: support@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, HttpContext } from '@angular/common/http';
import { Observable } from 'rxjs';
import { OpenApiHttpParams, QueryParamStyle } from '../query.params';
// @ts-ignore
import { AgravityErrorResponse } from '../model/agravityErrorResponse.pub.agravity';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { AgravityPublicConfiguration } from '../configuration';
import { BaseService } from '../api.base.service';
export interface HttpTranslationsByIdRequestParams {
/** The ID of any translateable entity (Asset, Collection, Collection Type, Download Format). */
id: string;
/** If the items should be included (only for entity type Collection and Asset). */
items?: boolean;
}
export interface HttpTranslationsByIdFilterByCustomFieldRequestParams {
/** The ID of only translateable entities with custom fields (Asset, Collection). */
id: string;
/** Limit the output to a specific custom field key. */
customField: string;
}
export interface HttpTranslationsByIdFilterByPropertyRequestParams {
/** The ID of any translateable entity (Asset, Collection, Collection Type, Download Format). */
id: string;
/** Limit to one specific property (key) */
property: string;
/** If the items should be included (only for entity type Collection and Asset). */
items?: boolean;
}
@Injectable({
providedIn: 'root'
})
export class PublicTranslationManagementService extends BaseService {
constructor(
protected httpClient: HttpClient,
@Optional() @Inject(BASE_PATH) basePath: string | string[],
@Optional() configuration?: AgravityPublicConfiguration
) {
super(basePath, configuration);
}
/**
* Get all the translations of a whole entity (Asset, Collection, Collection Type, Download Format)
* @endpoint get /translations/{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.
* @param options additional options
*/
public httpTranslationsById(
requestParameters: HttpTranslationsByIdRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<{ [key: string]: { [key: string]: any } }>;
public httpTranslationsById(
requestParameters: HttpTranslationsByIdRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<{ [key: string]: { [key: string]: any } }>>;
public httpTranslationsById(
requestParameters: HttpTranslationsByIdRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<{ [key: string]: { [key: string]: any } }>>;
public httpTranslationsById(
requestParameters: HttpTranslationsByIdRequestParams,
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 httpTranslationsById.');
}
const items = requestParameters?.items;
let localVarQueryParameters = new OpenApiHttpParams(this.encoder);
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'items', <any>items, QueryParamStyle.Form, true);
let localVarHeaders = this.defaultHeaders;
// authentication (function_key) required
localVarHeaders = this.configuration.addCredentialToHeaders('function_key', 'x-functions-key', localVarHeaders);
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 = `/translations/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<{ [key: string]: { [key: string]: any } }>('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters.toHttpParams(),
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
});
}
/**
* Get the translation of custom field on the entity (Asset, Collection)
* @endpoint get /translations/{id}/custom/{customField}
* @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.
* @param options additional options
*/
public httpTranslationsByIdFilterByCustomField(
requestParameters: HttpTranslationsByIdFilterByCustomFieldRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<{ [key: string]: { [key: string]: any } }>;
public httpTranslationsByIdFilterByCustomField(
requestParameters: HttpTranslationsByIdFilterByCustomFieldRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<{ [key: string]: { [key: string]: any } }>>;
public httpTranslationsByIdFilterByCustomField(
requestParameters: HttpTranslationsByIdFilterByCustomFieldRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<{ [key: string]: { [key: string]: any } }>>;
public httpTranslationsByIdFilterByCustomField(
requestParameters: HttpTranslationsByIdFilterByCustomFieldRequestParams,
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 httpTranslationsByIdFilterByCustomField.');
}
const customField = requestParameters?.customField;
if (customField === null || customField === undefined) {
throw new Error('Required parameter customField was null or undefined when calling httpTranslationsByIdFilterByCustomField.');
}
let localVarHeaders = this.defaultHeaders;
// authentication (function_key) required
localVarHeaders = this.configuration.addCredentialToHeaders('function_key', 'x-functions-key', localVarHeaders);
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 = `/translations/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/custom/${this.configuration.encodeParam({ name: 'customField', value: customField, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<{ [key: string]: { [key: string]: any } }>('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
});
}
/**
* Get the translations of a specific field on the entity (Asset, Collection, Collection Type, Download Format)
* @endpoint get /translations/{id}/{property}
* @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.
* @param options additional options
*/
public httpTranslationsByIdFilterByProperty(
requestParameters: HttpTranslationsByIdFilterByPropertyRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<{ [key: string]: { [key: string]: any } }>;
public httpTranslationsByIdFilterByProperty(
requestParameters: HttpTranslationsByIdFilterByPropertyRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<{ [key: string]: { [key: string]: any } }>>;
public httpTranslationsByIdFilterByProperty(
requestParameters: HttpTranslationsByIdFilterByPropertyRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<{ [key: string]: { [key: string]: any } }>>;
public httpTranslationsByIdFilterByProperty(
requestParameters: HttpTranslationsByIdFilterByPropertyRequestParams,
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 httpTranslationsByIdFilterByProperty.');
}
const property = requestParameters?.property;
if (property === null || property === undefined) {
throw new Error('Required parameter property was null or undefined when calling httpTranslationsByIdFilterByProperty.');
}
const items = requestParameters?.items;
let localVarQueryParameters = new OpenApiHttpParams(this.encoder);
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'items', <any>items, QueryParamStyle.Form, true);
let localVarHeaders = this.defaultHeaders;
// authentication (function_key) required
localVarHeaders = this.configuration.addCredentialToHeaders('function_key', 'x-functions-key', localVarHeaders);
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 = `/translations/${this.configuration.encodeParam({ name: 'id', value: id, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/${this.configuration.encodeParam({ name: 'property', value: property, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<{ [key: string]: { [key: string]: any } }>('get', `${basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters.toHttpParams(),
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
});
}
}