Gathering detailed insights and metrics for timezest
Gathering detailed insights and metrics for timezest
Gathering detailed insights and metrics for timezest
Gathering detailed insights and metrics for timezest
npm install timezest
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
17 Commits
1 Watchers
1 Branches
2 Contributors
Updated on May 26, 2025
Latest Version
1.1.3
Package Id
timezest@1.1.3
Unpacked Size
63.56 kB
Size
14.30 kB
File Count
30
NPM Version
10.9.2
Node Version
23.11.0
Published on
May 26, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
This Node.js module provides a convenient and fully-typed interface for interacting with the TimeZest API. It abstracts away the complexities of making HTTP requests, handling pagination, and managing API configurations, allowing developers to focus on building their applications.
Install the module using npm:
1npm install timezest
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:
1import TimeZestAPI from "./index"; 2 3const apiKey = "your-api-key"; 4 5const timeZest = new TimeZestAPI(apiKey);
1async function fetchAgents() { 2 try { 3 const agents = await timeZest.getAgents(); 4 console.log("Agents:", agents); 5 } catch (error) { 6 console.error("Error fetching agents:", error); 7 } 8} 9 10fetchAgents();
1async function createSchedulingRequest() { 2 try { 3 const request = await timeZest.createSchedulingRequest({ 4 appointment_type_id: "12345", 5 end_user_email: "user@example.com", 6 end_user_name: "John Doe", 7 resources: [], 8 scheduled_agents: [], 9 selected_start_time: new Date().toISOString(), 10 selected_time_zone: "UTC", 11 }); 12 console.log("Created Scheduling Request:", request); 13 } catch (error) { 14 console.error("Error creating scheduling request:", error); 15 } 16} 17 18createSchedulingRequest();
The TimeZestAPI
supports the following methods for interacting with the TimeZest public API:
1// Retrieve all agents 2timeZest.getAgents(filter: string | null = null): Promise<Agent[]> 3 4// Retrieve all appointment types 5timeZest.getAppointmentTypes(filter: string | null = null): Promise<AppointmentType[]> 6 7// Retrieve all resources 8timeZest.getResources(filter: string | null = null): Promise<Resource[]> 9 10// Retreive all scheduling reuests 11timeZest.getSchedulingRequests(filter: string | null = null): Promise<SchedulingRequest[]> 12 13// Retrieve a scheduling request by id 14timeZest.getSchedulingRequest(id: string): Promise<SchedulingRequest> 15 16// Create a scheduling request 17timeZest.createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest> 18 19// Retrieve all teams 20timeZest.getTeams(filter: string | null = null): Promise<Team[]>
Pass TQL statements into the request to filter your results
1async function fetchTier1Team() { 2 try { 3 const teams = await timeZest.getTeams("team.internal_name EQ Tier1"); 4 console.log("Teams:", teams); 5 } catch (error) { 6 console.error("Error fetching teams:", error); 7 } 8} 9 10fetchTier1Team();
For endpoints that return paginated data, the library automatically handles pagination:
1async function fetchAllResources() { 2 try { 3 const resources = await timeZest.getResources(); 4 console.log("Resources:", resources); 5 } catch (error) { 6 console.error("Error fetching resources:", error); 7 } 8} 9 10fetchAllResources();
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:
maxRetryTimeMs
: The maximum amount of time (in milliseconds) to spend retrying a request. Defaults to a reasonable value defined in the configuration.maxRetryDelayMs
: The maximum delay (in milliseconds) between retry attempts. This helps prevent excessive delays during retries.1const options = { 2 maxRetryTimeMs: 30000, // Retry for up to 30 seconds 3 maxRetryDelayMs: 2000, // Wait up to 2 seconds between retries 4}; 5 6const timeZest = new TimeZestAPI("your-api-key", options);
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.
This retry logic ensures that your application can gracefully handle temporary issues without requiring manual intervention.
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
.
You can also pass a custom logger by providing a logger
object with methods corresponding to the log levels (e.g., info
, error
, etc.).
Example:
1const customLogger = { 2 info: (message: string, data?: any) => { 3 /* custom implementation */ 4 }, 5 error: (message: string, data?: any) => { 6 /* custom implementation */ 7 }, 8 // ...other log levels 9}; 10 11const options = { 12 logger: customLogger, 13 logLevel: "info", 14}; 15 16const timeZest = new TimeZestAPI(apiKey, options); 17 18timeZest.log("info", "This is an informational message"); 19timeZest.log("error", "This is an error message");
For detailed API documentation, visit the TimeZest API Documentation.
This project is licensed under the MIT License. See the LICENSE file for details.
No vulnerabilities found.
No security vulnerabilities found.