coconut-open-api-js
Version:
Coconut Calendar JS Open API SDK
111 lines (110 loc) • 3.46 kB
TypeScript
import { AxiosInstance } from 'axios';
import { ClientModel } from '../models/client';
import Conditional, { ConditionalResource } from './conditional';
export interface QueueAppointmentFilter {
location?: number;
method?: number;
service?: number;
through?: number;
notes?: string;
workflow?: number;
lang?: string;
preferred_lang?: string;
preferred_staff_id?: number;
recaptcha_token?: string;
}
export interface UtmParameters {
campaign?: string;
content?: string;
medium?: string;
source?: string;
term?: string;
}
export interface QueueAppointmentParameters {
data: {
attributes: {
preferred_lang?: string;
preferred_staff_id?: number;
lang?: string;
booked_through?: number;
service_id?: number;
location_id?: number;
meeting_method?: number;
notes?: string;
workflow_id?: number;
campaign?: string;
content?: string;
source?: string;
medium?: string;
term?: string;
recaptcha_token?: string;
};
relationships: {
client: {
data: object;
};
};
type: string;
};
meta?: {
booker?: number;
};
}
export interface QueueAppointmentResource extends ConditionalResource {
actingAs(identifier: number): this;
at(location: number): this;
book(): Promise<any>;
for(service: number): this;
method(method: number): this;
through(origin: number): this;
provided(notes: string): this;
preferredStaff(id: number): this;
preferredLanguage(locale: string): this;
language(locale: string): this;
with(client: ClientModel): this;
workflow(workflow: number): this;
recaptcha(recaptchaToken: string): this;
}
export interface Utm {
campaign(campaign: string): this;
content(content: string): this;
medium(medium: string): this;
source(source: string): this;
term(term: string): this;
}
export interface QueueAppointmentRelationship {
client: {
data: ClientModel | null;
};
}
export interface QueueAppointmentMeta {
booker?: number;
}
export default class QueueAppointment extends Conditional implements QueueAppointmentResource, Utm {
protected client: AxiosInstance;
protected filters: QueueAppointmentFilter;
protected meta: QueueAppointmentMeta;
protected relationships: QueueAppointmentRelationship;
protected utm: UtmParameters;
constructor(client: AxiosInstance);
actingAs(identifier: number): this;
at(location: number): this;
for(service: number): this;
method(method: number): this;
provided(notes: string): this;
through(origin: number): this;
with(client: ClientModel): this;
workflow(workflow: number): this;
recaptcha(recaptchaToken: string): this;
language(locale: string): this;
preferredLanguage(locale: string): this;
preferredStaff(id: number): this;
campaign(campaign: string): this;
content(content: string): this;
medium(medium: string): this;
source(source: string): this;
term(term: string): this;
book(): Promise<any>;
protected hasUtm(): boolean;
protected params(): QueueAppointmentParameters | object;
}