Skip to content

Commit

Permalink
Merge pull request #4 from dayschedule/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
vickyRathee authored Oct 23, 2023
2 parents 3785aee + ee4b951 commit f34dd68
Show file tree
Hide file tree
Showing 23 changed files with 1,132 additions and 102 deletions.
Binary file added .DS_Store
Binary file not shown.
700 changes: 689 additions & 11 deletions docs/resources.md

Large diffs are not rendered by default.

31 changes: 0 additions & 31 deletions lib/Activities.ts

This file was deleted.

32 changes: 32 additions & 0 deletions lib/activities/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import Api from "../api";
import { Activity } from "./types";

class Activities {
private api: Api;

constructor(api: Api) {
this.api = api;
}

async list(contact_id: string, params: any): Promise<Activity[]> {
return this.api.get(`/activities/${contact_id}`, params);
}

async get(activity_id: string): Promise<Activity> {
return this.api.get(`/activities/${activity_id}`);
}

async create(data: Activity): Promise<any> {
return this.api.post(`/activities`, data);
}

async update(activity_id: string, data: Activity): Promise<any> {
return this.api.put(`/activities/${activity_id}`, data);
}

async delete(activity_id: string): Promise<any> {
return this.api.delete(`/activities/${activity_id}`);
}
}

export default Activities;
20 changes: 20 additions & 0 deletions lib/activities/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
declare type File = {
name: string;
size: number;
type: string;
path?: string;
url?: string;
};

export declare type Activity = {
activity_id?: string;
org_id?: number;
user?: Record<string, any>;
contact_id: string;
type: string;
title?: string;
description?: string;
file?: File;
date?: Date;
status?: string;
};
11 changes: 6 additions & 5 deletions lib/Bookings.ts → lib/bookings/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Api from "./api";
import { Booking } from "./types";
import Api from "../api";

