timezest 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +26 -26
- package/index.js +23 -23
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { log, LogLevel, Logger } from "./utils/logger";
|
|
2
2
|
import { TimeZestAPIConfig } from "./config/config";
|
|
3
|
-
import { Agent, Resource, AppointmentType, SchedulingRequest, Team } from "./entities/entities";
|
|
4
|
-
export { Agent, Resource, AppointmentType, SchedulingRequest, Team } from "./entities/entities";
|
|
3
|
+
import { Agent, Resource, AppointmentType, SchedulingRequest, Team, SchedulingRequestPost } from "./entities/entities";
|
|
4
|
+
export { Agent, Resource, AppointmentType, SchedulingRequest, SchedulingRequestPost, Team } from "./entities/entities";
|
|
5
5
|
export { ResourceSchema, AgentSchema, AppointmentTypeSchema, SchedulingRequestSchema, TeamSchema } from "./entities/schemas";
|
|
6
6
|
/**
|
|
7
7
|
* Options for configuring the TimeZest API.
|
|
@@ -35,62 +35,62 @@ export declare class TimeZestAPI {
|
|
|
35
35
|
*/
|
|
36
36
|
constructor(apiKey: string, options?: TimeZestAPIOptions);
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @returns The API key.
|
|
38
|
+
* Returns the API key used by this client instance.
|
|
39
|
+
* @returns {string} The API key for authenticating with the TimeZest API.
|
|
40
40
|
*/
|
|
41
41
|
getApiKey(): string;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @returns The API client
|
|
43
|
+
* Returns the configuration object for this API client instance.
|
|
44
|
+
* @returns {TimeZestAPIConfig} The configuration for the API client.
|
|
45
45
|
*/
|
|
46
46
|
getConfig(): TimeZestAPIConfig;
|
|
47
47
|
/**
|
|
48
48
|
* Fetches resources from the TimeZest API.
|
|
49
|
-
* @param filter - Optional filter string to narrow down results.
|
|
50
|
-
* @returns A promise that resolves to an array of resources.
|
|
49
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
50
|
+
* @returns {Promise<Resource[]>} A promise that resolves to an array of resources.
|
|
51
51
|
*/
|
|
52
52
|
getResources: (filter?: string | null) => Promise<Resource[]>;
|
|
53
53
|
/**
|
|
54
54
|
* Fetches agents from the TimeZest API.
|
|
55
|
-
* @param filter - Optional filter string to narrow down results.
|
|
56
|
-
* @returns A promise that resolves to an array of agents.
|
|
55
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
56
|
+
* @returns {Promise<Agent[]>} A promise that resolves to an array of agents.
|
|
57
57
|
*/
|
|
58
58
|
getAgents(filter?: string | null): Promise<Agent[]>;
|
|
59
59
|
/**
|
|
60
60
|
* Fetches teams from the TimeZest API.
|
|
61
|
-
* @param filter - Optional filter string to narrow down results.
|
|
62
|
-
* @returns A promise that resolves to an array of teams.
|
|
61
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
62
|
+
* @returns {Promise<Team[]>} A promise that resolves to an array of teams.
|
|
63
63
|
*/
|
|
64
64
|
getTeams(filter?: string | null): Promise<Team[]>;
|
|
65
65
|
/**
|
|
66
66
|
* Fetches appointment types from the TimeZest API.
|
|
67
|
-
* @param filter - Optional filter string to narrow down results.
|
|
68
|
-
* @returns A promise that resolves to an array of appointment types.
|
|
67
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
68
|
+
* @returns {Promise<AppointmentType[]>} A promise that resolves to an array of appointment types.
|
|
69
69
|
*/
|
|
70
70
|
getAppointmentTypes(filter?: string | null): Promise<AppointmentType[]>;
|
|
71
71
|
/**
|
|
72
72
|
* Fetches a scheduling request by its ID.
|
|
73
|
-
* @param id - The ID of the scheduling request.
|
|
74
|
-
* @returns A promise that resolves to the scheduling request.
|
|
73
|
+
* @param {string} id - The ID of the scheduling request to fetch.
|
|
74
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the scheduling request.
|
|
75
75
|
*/
|
|
76
76
|
getSchedulingRequest(id: string): Promise<SchedulingRequest>;
|
|
77
77
|
/**
|
|
78
78
|
* Fetches scheduling requests from the TimeZest API.
|
|
79
|
-
* @param filter - Optional filter string to narrow down results.
|
|
80
|
-
* @returns A promise that resolves to an array of scheduling requests.
|
|
79
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
80
|
+
* @returns {Promise<SchedulingRequest[]>} A promise that resolves to an array of scheduling requests.
|
|
81
81
|
*/
|
|
82
82
|
getSchedulingRequests(filter?: string | null): Promise<SchedulingRequest[]>;
|
|
83
83
|
/**
|
|
84
|
-
* Creates a new scheduling request.
|
|
85
|
-
* @param data - The data for the scheduling request.
|
|
86
|
-
* @returns A promise that resolves to the created scheduling request.
|
|
84
|
+
* Creates a new scheduling request in the TimeZest API.
|
|
85
|
+
* @param {SchedulingRequestPost} data - The data for the new scheduling request.
|
|
86
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the created scheduling request.
|
|
87
87
|
*/
|
|
88
|
-
createSchedulingRequest(data:
|
|
88
|
+
createSchedulingRequest(data: SchedulingRequestPost): Promise<SchedulingRequest>;
|
|
89
89
|
/**
|
|
90
|
-
* Validates API responses using Zod schemas if outputValidation is enabled.
|
|
91
|
-
* @param response - The API response data to validate.
|
|
92
|
-
* @param schema - The Zod schema to validate against.
|
|
93
|
-
* @returns The validated or raw response data.
|
|
90
|
+
* Validates API responses using Zod schemas if outputValidation is enabled in the config.
|
|
91
|
+
* @param {T[]} response - The API response data to validate.
|
|
92
|
+
* @param {ZodSchema} schema - The Zod schema to validate against.
|
|
93
|
+
* @returns {T[]} The validated or raw response data.
|
|
94
94
|
*/
|
|
95
95
|
private validateResponse;
|
|
96
96
|
}
|
package/index.js
CHANGED
|
@@ -35,8 +35,8 @@ class TimeZestAPI {
|
|
|
35
35
|
constructor(apiKey, options) {
|
|
36
36
|
/**
|
|
37
37
|
* Fetches resources from the TimeZest API.
|
|
38
|
-
* @param filter - Optional filter string to narrow down results.
|
|
39
|
-
* @returns A promise that resolves to an array of resources.
|
|
38
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
39
|
+
* @returns {Promise<Resource[]>} A promise that resolves to an array of resources.
|
|
40
40
|
*/
|
|
41
41
|
this.getResources = (...args_1) => __awaiter(this, [...args_1], void 0, function* (filter = null) {
|
|
42
42
|
const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.RESOURCES, "GET", null, filter);
|
|
@@ -65,23 +65,23 @@ class TimeZestAPI {
|
|
|
65
65
|
this.createSchedulingRequest = (0, logger_1.withLogging)(this.createSchedulingRequest.bind(this), this, "createSchedulingRequest");
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
69
|
-
* @returns The API key.
|
|
68
|
+
* Returns the API key used by this client instance.
|
|
69
|
+
* @returns {string} The API key for authenticating with the TimeZest API.
|
|
70
70
|
*/
|
|
71
71
|
getApiKey() {
|
|
72
72
|
return this.apiKey;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @returns The API client
|
|
75
|
+
* Returns the configuration object for this API client instance.
|
|
76
|
+
* @returns {TimeZestAPIConfig} The configuration for the API client.
|
|
77
77
|
*/
|
|
78
78
|
getConfig() {
|
|
79
79
|
return this.config;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Fetches agents from the TimeZest API.
|
|
83
|
-
* @param filter - Optional filter string to narrow down results.
|
|
84
|
-
* @returns A promise that resolves to an array of agents.
|
|
83
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
84
|
+
* @returns {Promise<Agent[]>} A promise that resolves to an array of agents.
|
|
85
85
|
*/
|
|
86
86
|
getAgents() {
|
|
87
87
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -91,8 +91,8 @@ class TimeZestAPI {
|
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* Fetches teams from the TimeZest API.
|
|
94
|
-
* @param filter - Optional filter string to narrow down results.
|
|
95
|
-
* @returns A promise that resolves to an array of teams.
|
|
94
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
95
|
+
* @returns {Promise<Team[]>} A promise that resolves to an array of teams.
|
|
96
96
|
*/
|
|
97
97
|
getTeams() {
|
|
98
98
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -102,8 +102,8 @@ class TimeZestAPI {
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Fetches appointment types from the TimeZest API.
|
|
105
|
-
* @param filter - Optional filter string to narrow down results.
|
|
106
|
-
* @returns A promise that resolves to an array of appointment types.
|
|
105
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
106
|
+
* @returns {Promise<AppointmentType[]>} A promise that resolves to an array of appointment types.
|
|
107
107
|
*/
|
|
108
108
|
getAppointmentTypes() {
|
|
109
109
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -113,8 +113,8 @@ class TimeZestAPI {
|
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Fetches a scheduling request by its ID.
|
|
116
|
-
* @param id - The ID of the scheduling request.
|
|
117
|
-
* @returns A promise that resolves to the scheduling request.
|
|
116
|
+
* @param {string} id - The ID of the scheduling request to fetch.
|
|
117
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the scheduling request.
|
|
118
118
|
*/
|
|
119
119
|
getSchedulingRequest(id) {
|
|
120
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -124,8 +124,8 @@ class TimeZestAPI {
|
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
* Fetches scheduling requests from the TimeZest API.
|
|
127
|
-
* @param filter - Optional filter string to narrow down results.
|
|
128
|
-
* @returns A promise that resolves to an array of scheduling requests.
|
|
127
|
+
* @param {string | null} [filter=null] - Optional filter string to narrow down results.
|
|
128
|
+
* @returns {Promise<SchedulingRequest[]>} A promise that resolves to an array of scheduling requests.
|
|
129
129
|
*/
|
|
130
130
|
getSchedulingRequests() {
|
|
131
131
|
return __awaiter(this, arguments, void 0, function* (filter = null) {
|
|
@@ -134,9 +134,9 @@ class TimeZestAPI {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
|
-
* Creates a new scheduling request.
|
|
138
|
-
* @param data - The data for the scheduling request.
|
|
139
|
-
* @returns A promise that resolves to the created scheduling request.
|
|
137
|
+
* Creates a new scheduling request in the TimeZest API.
|
|
138
|
+
* @param {SchedulingRequestPost} data - The data for the new scheduling request.
|
|
139
|
+
* @returns {Promise<SchedulingRequest>} A promise that resolves to the created scheduling request.
|
|
140
140
|
*/
|
|
141
141
|
createSchedulingRequest(data) {
|
|
142
142
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -145,10 +145,10 @@ class TimeZestAPI {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
* Validates API responses using Zod schemas if outputValidation is enabled.
|
|
149
|
-
* @param response - The API response data to validate.
|
|
150
|
-
* @param schema - The Zod schema to validate against.
|
|
151
|
-
* @returns The validated or raw response data.
|
|
148
|
+
* Validates API responses using Zod schemas if outputValidation is enabled in the config.
|
|
149
|
+
* @param {T[]} response - The API response data to validate.
|
|
150
|
+
* @param {ZodSchema} schema - The Zod schema to validate against.
|
|
151
|
+
* @returns {T[]} The validated or raw response data.
|
|
152
152
|
*/
|
|
153
153
|
validateResponse(response, schema) {
|
|
154
154
|
if (this.config.outputValidation) {
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAUA,gDAM4B;AAC5B,4CAAyC;AACzC,qDAAkD;AAClD,qDAAsD;A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