UNPKG

@agravity/private

Version:

The Agravity GlobalDAM API which allowes authenticated user to access the Agravity GlobalDAM Backend

370 lines (338 loc) 15.5 kB
/** * Agravity OpenAPI Documentation - Private 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.agravity'; // @ts-ignore import { Asset } from '../model/asset.agravity'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { AgravityConfiguration } from '../configuration'; export interface HttpWordpressPageRequestParams { /** The title of the wordpress post. */ pageTitle: string; /** The excerpt of the wordpress page as well as the first part of the page. */ pageContentBefore: string; /** The URL where the image can be publically retrieved. */ pageImage: string; /** The content of the wordpress page, which is shown below the image. */ pageContentAfter: string; /** This endpoint creates a Wordpress Page */ asset: Asset; } export interface HttpWordpressPostRequestParams { /** The title of the wordpress post. */ postTitle: string; /** The excerpt of the wordpress post as well as the first part of the post. */ postContentBefore: string; /** The URL where the image can be publically retrieved. */ postImage: string; /** The content of the wordpress post, which is shown below the image. */ postContentAfter: string; /** This endpoint creates a Wordpress Post */ asset: Asset; } @Injectable({ providedIn: 'root' }) export class WordpressManagementService { protected basePath = 'http://localhost:7071/api'; public defaultHeaders = new HttpHeaders(); public configuration = new AgravityConfiguration(); public encoder: HttpParameterCodec; constructor( protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string | string[], @Optional() configuration: AgravityConfiguration ) { 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 creates a Wordpress Page * @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 httpWordpressPage( requestParameters?: HttpWordpressPageRequestParams, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<number>; public httpWordpressPage( requestParameters?: HttpWordpressPageRequestParams, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpResponse<number>>; public httpWordpressPage( requestParameters?: HttpWordpressPageRequestParams, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpEvent<number>>; public httpWordpressPage( requestParameters?: HttpWordpressPageRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<any> { const pageTitle = requestParameters?.pageTitle; if (pageTitle === null || pageTitle === undefined) { throw new Error('Required parameter pageTitle was null or undefined when calling httpWordpressPage.'); } const pageContentBefore = requestParameters?.pageContentBefore; if (pageContentBefore === null || pageContentBefore === undefined) { throw new Error('Required parameter pageContentBefore was null or undefined when calling httpWordpressPage.'); } const pageImage = requestParameters?.pageImage; if (pageImage === null || pageImage === undefined) { throw new Error('Required parameter pageImage was null or undefined when calling httpWordpressPage.'); } const pageContentAfter = requestParameters?.pageContentAfter; if (pageContentAfter === null || pageContentAfter === undefined) { throw new Error('Required parameter pageContentAfter was null or undefined when calling httpWordpressPage.'); } const asset = requestParameters?.asset; if (asset === null || asset === undefined) { throw new Error('Required parameter asset was null or undefined when calling httpWordpressPage.'); } let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); if (pageTitle !== undefined && pageTitle !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>pageTitle, 'page_title'); } if (pageContentBefore !== undefined && pageContentBefore !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>pageContentBefore, 'page_content_before'); } if (pageImage !== undefined && pageImage !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>pageImage, 'page_image'); } if (pageContentAfter !== undefined && pageContentAfter !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>pageContentAfter, 'page_content_after'); } let localVarHeaders = this.defaultHeaders; let localVarCredential: string | undefined; // authentication (msal_auth) required localVarCredential = this.configuration.lookupCredential('msal_auth'); if (localVarCredential) { localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + 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 = `/wordpresspage`; return this.httpClient.request<number>('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 creates a Wordpress Post * @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 httpWordpressPost( requestParameters?: HttpWordpressPostRequestParams, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<number>; public httpWordpressPost( requestParameters?: HttpWordpressPostRequestParams, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpResponse<number>>; public httpWordpressPost( requestParameters?: HttpWordpressPostRequestParams, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<HttpEvent<number>>; public httpWordpressPost( requestParameters?: HttpWordpressPostRequestParams, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json'; context?: HttpContext; transferCache?: boolean } ): Observable<any> { const postTitle = requestParameters?.postTitle; if (postTitle === null || postTitle === undefined) { throw new Error('Required parameter postTitle was null or undefined when calling httpWordpressPost.'); } const postContentBefore = requestParameters?.postContentBefore; if (postContentBefore === null || postContentBefore === undefined) { throw new Error('Required parameter postContentBefore was null or undefined when calling httpWordpressPost.'); } const postImage = requestParameters?.postImage; if (postImage === null || postImage === undefined) { throw new Error('Required parameter postImage was null or undefined when calling httpWordpressPost.'); } const postContentAfter = requestParameters?.postContentAfter; if (postContentAfter === null || postContentAfter === undefined) { throw new Error('Required parameter postContentAfter was null or undefined when calling httpWordpressPost.'); } const asset = requestParameters?.asset; if (asset === null || asset === undefined) { throw new Error('Required parameter asset was null or undefined when calling httpWordpressPost.'); } let localVarQueryParameters = new HttpParams({ encoder: this.encoder }); if (postTitle !== undefined && postTitle !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>postTitle, 'post_title'); } if (postContentBefore !== undefined && postContentBefore !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>postContentBefore, 'post_content_before'); } if (postImage !== undefined && postImage !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>postImage, 'post_image'); } if (postContentAfter !== undefined && postContentAfter !== null) { localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, <any>postContentAfter, 'post_content_after'); } let localVarHeaders = this.defaultHeaders; let localVarCredential: string | undefined; // authentication (msal_auth) required localVarCredential = this.configuration.lookupCredential('msal_auth'); if (localVarCredential) { localVarHeaders = localVarHeaders.set('Authorization', 'Bearer ' + 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 = `/wordpresspost`; return this.httpClient.request<number>('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 }); } }