class Bookings {
private api: Api;
Expand All @@ -7,19 +8,19 @@ class Bookings {
this.api = api;
}

async list(params: any): Promise<any[]> {
async list(params: any): Promise<Booking[]> {
return this.api.get(`/bookings`, params);
}

async get(id: string): Promise<any> {
async get(id: string): Promise<Booking> {
return this.api.get(`/bookings/${id}`);
}

async create(data: any): Promise<any> {
async create(data: Booking): Promise<any> {
return this.api.post(`/bookings`, data);
}

async update(id: string, data: any): Promise<any> {
async update(id: string, data: Booking): Promise<any> {
return this.api.put(`/bookings/${id}`, data);
}

Expand Down
59 changes: 59 additions & 0 deletions lib/bookings/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { Invitee } from "../invitees/types";

declare type Resource = {
resource_id: string;
name?: string;
type?: string;
event_type?: string;
slug?: string;
description?: string;
};

declare type Host = {
user_id: number;
name?: string;
email?: string;
avatar?: string;
time_zone?: string;
phone?: string;
location?: Location;
};

declare type Reschedule = {
rescheduled_from?: Date;
rescheduled_by?: string;
reschedule_reason?: string;
rescheduled_at?: Date;
};

declare type Attendee = {
name?: string;
email: string;
status?: string;
organizer?: boolean;
};

export declare type Booking = {
booking_id?: string;
org_id?: number;
source?: string;
resource: Resource;
host: Host;
subject?: string;
description?: string;
start_at: Date;
end_at?: Date;
duration?: any;
time_zone?: string;
status?: string;
color?: string;
internal_note?: string;
location: any;
canceled_at?: Date;
cancel_reason?: string;
reschedule?: Reschedule;
attendes?: Attendee[];
busy?: string;
recurrence?: Array<string>;
invitees: Invitee[];
};
11 changes: 6 additions & 5 deletions lib/Contacts.ts → lib/contacts/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Api from "./api";
import Api from "../api";
import { Contact } from "./types";

class Contacts {
private api: Api;
Expand All @@ -7,19 +8,19 @@ class Contacts {
this.api = api;
}

async list(params: any): Promise<any[]> {
async list(params: any): Promise<Contact[]> {
return this.api.get(`/contacts`, params);
}

async get(id: string): Promise<any> {
async get(id: string): Promise<Contact> {
return this.api.get(`/contacts/${id}`);
}

async create(data: any): Promise<any> {
async create(data: Contact): Promise<any> {
return this.api.post(`/contacts`, data);
}

async update(id: string, data: any): Promise<any> {
async update(id: string, data: Contact): Promise<any> {
return this.api.put(`/contacts/${id}`, data);
}

Expand Down
28 changes: 28 additions & 0 deletions lib/contacts/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
declare type CustomField = {
name?: string;
value?: string;
};

declare type Tags = {
color?: string;
background?: string;
name?: string;
};

export declare type Contact = {
contact_id?: string;
org_id: number;
user_id?: number;
name?: string;
email?: string;
phone?: string;
avatar?: string;
company?: string;
followup?: Date;
source?: string;
notes?: string;
hotness?: number;
tags: Array<Tags>;
custom_fields?: CustomField[];
do_not_contact?: boolean;
};
20 changes: 10 additions & 10 deletions index.ts → lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Activities from "./lib/Activities";
import Api from "./lib/api";
import Bookings from "./lib/Bookings";
import Contacts from "./lib/Contacts";
import Invitees from "./lib/Invitees";
import Pages from "./lib/Pages";
import Resources from "./lib/Resources";
import Schedules from "./lib/Schedules";
import Users from "./lib/Users";
import Workflows from "./lib/Workflows";
import Activities from "./activities";
import Api from "./api";
import Bookings from "./bookings";
import Contacts from "./contacts";
import Invitees from "./invitees";
import Pages from "./pages";
import Resources from "./resources";
import Schedules from "./schedules";
import Users from "./users";
import Workflows from "./workflows";

class DaySchedule {
private api: Api;
Expand Down
11 changes: 6 additions & 5 deletions lib/Invitees.ts → lib/invitees/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Api from "./api";
import Api from "../api";
import { Invitee } from "./types";

class Invitees {
private api: Api;
Expand All @@ -7,19 +8,19 @@ class Invitees {
this.api = api;
}

async list(params: any): Promise<any[]> {
async list(params: any): Promise<Invitee[]> {
return this.api.get(`/invitees`, params);
}

async get(id: string): Promise<any> {
async get(id: string): Promise<Invitee> {
return this.api.get(`/invitees/${id}`);
}

async create(data: any): Promise<any> {
async create(data: Invitee): Promise<any> {
return this.api.post(`/invitees`, data);
}

async update(id: string, data: any): Promise<any> {
async update(id: string, data: Invitee): Promise<any> {
return this.api.put(`/invitees/${id}`, data);
}

Expand Down
51 changes: 51 additions & 0 deletions lib/invitees/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
declare type Question = {
type: string;
name: string;
label: string;
value: string;
required?: boolean;
placeholder?: string;
pattern?: string;
options?: any[];
}

declare type ServiceOption = {
category?: string;
name?: string;
description?: string;
duration?: any;
price?: any;
}

declare type Payment = {
amount?: number;
name?: string;
currency?: string;
gateway?: string;
reference_id?: string;
link?: string;
data?: any;
}

export declare type Invitee = {
invitee_id?: string;
booking_id?: string;
org_id?: number;
name: string;
email: string;
phone?: string;
guest?: Array<string>;
status?: string;
cancceled_at?: Date;
reason?: string;
time_zone?: string;
token?: string;
questions?: Question[];
payment?: Payment;
services?: ServiceOption[];
check_in?: Record<string, any>;
custom_fields?: Record<string, any>;
tracking?: Record<string, any>;
utm?: Record<string, any>;
uuid?: string;
}
11 changes: 6 additions & 5 deletions lib/pages.ts → lib/pages/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Api from "./api";
import Api from "../api";
import { Page } from "./types";

class Pages {
private api: Api;
Expand All @@ -7,19 +8,19 @@ class Pages {
this.api = api;
}

async list(): Promise<any[]> {
async list(): Promise<Page[]> {
return this.api.get(`/pages`);
}

async get(id: string): Promise<any> {
async get(id: string): Promise<Page> {
return this.api.get(`/pages/${id}`);
}

async create(data: any): Promise<any> {
async create(data: Page): Promise<any> {
return this.api.post(`/pages`, data);
}

async update(id: string, data: any): Promise<any> {
async update(id: string, data: Page): Promise<any> {
return this.api.put(`/pages/${id}`, data);
}

Expand Down
21 changes: 21 additions & 0 deletions lib/pages/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export declare type Page = {
page_id?: number;
org_id?: number;
user_id?: number;
name: string;
domain: string;
is_default?: boolean;
description?: string;
logo?: string;
color?: Record<string, string>;
remove_branding?: boolean;
seo?: Record<string, any>;
integrations?: Record<string, any>;
template?: Record<string, any>;
is_default_template?: boolean;
is_published?: boolean;
is_public?: boolean;
screenshots?: Array<string>;
updated_at?: Date;
created_at?: Date;
};
Loading

0 comments on commit f34dd68

Please sign in to comment.