timezest 1.1.5 → 2.0.1
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/README.md +32 -16
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -9,6 +9,7 @@ This Node.js module provides a convenient and fully-typed interface for interact
|
|
|
9
9
|
- Automatic handling of paginated responses.
|
|
10
10
|
- Built-in support for request retries
|
|
11
11
|
- Fully typed with TypeScript for enhanced developer experience.
|
|
12
|
+
- Fluent, type-safe TQL filter builder for constructing filters programmatically.
|
|
12
13
|
|
|
13
14
|
## Installation
|
|
14
15
|
|
|
@@ -78,16 +79,16 @@ The `TimeZestAPI` supports the following methods for interacting with the TimeZe
|
|
|
78
79
|
|
|
79
80
|
```typescript
|
|
80
81
|
// Retrieve all agents
|
|
81
|
-
timeZest.getAgents(filter: string | null = null): Promise<Agent[]>
|
|
82
|
+
timeZest.getAgents(filter: TQLFilter | string | null = null): Promise<Agent[]>
|
|
82
83
|
|
|
83
84
|
// Retrieve all appointment types
|
|
84
|
-
timeZest.getAppointmentTypes(filter: string | null = null): Promise<AppointmentType[]>
|
|
85
|
+
timeZest.getAppointmentTypes(filter: TQLFilter | string | null = null): Promise<AppointmentType[]>
|
|
85
86
|
|
|
86
87
|
// Retrieve all resources
|
|
87
|
-
timeZest.getResources(filter: string | null = null): Promise<Resource[]>
|
|
88
|
+
timeZest.getResources(filter: TQLFilter | string | null = null): Promise<Resource[]>
|
|
88
89
|
|
|
89
90
|
// Retreive all scheduling reuests
|
|
90
|
-
timeZest.getSchedulingRequests(filter: string | null = null): Promise<SchedulingRequest[]>
|
|
91
|
+
timeZest.getSchedulingRequests(filter: TQLFilter | string | null = null): Promise<SchedulingRequest[]>
|
|
91
92
|
|
|
92
93
|
// Retrieve a scheduling request by id
|
|
93
94
|
timeZest.getSchedulingRequest(id: string): Promise<SchedulingRequest>
|
|
@@ -96,26 +97,41 @@ timeZest.getSchedulingRequest(id: string): Promise<SchedulingRequest>
|
|
|
96
97
|
timeZest.createSchedulingRequest(data: SchedulingRequest): Promise<SchedulingRequest>
|
|
97
98
|
|
|
98
99
|
// Retrieve all teams
|
|
99
|
-
timeZest.getTeams(filter: string | null = null): Promise<Team[]>
|
|
100
|
+
timeZest.getTeams(filter: TQLFilter | string | null = null): Promise<Team[]>
|
|
100
101
|
```
|
|
101
102
|
|
|
102
|
-
### Filtering Requests
|
|
103
|
+
### Filtering Requests (TQL)
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
You can filter results using TQL in two ways:
|
|
106
|
+
|
|
107
|
+
- Using the fluent, type-safe TQL builder (recommended)
|
|
108
|
+
- Passing a raw TQL string
|
|
109
|
+
|
|
110
|
+
Both styles are supported by all list methods.
|
|
105
111
|
|
|
106
112
|
```typescript
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
import TimeZestAPI, { TQL } from "timezest";
|
|
114
|
+
|
|
115
|
+
const timeZest = new TimeZestAPI("your-api-key");
|
|
116
|
+
|
|
117
|
+
// 1) Type-safe builder with autocomplete
|
|
118
|
+
const teams = await timeZest.getTeams(
|
|
119
|
+
TQL.forTeams().filter("internal_name").eq("Tier1")
|
|
120
|
+
);
|
|
115
121
|
|
|
116
|
-
|
|
122
|
+
// You can also chain logical operators
|
|
123
|
+
const scheduledRequests = await timeZest.getSchedulingRequests(
|
|
124
|
+
TQL.forSchedulingRequests()
|
|
125
|
+
.filter("status").eq("scheduled")
|
|
126
|
+
.and("end_user_email").like("@example.com")
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
// 2) Raw TQL string
|
|
130
|
+
const teamsByString = await timeZest.getTeams("team.internal_name EQ Tier1");
|
|
117
131
|
```
|
|
118
132
|
|
|
133
|
+
For more about TQL syntax, see the TimeZest TQL documentation: `https://developer.timezest.com/tql/`.
|
|
134
|
+
|
|
119
135
|
### Paginated Requests
|
|
120
136
|
|
|
121
137
|
For endpoints that return paginated data, the library automatically handles pagination:
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "timezest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"files": [
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"README.md",
|
|
8
|
+
"LICENSE"
|
|
9
|
+
],
|
|
6
10
|
"scripts": {
|
|
7
11
|
"build": "tsc",
|
|
8
12
|
"format": "prettier --write .",
|