From a8f1e81f382454b622781ef5f5d8e4afde98ebd2 Mon Sep 17 00:00:00 2001 From: Craig Paul Date: Fri, 16 Nov 2018 14:58:01 -0600 Subject: [PATCH] Adds slot accessor and test --- src/index.test.ts | 8 ++++++++ src/index.ts | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/index.test.ts b/src/index.test.ts index 5204ff1..4460653 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -4,6 +4,7 @@ import Question from './resources/question'; import Service from './resources/service'; import Setting from './resources/setting'; import User from './resources/user'; +import TimeSlot from './resources/time-slot'; it('will be constructed properly', async () => { const instance = new OpenApi('admin'); @@ -46,3 +47,10 @@ it('can access the location resource', async () => { expect(instance).toHaveProperty('locations'); expect(instance.locations).toBeInstanceOf(Location.prototype.constructor); }); + +it('can access the slots resource', async () => { + const instance = new OpenApi('admin'); + + expect(instance).toHaveProperty('slots'); + expect(instance.slots).toBeInstanceOf(TimeSlot.prototype.constructor); +}); diff --git a/src/index.ts b/src/index.ts index ce865b6..f3f602d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,8 +5,16 @@ import Location from './resources/location'; import Question from './resources/question'; import Service from './resources/service'; import Setting from './resources/setting'; +import TimeSlot from './resources/time-slot'; import User from './resources/user'; -import { LocationResource, QuestionResource, Resource, ServiceResource, UserResource } from './types/resources'; +import { + LocationResource, + QuestionResource, + Resource, + ServiceResource, + TimeSlotResource, + UserResource +} from './types/resources'; export default class OpenApi { protected client: AxiosInstance; @@ -15,6 +23,7 @@ export default class OpenApi { protected question: QuestionResource; protected service: ServiceResource; protected setting: Resource; + protected slot: TimeSlotResource; protected user: UserResource; constructor(domain: string) { @@ -24,6 +33,7 @@ export default class OpenApi { this.question = new Question(this.client); this.service = new Service(this.client); this.setting = new Setting(this.client); + this.slot = new TimeSlot(this.client); this.user = new User(this.client); } @@ -43,6 +53,10 @@ export default class OpenApi { return this.setting; } + get slots(): TimeSlotResource { + return this.slot; + } + get users(): UserResource { return this.user; }