Skip to content

Commit a4a487b

Browse files
authored
Merge pull request #37 from ctrl-hub/add-appointments
add appointments
2 parents f72edb6 + fc5ecd1 commit a4a487b

File tree

6 files changed

+102
-1
lines changed

6 files changed

+102
-1
lines changed

dist/models/Appointment.d.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import type { RelationshipDefinition } from '../types/RelationshipDefinition';
2+
import { BaseModel } from '@models/BaseModel';
3+
import type { JsonApiMapping } from '../types/JsonApiMapping';
4+
export declare class Appointment extends BaseModel implements Partial<JsonApiMapping> {
5+
type: string;
6+
appointment_type: string;
7+
start_time: string;
8+
end_time: string;
9+
notes: string;
10+
jsonApiMapping(): {
11+
attributes: string[];
12+
};
13+
static relationships: RelationshipDefinition[];
14+
constructor(data?: any);
15+
}

dist/models/Appointment.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { BaseModel } from '@models/BaseModel';
2+
export class Appointment extends BaseModel {
3+
type = 'appointments';
4+
appointment_type = '';
5+
start_time = '';
6+
end_time = '';
7+
notes = '';
8+
jsonApiMapping() {
9+
return {
10+
attributes: ['appointment_type', 'start_time', 'end_time', 'notes'],
11+
};
12+
}
13+
static relationships = [
14+
{
15+
name: 'customer_interaction',
16+
type: 'single',
17+
modelType: 'customer-interactions',
18+
},
19+
{
20+
name: 'operation',
21+
type: 'single',
22+
modelType: 'operations',
23+
},
24+
];
25+
constructor(data) {
26+
super(data);
27+
this.appointment_type = data?.attributes?.appointment_type ?? data?.appointment_type ?? '';
28+
this.start_time = data?.attributes?.start_time ?? data?.start_time ?? '';
29+
this.end_time = data?.attributes?.end_time ?? data?.end_time ?? '';
30+
this.notes = data?.attributes?.notes ?? data?.notes ?? '';
31+
}
32+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { Client } from 'Client';
2+
import { BaseService } from './BaseService';
3+
import { Appointment } from '@models/Appointment';
4+
export declare class AppointmentsService extends BaseService<Appointment> {
5+
constructor(client: Client);
6+
}

dist/services/AppointmentsService.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { Client } from 'Client';
2+
import { BaseService } from './BaseService';
3+
import { Appointment } from '@models/Appointment';
4+
export class AppointmentsService extends BaseService {
5+
constructor(client) {
6+
super(client, '/v3/orgs/:orgId/appointments');
7+
}
8+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"type": "git",
55
"url": "https://github.com/ctrl-hub/sdk.ts"
66
},
7-
"version": "0.1.116",
7+
"version": "0.1.117",
88
"main": "dist/index.js",
99
"types": "dist/index.d.ts",
1010
"type": "module",

src/models/Appointment.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type { RelationshipDefinition } from '../types/RelationshipDefinition';
2+
import { BaseModel } from '@models/BaseModel';
3+
import type { JsonApiMapping } from '../types/JsonApiMapping';
4+
5+
export class Appointment extends BaseModel implements Partial<JsonApiMapping> {
6+
public type: string = 'appointments';
7+
8+
public appointment_type: string = '';
9+
public start_time: string = '';
10+
public end_time: string = '';
11+
public notes: string = '';
12+
13+
jsonApiMapping() {
14+
return {
15+
attributes: ['appointment_type', 'start_time', 'end_time', 'notes'],
16+
};
17+
}
18+
19+
static relationships: RelationshipDefinition[] = [
20+
{
21+
name: 'customer_interaction',
22+
type: 'single',
23+
modelType: 'customer-interactions',
24+
},
25+
{
26+
name: 'operation',
27+
type: 'single',
28+
modelType: 'operations',
29+
},
30+
];
31+
32+
constructor(data?: any) {
33+
super(data);
34+
35+
this.appointment_type = data?.attributes?.appointment_type ?? data?.appointment_type ?? '';
36+
this.start_time = data?.attributes?.start_time ?? data?.start_time ?? '';
37+
this.end_time = data?.attributes?.end_time ?? data?.end_time ?? '';
38+
this.notes = data?.attributes?.notes ?? data?.notes ?? '';
39+
}
40+
}

0 commit comments

Comments
 (0)