UNPKG

@agravity/public

Version:

The Agravity GlobalDAM API which allowes API key authenticated access the Agravity GlobalDAM Backend

223 lines (193 loc) 10.3 kB
/** * 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 HttpAssetGetBlobDownloadRequestParams { /** The ID of the asset. */ assetId: string; /** The name of the format (download format) or container. */ format: string; /** If the request comes from portal this is the indicator. */ portalId?: string; /** Returns assets on permissions which are locked and accessable (User needs editor permissions). Default: false */ locked?: boolean; /** Returns assets which are not in state ACTIVE (User needs editor permissions). Default: false */ uncompleted?: boolean; } export interface HttpAssetGetViewForPortalRequestParams { /** The ID of the asset. */ assetId: string; /** If the request comes from portal this is the indicator. */ portalId: string; /** The name of the format (download format) or container. */ format: string; /** True if a direct download with file name should be started. */ download?: string; } @Injectable({ providedIn: 'root' }) export class PublicEndpointsService extends BaseService { constructor( protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string | string[], @Optional() configuration?: AgravityPublicConfiguration ) { super(basePath, configuration); } /** * This endpoint returns the binary data of an asset to be downloaded. * @endpoint get /public/download * @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 httpAssetGetBlobDownload( requestParameters: HttpAssetGetBlobDownloadRequestParams, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<Blob>; public httpAssetGetBlobDownload( requestParameters: HttpAssetGetBlobDownloadRequestParams, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpResponse<Blob>>; public httpAssetGetBlobDownload( requestParameters: HttpAssetGetBlobDownloadRequestParams, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpEvent<Blob>>; public httpAssetGetBlobDownload( requestParameters: HttpAssetGetBlobDownloadRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<any> { const assetId = requestParameters?.assetId; if (assetId === null || assetId === undefined) { throw new Error('Required parameter assetId was null or undefined when calling httpAssetGetBlobDownload.'); } const format = requestParameters?.format; if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling httpAssetGetBlobDownload.'); } const portalId = requestParameters?.portalId; const locked = requestParameters?.locked; const uncompleted = requestParameters?.uncompleted; let localVarQueryParameters = new OpenApiHttpParams(this.encoder); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'asset_id', <any>assetId, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'format', <any>format, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'portal_id', <any>portalId, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'locked', <any>locked, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'uncompleted', <any>uncompleted, QueryParamStyle.Form, true); let localVarHeaders = this.defaultHeaders; const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept(['application/octet-stream', 'application/json']); if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); } const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); const localVarTransferCache: boolean = options?.transferCache ?? true; let localVarPath = `/public/download`; const { basePath, withCredentials } = this.configuration; return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters.toHttpParams(), responseType: 'blob', ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), reportProgress: reportProgress }); } /** * This endpoint returns the content of an asset which is available in a specific portal (portal_id is \&quot;key\&quot;) and returns the blob directly. * @endpoint get /public/view * @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 httpAssetGetViewForPortal( requestParameters: HttpAssetGetViewForPortalRequestParams, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<Blob>; public httpAssetGetViewForPortal( requestParameters: HttpAssetGetViewForPortalRequestParams, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpResponse<Blob>>; public httpAssetGetViewForPortal( requestParameters: HttpAssetGetViewForPortalRequestParams, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpEvent<Blob>>; public httpAssetGetViewForPortal( requestParameters: HttpAssetGetViewForPortalRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/octet-stream' | 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<any> { const assetId = requestParameters?.assetId; if (assetId === null || assetId === undefined) { throw new Error('Required parameter assetId was null or undefined when calling httpAssetGetViewForPortal.'); } const portalId = requestParameters?.portalId; if (portalId === null || portalId === undefined) { throw new Error('Required parameter portalId was null or undefined when calling httpAssetGetViewForPortal.'); } const format = requestParameters?.format; if (format === null || format === undefined) { throw new Error('Required parameter format was null or undefined when calling httpAssetGetViewForPortal.'); } const download = requestParameters?.download; let localVarQueryParameters = new OpenApiHttpParams(this.encoder); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'asset_id', <any>assetId, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'portal_id', <any>portalId, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'format', <any>format, QueryParamStyle.Form, true); localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, 'download', <any>download, QueryParamStyle.Form, true); let localVarHeaders = this.defaultHeaders; const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept(['application/octet-stream', 'application/json']); if (localVarHttpHeaderAcceptSelected !== undefined) { localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); } const localVarHttpContext: HttpContext = options?.context ?? new HttpContext(); const localVarTransferCache: boolean = options?.transferCache ?? true; let localVarPath = `/public/view`; const { basePath, withCredentials } = this.configuration; return this.httpClient.request('get', `${basePath}${localVarPath}`, { context: localVarHttpContext, params: localVarQueryParameters.toHttpParams(), responseType: 'blob', ...(withCredentials ? { withCredentials } : {}), headers: localVarHeaders, observe: observe, ...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}), reportProgress: reportProgress }); } }