@velis/dynamicforms
Version:
Data entry boilerplate components and a RESTful API consumer
38 lines • 1.62 kB
TypeScript
import { AxiosRequestConfig } from 'axios';
import { Ref } from 'vue';
import { APIConsumer } from '../../api_consumer/namespace';
import { IDetailViewApi, PrimaryKeyBaseType, DetailViewOptions } from './namespace';
export default class DetailViewApi<T = any> implements IDetailViewApi<T> {
protected readonly baseUrl: Ref<string>;
protected readonly trailingSlash: boolean;
protected readonly pk?: Ref<PrimaryKeyBaseType>;
protected readonly query?: Ref<URLSearchParams>;
protected readonly useQueryInRetrieveOnly: boolean;
readonly detail_url: Ref<string>;
readonly definition_url: Ref<string>;
readonly data_url: Ref<string>;
constructor(options: DetailViewOptions);
compose_url(url: string | Ref<string>, useQuery: boolean): string;
componentDefinition: (config?: AxiosRequestConfig) => Promise<APIConsumer.FormUXDefinition>;
/**
* Retrieve the record.
* @throws {AxiosError} Throws an error if the request fails.
*/
retrieve: (config?: AxiosRequestConfig) => Promise<T>;
/**
* POST the record to the backend.
* @throws {AxiosError} Throws an error if the request fails.
*/
create: (data: T, config?: AxiosRequestConfig) => Promise<T>;
/**
* Update the record.
* @throws {AxiosError} Throws an error if the request fails.
*/
update: (data: T, config?: AxiosRequestConfig) => Promise<T>;
/**
* Delete the record.
* @throws {AxiosError} Throws an error if the request fails.
*/
delete: (config?: AxiosRequestConfig) => Promise<T>;
}
//# sourceMappingURL=detail-view-api.d.ts.map