@kontent-ai/management-sdk
Version:
Official Kontent.ai management SDK
62 lines (61 loc) • 2.17 kB
TypeScript
import { IHeader, IHttpCancelRequestToken, IQueryParameter } from '@kontent-ai/core-sdk';
import { IManagementClientConfig } from '../config/imanagement-client-config.interface';
import { ContentManagementApiEndpoints, IContentManagementQueryConfig } from '../models';
import { BaseResponses } from '../responses';
import { ManagementQueryService } from '../services';
export declare abstract class BaseQuery<TResponse extends BaseResponses.IContentManagementResponse> {
protected config: IManagementClientConfig;
protected queryService: ManagementQueryService;
private _customUrl?;
protected readonly queryConfig: IContentManagementQueryConfig;
protected readonly parameters: IQueryParameter[];
protected readonly apiEndpoints: ContentManagementApiEndpoints;
protected _addSlashToUrl: boolean;
constructor(config: IManagementClientConfig, queryService: ManagementQueryService);
/**
* Gets url for this query
*/
getUrl(): string;
/**
* Adds header to request
* @param header Header to add
*/
withHeader(header: IHeader): this;
/**
* Adds headers to request
* @param headers Headers to add
*/
withHeaders(headers: IHeader[]): this;
/**
* Adds cancel token to request
*/
withCancelToken(tokenRequest: IHttpCancelRequestToken<any>): this;
/**
* Gets array of currently set headers
*/
getHeaders(): IHeader[];
/**
* Sets custom query parmeter that will be added to URL
* @param name Parameter name
* @param value Parameter value
*/
withCustomParameter(name: string, value: string): this;
/**
* Overrides default url resolver and resolves this query with a custom one
* @param url Custom url to resolve query
*/
withUrl(url: string): this;
/**
* Gets parameters assigned to this query
*/
getParameters(): IQueryParameter[];
/**
* Gets promise to resolve this query
*/
abstract toPromise(): Promise<TResponse>;
/**
* Gets action for this query
*/
protected abstract getAction(): string;
protected getUrlForAction(action: string): string;
}