timezest 1.0.7 → 1.0.8

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.
Files changed (37) hide show
  1. package/.env +1 -0
  2. package/dist/LICENSE +9 -0
  3. package/dist/README.md +196 -0
  4. package/dist/index.d.ts +85 -0
  5. package/{index.js → dist/index.js} +52 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/package.json +27 -0
  8. package/package.json +5 -1
  9. package/timezest-1.0.1.tgz +0 -0
  10. package/timezest-1.0.2.tgz +0 -0
  11. package/timezest-1.0.3.tgz +0 -0
  12. package/index.d.ts +0 -33
  13. package/index.js.map +0 -1
  14. /package/{config → dist/config}/config.d.ts +0 -0
  15. /package/{config → dist/config}/config.js +0 -0
  16. /package/{config → dist/config}/config.js.map +0 -0
  17. /package/{constants → dist/constants}/endpoints.d.ts +0 -0
  18. /package/{constants → dist/constants}/endpoints.js +0 -0
  19. /package/{constants → dist/constants}/endpoints.js.map +0 -0
  20. /package/{entities → dist/entities}/entities.d.ts +0 -0
  21. /package/{entities → dist/entities}/entities.js +0 -0
  22. /package/{entities → dist/entities}/entities.js.map +0 -0
  23. /package/{entities → dist/entities}/schemas.d.ts +0 -0
  24. /package/{entities → dist/entities}/schemas.js +0 -0
  25. /package/{entities → dist/entities}/schemas.js.map +0 -0
  26. /package/{utils → dist/utils}/handleError.d.ts +0 -0
  27. /package/{utils → dist/utils}/handleError.js +0 -0
  28. /package/{utils → dist/utils}/handleError.js.map +0 -0
  29. /package/{utils → dist/utils}/logger.d.ts +0 -0
  30. /package/{utils → dist/utils}/logger.js +0 -0
  31. /package/{utils → dist/utils}/logger.js.map +0 -0
  32. /package/{utils → dist/utils}/makePaginatedRequest.d.ts +0 -0
  33. /package/{utils → dist/utils}/makePaginatedRequest.js +0 -0
  34. /package/{utils → dist/utils}/makePaginatedRequest.js.map +0 -0
  35. /package/{utils → dist/utils}/makeRequest.d.ts +0 -0
  36. /package/{utils → dist/utils}/makeRequest.js +0 -0
  37. /package/{utils → dist/utils}/makeRequest.js.map +0 -0
