architect-node-sdk
Version:
Essentialz Architect Nodejs SDK
20 lines (19 loc) • 1.23 kB
TypeScript
import { HttpClientInterface } from '../http';
import { ArchitectConfig } from '../types';
import { ArchitectResourceActionOptions, ArchitectResourceFetchOptions, ArchitectResourceService, InnerType } from './types';
export declare class ResourceService<T> implements ArchitectResourceService<T> {
protected readonly resourceName: string;
protected httpClient: HttpClientInterface;
private readonly config;
constructor(resourceName: string, httpClient: HttpClientInterface, config: ArchitectConfig);
getAll(options?: ArchitectResourceFetchOptions): Promise<InnerType<T>[]>;
search(query: Record<string, any> | string, options?: ArchitectResourceFetchOptions): Promise<InnerType<T>[]>;
get(id: string, options?: ArchitectResourceActionOptions): Promise<InnerType<T>>;
create(body: Record<string, any>, options?: ArchitectResourceActionOptions): Promise<InnerType<T>>;
update(id: string, body: Record<string, any>, options?: ArchitectResourceActionOptions): Promise<InnerType<T>>;
delete(id: string, options?: ArchitectResourceActionOptions): Promise<any>;
protected getResourceUrl(id?: string): string;
private getInit;
private prepareBody;
private parseResponseData;
}