@agravity/public
Version:
The Agravity GlobalDAM API which allowes API key authenticated access the Agravity GlobalDAM Backend
516 lines (476 loc) • 22.9 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 { SearchAdminStatus } from '../model/searchAdminStatus.pub.agravity';
// @ts-ignore
import { SearchFacet } from '../model/searchFacet.pub.agravity';
// @ts-ignore
import { SearchResult } from '../model/searchResult.pub.agravity';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { AgravityPublicConfiguration } from '../configuration';
export interface HttpGetSearchFacetteByNameRequestParams {
/** The name of the facette. */
name: string;
/** The search string which should be found. */
s: string;
/** Limits the result on all collections from the given collectiontypeid parameter. */
collectiontypeid?: string;
/** Limits the result on collection id (and siblings). Will be overwritten by collectiontypeid parameter. */
collectionid?: string;
/** Two modes supported: \"any\" or \"all\" search terms should be applied. (Only if Azure Search is enabled) */
mode?: string;
/** Key value filter for filterable strings and string collections separated by special \',,,\'. For date or numbers \"<\", \"=\" and \">\" are possible. Mode influences AND (all) and OR (any) of all filters. Multiple filters are separated by semicolons. (Only if Azure Search is enabled) */
filter?: string;
/** Colon separated key value filter for additional scopes. It applies the same conventions as for filter parameter. */
scopefilter?: string;
/** Comma separated values list with all ids which should be returned. */
ids?: string;
/** If the search should be redirected to a specific portal. */
portalId?: string;
}
export interface HttpGlobalSearchRequestParams {
/** The search string which should be found. */
s: string;
/** How many results should be returend. 0 is backend configuration limit. */
limit?: number;
/** (default: 0) - Used for paging - how many items should be skipped before next limit results will be fetched. */
skip?: number;
/** Limits the result on all collections from the given collectiontypeid parameter. */
collectiontypeid?: string;
/** Limits the result on collection id (and siblings). Will be overwritten by collectiontypeid parameter. */
collectionid?: string;
/** Two modes supported: \"any\" or \"all\" search terms should be applied. (Only if Azure Search is enabled) */
mode?: string;
/** This will expose the thumbnail asset blob incl. URL with SAS Token. */
expose?: boolean;
/** Colon separated key value filter for filterable strings and string collections. For date or numbers \"<\", \"=\" and \">\" are possible. Mode influences AND (all) and OR (any) of all filters. Multiple filters are separated by semicolons. (Only if Azure Search is enabled) */
filter?: string;
/** Colon separated key value filter for additional scopes. It applies the same conventions as for filter parameter. */
scopefilter?: string;
/** Sortable fields can be used. For descendant sorting use leading \"!\". (Only if Azure Search is enabled) */
orderby?: string;
/** Comma separated values list with all ids which should be returned. */
ids?: string;
/** If the search should be redirected to a specific portal. */
portalId?: string;
/** 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 HttpSearchAdminGetStatusRequestParams {
/** If the search should be redirected to a specific portal. */
portalId?: string;
}
export class PublicSearchManagementService {
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();
}
// @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;
}
/**
* This endpoint returns one facette based on the search parameters.
* @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 httpGetSearchFacetteByName(
requestParameters?: HttpGetSearchFacetteByNameRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<SearchFacet>;
public httpGetSearchFacetteByName(
requestParameters?: HttpGetSearchFacetteByNameRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<SearchFacet>>;
public httpGetSearchFacetteByName(
requestParameters?: HttpGetSearchFacetteByNameRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<SearchFacet>>;
public httpGetSearchFacetteByName(
requestParameters?: HttpGetSearchFacetteByNameRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const name = requestParameters?.name;
if (name === null || name === undefined) {
throw new Error('Required parameter name was null or undefined when calling httpGetSearchFacetteByName.');
}
const s = requestParameters?.s;
if (s === null || s === undefined) {
throw new Error('Required parameter s was null or undefined when calling httpGetSearchFacetteByName.');
}
const collectiontypeid = requestParameters?.collectiontypeid;
const collectionid = requestParameters?.collectionid;
const mode = requestParameters?.mode;
const filter = requestParameters?.filter;
const scopefilter = requestParameters?.scopefilter;
const ids = requestParameters?.ids;
const portalId = requestParameters?.portalId;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (name !== undefined && name !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>name, 'name');
}
if (s !== undefined && s !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>s, 's');
}
if (collectiontypeid !== undefined && collectiontypeid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectiontypeid, 'collectiontypeid');
}
if (collectionid !== undefined && collectionid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectionid, 'collectionid');
}
if (mode !== undefined && mode !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>mode, 'mode');
}
if (filter !== undefined && filter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>filter, 'filter');
}
if (scopefilter !== undefined && scopefilter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>scopefilter, 'scopefilter');
}
if (ids !== undefined && ids !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>ids, 'ids');
}
if (portalId !== undefined && portalId !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>portalId, 'portal_id');
}
let localVarHeaders = this.defaultHeaders;
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 = `/search/facette`;
return this.httpClient.request<SearchFacet>('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 a configured max amount of results for search terms.
* @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 httpGlobalSearch(
requestParameters?: HttpGlobalSearchRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<SearchResult>;
public httpGlobalSearch(
requestParameters?: HttpGlobalSearchRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<SearchResult>>;
public httpGlobalSearch(
requestParameters?: HttpGlobalSearchRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<SearchResult>>;
public httpGlobalSearch(
requestParameters?: HttpGlobalSearchRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const s = requestParameters?.s;
if (s === null || s === undefined) {
throw new Error('Required parameter s was null or undefined when calling httpGlobalSearch.');
}
const limit = requestParameters?.limit;
const skip = requestParameters?.skip;
const collectiontypeid = requestParameters?.collectiontypeid;
const collectionid = requestParameters?.collectionid;
const mode = requestParameters?.mode;
const expose = requestParameters?.expose;
const filter = requestParameters?.filter;
const scopefilter = requestParameters?.scopefilter;
const orderby = requestParameters?.orderby;
const ids = requestParameters?.ids;
const portalId = requestParameters?.portalId;
const translations = requestParameters?.translations;
const acceptLanguage = requestParameters?.acceptLanguage;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (s !== undefined && s !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>s, 's');
}
if (limit !== undefined && limit !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>limit, 'limit');
}
if (skip !== undefined && skip !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>skip, 'skip');
}
if (collectiontypeid !== undefined && collectiontypeid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectiontypeid, 'collectiontypeid');
}
if (collectionid !== undefined && collectionid !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>collectionid, 'collectionid');
}
if (mode !== undefined && mode !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>mode, 'mode');
}
if (expose !== undefined && expose !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>expose, 'expose');
}
if (filter !== undefined && filter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>filter, 'filter');
}
if (scopefilter !== undefined && scopefilter !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>scopefilter, 'scopefilter');
}
if (orderby !== undefined && orderby !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>orderby, 'orderby');
}
if (ids !== undefined && ids !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>ids, 'ids');
}
if (portalId !== undefined && portalId !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>portalId, 'portal_id');
}
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 = `/search`;
return this.httpClient.request<SearchResult>('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 gives the status about the index and indexer.
* @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 httpSearchAdminGetStatus(
requestParameters?: HttpSearchAdminGetStatusRequestParams,
observe?: 'body',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<SearchAdminStatus>;
public httpSearchAdminGetStatus(
requestParameters?: HttpSearchAdminGetStatusRequestParams,
observe?: 'response',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpResponse<SearchAdminStatus>>;
public httpSearchAdminGetStatus(
requestParameters?: HttpSearchAdminGetStatusRequestParams,
observe?: 'events',
reportProgress?: boolean,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<HttpEvent<SearchAdminStatus>>;
public httpSearchAdminGetStatus(
requestParameters?: HttpSearchAdminGetStatusRequestParams,
observe: any = 'body',
reportProgress: boolean = false,
options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean }
): Observable<any> {
const portalId = requestParameters?.portalId;
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
if (portalId !== undefined && portalId !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>portalId, 'portal_id');
}
let localVarHeaders = this.defaultHeaders;
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 = `/searchadmin/status`;
return this.httpClient.request<SearchAdminStatus>('get', `${this.configuration.basePath}${localVarPath}`, {
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
withCredentials: this.configuration.withCredentials,
headers: localVarHeaders,
observe: observe,
transferCache: localVarTransferCache,
reportProgress: reportProgress
});
}
}