package/.env ADDED
@@ -0,0 +1 @@
1
+ TIMEZEST_API_KEY=vrY7zjB222oYoJkehdl6s9SuItPXfLYE
package/dist/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 PNC IT
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/dist/README.md ADDED
@@ -0,0 +1,196 @@
1
+ # TimeZest Node.js Module
2
+
3
+ This Node.js module provides a convenient and fully-typed interface for interacting with the [TimeZest API](https://developer.timezest.com/). It abstracts away the complexities of making HTTP requests, handling pagination, and managing API configurations, allowing developers to focus on building their applications.
4
+
5
+ ## Features
6
+
7
+ - Simplified API interaction with the TimeZest API.
8
+ - Built-in support for logging and error handling.
9
+ - Automatic handling of paginated responses.
10
+ - Built-in support for request retries
11
+ - Fully typed with TypeScript for enhanced developer experience.
12
+
13
+ ## Installation
14
+
15
+ Install the module using npm:
16
+
17
+ ```bash
18
+ npm install timezest
19
+ ```
20
+
21
+ ## Getting Started
22
+
23
+ ### Authentication and Configuration
24
+
25
+ To use the TimeZest API, you need an API key. Generate one from your TimeZest account under the API Keys section. Use the `TimeZestAPI` class to configure and interact with the API:
26
+
27
+ ```typescript
28
+ import TimeZestAPI from "./index";
29
+
30
+ const apiKey = "your-api-key";
31
+
32
+ const timeZest = new TimeZestAPI(apiKey);
33
+ ```
34
+
35
+ ### Example Usage
36
+
37
+ #### Retrieve Agents
38
+
39
+ ```typescript
40
+ async function fetchAgents() {
41
+ try {
42
+ const agents = await timeZest.getAgents();
43
+ console.log("Agents:", agents);
44
+ } catch (error) {
45
+ console.error("Error fetching agents:", error);
46
+ }
47
+ }
48
+
49
+ fetchAgents();
50
+ ```
51
+
52
+ #### Create a Scheduling Request
53
+
54
+ ```typescript
55
+ async function createSchedulingRequest() {
56
+ try {
57
+ const request = await timeZest.createSchedulingRequest({
58
+ appointment_type_id: "12345",
59
+ end_user_email: "user@example.com",
60
+ end_user_name: "John Doe",
61
+ resources: [],
62
+ scheduled_agents: [],
63
+ selected_start_time: new Date().toISOString(),
64
+ selected_time_zone: "UTC",
65
+ });
66
+ console.log("Created Scheduling Request:", request);
67
+ } catch (error) {
68
+ console.error("Error creating scheduling request:", error);
69
+ }
70
+ }
71
+
72
+ createSchedulingRequest();
73
+ ```
74
+
75
+ ### Supported Endpoints
76
+
77
+ The `TimeZestAPI` supports the following methods for interacting with the TimeZest public API:
78
+
79
+ ```typescript
80
+ // Retrieve all agents
81
+ timeZest.getAgents(filter: string | null = null): Promise<Agent[]>
82
+
83
+ // Retrieve all appointment types
84
+ timeZest.getAppointmentTypes(filter: string | null = null): Promise<AppointmentType[]>
85
+
86
+ // Retrieve all resources
87
+ timeZest.getResources(filter: string | null = null): Promise<Resource[]>
88
+
89
+ // Retreive all scheduling reuests
90
+ timeZest.getSchedulingRequests(filter: string | null = null): Promise<SchedulingRequest[]>
91
+
92
+ // Retrieve a scheduling request by id
93
+ timeZest.getSchedulingRequest(id: string): Promise<SchedulingRequest>
94
+
95
+ // Create a scheduling request
96
+ timeZest.createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest>
97
+
98
+ // Retrieve all teams
99
+ timeZest.getTeams(filter: string | null = null): Promise<Team[]>
100
+ ```
101
+
102
+ ### Filtering Requests
103
+
104
+ Pass TQL statements into the request to filter your results
105
+
106
+ ```typescript
107
+ async function fetchTier1Team() {
108
+ try {
109
+ const teams = await timeZest.getTeams('team.internal_name EQ Tier1');
110
+ console.log("Teams:", teams);
111
+ } catch (error) {
112
+ console.error("Error fetching teams:", error);
113
+ }
114
+ }
115
+
116
+ fetchTier1Team();
117
+ ```
118
+
119
+ ### Paginated Requests
120
+
121
+ For endpoints that return paginated data, the library automatically handles pagination:
122
+
123
+ ```typescript
124
+ async function fetchAllResources() {
125
+ try {
126
+ const resources = await timeZest.getResources();
127
+ console.log("Resources:", resources);
128
+ } catch (error) {
129
+ console.error("Error fetching resources:", error);
130
+ }
131
+ }
132
+
133
+ fetchAllResources();
134
+ ```
135
+
136
+ ## Retry Logic
137
+
138
+ The `TimeZestAPI` class includes built-in retry logic for handling transient errors, such as network issues or rate-limiting responses from the TimeZest API. You can configure the retry behavior using the following options when initializing the class:
139
+
140
+ - **`maxRetryTimeMs`**: The maximum amount of time (in milliseconds) to spend retrying a request. Defaults to a reasonable value defined in the configuration.
141
+ - **`maxRetryDelayMs`**: The maximum delay (in milliseconds) between retry attempts. This helps prevent excessive delays during retries.
142
+
143
+ ### Example Configuration
144
+
145
+ ```typescript
146
+ const options = {
147
+ maxRetryTimeMs: 30000, // Retry for up to 30 seconds
148
+ maxRetryDelayMs: 2000, // Wait up to 2 seconds between retries
149
+ };
150
+
151
+ const timeZest = new TimeZestAPI("your-api-key", options);
152
+ ```
153
+
154
+ ### How It Works
155
+
156
+ When a request fails due to a transient error (e.g., a 429 Too Many Requests response or a network timeout), the library will automatically retry the request until the `maxRetryTimeMs` limit is reached. The delay between retries is capped by `maxRetryDelayMs` and may increase with each attempt to avoid overwhelming the server.
157
+
158
+ This retry logic ensures that your application can gracefully handle temporary issues without requiring manual intervention.
159
+
160
+ ## Logging
161
+
162
+ The `TimeZestAPI` class includes built-in logging. By default, it uses `console` for logging. You can configure the log level using the `logLevel` option when initializing the class. Supported log levels include `silent`, `error`, `warn`, `info`, and `debug`.
163
+
164
+ You can also pass a custom logger by providing a `logger` object with methods corresponding to the log levels (e.g., `info`, `error`, etc.).
165
+
166
+ Example:
167
+
168
+ ```typescript
169
+ const customLogger = {
170
+ info: (message: string, data?: any) => {
171
+ /* custom implementation */
172
+ },
173
+ error: (message: string, data?: any) => {
174
+ /* custom implementation */
175
+ },
176
+ // ...other log levels
177
+ };
178
+
179
+ const options = {
180
+ logger: customLogger,
181
+ logLevel: "info",
182
+ };
183
+
184
+ const timeZest = new TimeZestAPI(apiKey, options);
185
+
186
+ timeZest.log("info", "This is an informational message");
187
+ timeZest.log("error", "This is an error message");
188
+ ```
189
+
190
+ ## Documentation
191
+
192
+ For detailed API documentation, visit the [TimeZest API Documentation](https://developer.timezest.com/).
193
+
194
+ ## License
195
+
196
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,85 @@
1
+ import { log, LogLevel, Logger } from "./utils/logger";
2
+ import { TimeZestAPIConfig } from "./config/config";
3
+ import { Agent, Resource, AppointmentType, SchedulingRequest, Team } from "./entities/entities";
4
+ /**
5
+ * Options for configuring the TimeZest API.
6
+ */
7
+ export interface TimeZestAPIOptions {
8
+ /** The log level for the API (e.g., 'info', 'debug'). */
9
+ logLevel?: LogLevel;
10
+ /** A custom logger implementation. */
11
+ logger?: Logger;
12
+ /** The base URL for the API. */
13
+ baseUrl?: string;
14
+ /** The maximum delay between retries, in milliseconds. */
15
+ maxRetryDelayMs?: number;
16
+ /** The maximum total retry time, in milliseconds. */
17
+ maxRetryTimeMs?: number;
18
+ }
19
+ /**
20
+ * Represents the TimeZest API client.
21
+ * Provides methods to interact with the TimeZest API.
22
+ */
23
+ export declare class TimeZestAPI {
24
+ private config;
25
+ private apiKey;
26
+ log: log;
27
+ /**
28
+ * Creates an instance of the TimeZestAPI client.
29
+ * @param apiKey - The API key for authenticating with the TimeZest API.
30
+ * @param options - Optional configuration options for the API client.
31
+ */
32
+ constructor(apiKey: string, options?: TimeZestAPIOptions);
33
+ /**
34
+ * Retrieves the API key used by the client.
35
+ * @returns The API key.
36
+ */
37
+ getApiKey(): string;
38
+ /**
39
+ * Retrieves the configuration of the API client.
40
+ * @returns The API client configuration.
41
+ */
42
+ getConfig(): TimeZestAPIConfig;
43
+ /**
44
+ * Fetches resources from the TimeZest API.
45
+ * @param filter - Optional filter string to narrow down results.
46
+ * @returns A promise that resolves to an array of resources.
47
+ */
48
+ getResources: (filter?: string | null) => Promise<Resource[]>;
49
+ /**
50
+ * Fetches agents from the TimeZest API.
51
+ * @param filter - Optional filter string to narrow down results.
52
+ * @returns A promise that resolves to an array of agents.
53
+ */
54
+ getAgents(filter?: string | null): Promise<Agent[]>;
55
+ /**
56
+ * Fetches teams from the TimeZest API.
57
+ * @param filter - Optional filter string to narrow down results.
58
+ * @returns A promise that resolves to an array of teams.
59
+ */
60
+ getTeams(filter?: string | null): Promise<Team[]>;
61
+ /**
62
+ * Fetches appointment types from the TimeZest API.
63
+ * @param filter - Optional filter string to narrow down results.
64
+ * @returns A promise that resolves to an array of appointment types.
65
+ */
66
+ getAppointmentTypes(filter?: string | null): Promise<AppointmentType[]>;
67
+ /**
68
+ * Fetches a scheduling request by its ID.
69
+ * @param id - The ID of the scheduling request.
70
+ * @returns A promise that resolves to the scheduling request.
71
+ */
72
+ getSchedulingRequest(id: string): Promise<SchedulingRequest>;
73
+ /**
74
+ * Fetches scheduling requests from the TimeZest API.
75
+ * @param filter - Optional filter string to narrow down results.
76
+ * @returns A promise that resolves to an array of scheduling requests.
77
+ */
78
+ getSchedulingRequests(filter?: string | null): Promise<SchedulingRequest[]>;
79
+ /**
80
+ * Creates a new scheduling request.
81
+ * @param data - The data for the scheduling request.
82
+ * @returns A promise that resolves to the created scheduling request.
83
+ */
84
+ createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest>;
85
+ }
@@ -16,8 +16,22 @@ const makeRequest_1 = require("./utils/makeRequest");
16
16
  const endpoints_1 = require("./constants/endpoints");
17
17
  const logger_1 = require("./utils/logger");
18
18
  const makePaginatedRequest_1 = require("./utils/makePaginatedRequest");
19
+ /**
20
+ * Represents the TimeZest API client.
21
+ * Provides methods to interact with the TimeZest API.
22
+ */
19
23
  class TimeZestAPI {
24
+ /**
25
+ * Creates an instance of the TimeZestAPI client.
26
+ * @param apiKey - The API key for authenticating with the TimeZest API.
27
+ * @param options - Optional configuration options for the API client.
28
+ */
20
29
  constructor(apiKey, options) {
30
+ /**
31
+ * Fetches resources from the TimeZest API.
32
+ * @param filter - Optional filter string to narrow down results.
33
+ * @returns A promise that resolves to an array of resources.
34
+ */
21
35
  this.getResources = (...args_1) => __awaiter(this, [...args_1], void 0, function* (filter = null) {
22
36
  const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.RESOURCES, "GET", null, filter);
23
37
  return response.map((item) => schemas_1.ResourceSchema.parse(item));
@@ -43,42 +57,80 @@ class TimeZestAPI {
43
57
  this.getSchedulingRequest = (0, logger_1.withLogging)(this.getSchedulingRequest.bind(this), this, "getSchedulingRequest");
44
58
  this.createSchedulingRequest = (0, logger_1.withLogging)(this.createSchedulingRequest.bind(this), this, "createSchedulingRequest");
45
59
  }
60
+ /**
61
+ * Retrieves the API key used by the client.
62
+ * @returns The API key.
63
+ */
46
64
  getApiKey() {
47
65
  return this.apiKey;
48
66
  }
67
+ /**
68
+ * Retrieves the configuration of the API client.
69
+ * @returns The API client configuration.
70
+ */
49
71
  getConfig() {
50
72
  return this.config;
51
73
  }
74
+ /**
75
+ * Fetches agents from the TimeZest API.
76
+ * @param filter - Optional filter string to narrow down results.
77
+ * @returns A promise that resolves to an array of agents.
78
+ */
52
79
  getAgents() {
53
80
  return __awaiter(this, arguments, void 0, function* (filter = null) {
54
81
  const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.AGENTS, "GET", null, filter);
55
82
  return response.map((item) => schemas_1.AgentSchema.parse(item));
56
83
  });
57
84
  }
85
+ /**
86
+ * Fetches teams from the TimeZest API.
87
+ * @param filter - Optional filter string to narrow down results.
88
+ * @returns A promise that resolves to an array of teams.
89
+ */
58
90
  getTeams() {
59
91
  return __awaiter(this, arguments, void 0, function* (filter = null) {
60
92
  const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.TEAMS, "GET", null, filter);
61
93
  return response.map((item) => schemas_1.TeamSchema.parse(item));
62
94
  });
63
95
  }
96
+ /**
97
+ * Fetches appointment types from the TimeZest API.
98
+ * @param filter - Optional filter string to narrow down results.
99
+ * @returns A promise that resolves to an array of appointment types.
100
+ */
64
101
  getAppointmentTypes() {
65
102
  return __awaiter(this, arguments, void 0, function* (filter = null) {
66
103
  const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.APPOINTMENT_TYPES, "GET", null, filter);
67
104
  return response.map((item) => schemas_1.AppointmentTypeSchema.parse(item));
68
105
  });
69
106
  }
107
+ /**
108
+ * Fetches a scheduling request by its ID.
109
+ * @param id - The ID of the scheduling request.
110
+ * @returns A promise that resolves to the scheduling request.
111
+ */
70
112
  getSchedulingRequest(id) {
71
113
  return __awaiter(this, void 0, void 0, function* () {
72
114
  const response = yield (0, makeRequest_1.makeRequest)(this.log, this.apiKey, this.config.baseUrl, `${endpoints_1.API_ENDPOINTS.SCHEDULING_REQUESTS}/${id}`, "GET", null, this.config.maxRetryTimeMs, this.config.maxRetryDelayMs);
73
115
  return schemas_1.SchedulingRequestSchema.parse(response);
74
116
  });
75
117
  }
118
+ /**
119
+ * Fetches scheduling requests from the TimeZest API.
120
+ * @param filter - Optional filter string to narrow down results.
121
+ * @returns A promise that resolves to an array of scheduling requests.
122
+ */
76
123
  getSchedulingRequests() {
77
124
  return __awaiter(this, arguments, void 0, function* (filter = null) {
78
125
  const response = yield (0, makePaginatedRequest_1.makePaginatedRequest)(this, endpoints_1.API_ENDPOINTS.SCHEDULING_REQUESTS, "GET", null, filter);
79
126
  return response.map((item) => schemas_1.SchedulingRequestSchema.parse(item));
80
127
  });
81
128
  }
129
+ /**
130
+ * Creates a new scheduling request.
131
+ * @param data - The data for the scheduling request.
132
+ * @returns A promise that resolves to the created scheduling request.
133
+ */
82
134
  createSchedulingRequest(data) {
83
135
  return __awaiter(this, void 0, void 0, function* () {
84
136
  const response = yield (0, makeRequest_1.makeRequest)(this.log, this.apiKey, this.config.baseUrl, endpoints_1.API_ENDPOINTS.SCHEDULING_REQUESTS, "POST", data, this.config.maxRetryTimeMs, this.config.maxRetryDelayMs);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,gDAM4B;AAC5B,4CAAyC;AACzC,qDAAkD;AAClD,qDAAsD;AACtD,2CAA0D;AAC1D,uEAAoE;AAsBpE;;;GAGG;AACH,MAAa,WAAW;IAKtB;;;;OAIG;IACH,YAAY,MAAc,EAAE,OAA4B;QA4DxD;;;;WAIG;QACH,iBAAY,GAAG,YAA0D,EAAE,iDAArD,SAAwB,IAAI;YAChD,MAAM,QAAQ,GAAG,MAAM,IAAA,2CAAoB,EACzC,IAAI,EACJ,yBAAa,CAAC,SAAS,EACvB,KAAK,EACL,IAAI,EACJ,MAAM,CACP,CAAC;YACF,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAA,CAAC;QAzEA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG;YACZ,QAAQ,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,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AAI,CAAC,MAAM,CAAC,eAAe,CAC5B,CAAC;YACF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF;AAjMD,kCAiMC"}
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "timezest",
3
+ "version": "1.0.7",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "build": "tsc",
7
+ "test": "node dist/src/tests/test.js",
8
+ "format": "prettier --write .",
9
+ "clean": "if exist dist rmdir /s /q dist",
10
+ "prep-publish": "npm run clean && npm run build && copy package.json dist\\package.json && copy README.md dist\\README.md && copy LICENSE dist\\LICENSE",
11
+ "publish": "npm run prep-publish && npm publish .\\dist"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "MIT",
16
+ "description": "",
17
+ "dependencies": {
18
+ "axios": "^1.9.0",
19
+ "dotenv": "^16.5.0",
20
+ "zod": "^3.24.3"
21
+ },
22
+ "devDependencies": {
23
+ "prettier": "^3.5.3",
24
+ "@types/node": "^22.15.3",
25
+ "typescript": "^5.8.3"
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "timezest",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build": "tsc",
@@ -23,5 +23,9 @@
23
23
  "prettier": "^3.5.3",
24
24
  "@types/node": "^22.15.3",
25
25
  "typescript": "^5.8.3"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/pncit/timezest.git"
26
30
  }
27
31
  }
Binary file
Binary file
Binary file
package/index.d.ts DELETED
@@ -1,33 +0,0 @@
1
- import { log, LogLevel, Logger } from "./utils/logger";
2
- import { TimeZestAPIConfig } from "./config/config";
3
- import { Agent, Resource, AppointmentType, SchedulingRequest, Team } from "./entities/entities";
4
- /**
5
- * Options for configuring the TimeZest API.
6
- */
7
- export interface TimeZestAPIOptions {
8
- /** The log level for the API (e.g., 'info', 'debug'). */
9
- logLevel?: LogLevel;
10
- /** A custom logger implementation. */
11
- logger?: Logger;
12
- /** The base URL for the API. */
13
- baseUrl?: string;
14
- /** The maximum delay between retries, in milliseconds. */
15
- maxRetryDelayMs?: number;
16
- /** The maximum total retry time, in milliseconds. */
17
- maxRetryTimeMs?: number;
18
- }
19
- export declare class TimeZestAPI {
20
- private config;
21
- private apiKey;
22
- log: log;
23
- constructor(apiKey: string, options?: TimeZestAPIOptions);
24
- getApiKey(): string;
25
- getConfig(): TimeZestAPIConfig;
26
- getResources: (filter?: string | null) => Promise<Resource[]>;
27
- getAgents(filter?: string | null): Promise<Agent[]>;
28
- getTeams(filter?: string | null): Promise<Team[]>;
29
- getAppointmentTypes(filter?: string | null): Promise<AppointmentType[]>;
30
- getSchedulingRequest(id: string): Promise<SchedulingRequest>;
31
- getSchedulingRequests(filter?: string | null): Promise<SchedulingRequest[]>;
32
- createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest>;
33
- }
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,gDAM4B;AAC5B,4CAAyC;AACzC,qDAAkD;AAClD,qDAAsD;AACtD,2CAA0D;AAC1D,uEAAoE;AAsBpE,MAAa,WAAW;IAKtB,YAAY,MAAc,EAAE,OAA4B;QAoDxD,iBAAY,GAAG,YAA0D,EAAE,iDAArD,SAAwB,IAAI;YAChD,MAAM,QAAQ,GAAG,MAAM,IAAA,2CAAoB,EACzC,IAAI,EACJ,yBAAa,CAAC,SAAS,EACvB,KAAK,EACL,IAAI,EACJ,MAAM,CACP,CAAC;YACF,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,wBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,CAAC,CAAA,CAAC;QA5DA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG;Y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OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF;AAjJD,kCAiJC"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes