@getclarify/nodejs-sdk 0.0.2 → 0.0.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/dist/cjs/client.d.ts +0 -5
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +0 -5
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/index.d.ts.map +1 -1
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/esm/client.d.ts +0 -5
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +0 -5
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/types/index.d.ts +1 -1
- package/dist/esm/types/index.d.ts.map +1 -1
- package/dist/esm/types/index.js.map +1 -1
- package/dist/types/client.d.ts +0 -5
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/dist/cjs/resources/messages.d.ts +0 -105
- package/dist/cjs/resources/messages.d.ts.map +0 -1
- package/dist/cjs/resources/messages.js +0 -166
- package/dist/cjs/resources/messages.js.map +0 -1
- package/dist/cjs/resources/relationships.d.ts +0 -96
- package/dist/cjs/resources/relationships.d.ts.map +0 -1
- package/dist/cjs/resources/relationships.js +0 -157
- package/dist/cjs/resources/relationships.js.map +0 -1
- package/dist/cjs/resources/tasks.d.ts +0 -141
- package/dist/cjs/resources/tasks.d.ts.map +0 -1
- package/dist/cjs/resources/tasks.js +0 -211
- package/dist/cjs/resources/tasks.js.map +0 -1
- package/dist/esm/resources/messages.d.ts +0 -105
- package/dist/esm/resources/messages.d.ts.map +0 -1
- package/dist/esm/resources/messages.js +0 -166
- package/dist/esm/resources/messages.js.map +0 -1
- package/dist/esm/resources/relationships.d.ts +0 -96
- package/dist/esm/resources/relationships.d.ts.map +0 -1
- package/dist/esm/resources/relationships.js +0 -157
- package/dist/esm/resources/relationships.js.map +0 -1
- package/dist/esm/resources/tasks.d.ts +0 -141
- package/dist/esm/resources/tasks.d.ts.map +0 -1
- package/dist/esm/resources/tasks.js +0 -211
- package/dist/esm/resources/tasks.js.map +0 -1
- package/dist/types/resources/messages.d.ts +0 -105
- package/dist/types/resources/messages.d.ts.map +0 -1
- package/dist/types/resources/relationships.d.ts +0 -96
- package/dist/types/resources/relationships.d.ts.map +0 -1
- package/dist/types/resources/tasks.d.ts +0 -141
- package/dist/types/resources/tasks.d.ts.map +0 -1
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RelationshipsResource = void 0;
|
|
4
|
-
const base_resource_js_1 = require("./base-resource.js");
|
|
5
|
-
/**
|
|
6
|
-
* Manages relationships between records.
|
|
7
|
-
*/
|
|
8
|
-
class RelationshipsResource extends base_resource_js_1.BaseResource {
|
|
9
|
-
constructor(httpClient, config) {
|
|
10
|
-
super(httpClient, config);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Lists related records for a given record and relationship.
|
|
14
|
-
*
|
|
15
|
-
* @param entity - The entity type of the source record
|
|
16
|
-
* @param recordId - The ID of the source record
|
|
17
|
-
* @param relationship - The name of the relationship
|
|
18
|
-
* @param options - Pagination and filter options
|
|
19
|
-
* @returns Paginated list of related records
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```typescript
|
|
23
|
-
* const people = await clarify.records.relationships.list('company', 'company-id', 'people');
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
async list(entity, recordId, relationship, options) {
|
|
27
|
-
const query = this.buildListQuery(options);
|
|
28
|
-
return this.httpClient.request({
|
|
29
|
-
method: 'GET',
|
|
30
|
-
path: `${this.basePath}/records/${entity}/${recordId}/relationships/${relationship}`,
|
|
31
|
-
query,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Adds relationships between a source record and target records.
|
|
36
|
-
*
|
|
37
|
-
* @param entity - The entity type of the source record
|
|
38
|
-
* @param recordId - The ID of the source record
|
|
39
|
-
* @param relationship - The name of the relationship
|
|
40
|
-
* @param targets - Array of resource identifiers to add
|
|
41
|
-
* @returns The updated list of related records
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* await clarify.records.relationships.add('company', 'company-id', 'people', [
|
|
46
|
-
* { type: 'person', id: 'person-id-1' },
|
|
47
|
-
* { type: 'person', id: 'person-id-2' },
|
|
48
|
-
* ]);
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
async add(entity, recordId, relationship, targets) {
|
|
52
|
-
const body = { data: targets };
|
|
53
|
-
return this.httpClient.request({
|
|
54
|
-
method: 'POST',
|
|
55
|
-
path: `${this.basePath}/records/${entity}/${recordId}/relationships/${relationship}`,
|
|
56
|
-
body,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Removes relationships between a source record and target records.
|
|
61
|
-
*
|
|
62
|
-
* @param entity - The entity type of the source record
|
|
63
|
-
* @param recordId - The ID of the source record
|
|
64
|
-
* @param relationship - The name of the relationship
|
|
65
|
-
* @param targets - Array of resource identifiers to remove
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```typescript
|
|
69
|
-
* await clarify.records.relationships.remove('company', 'company-id', 'people', [
|
|
70
|
-
* { type: 'person', id: 'person-id-1' },
|
|
71
|
-
* ]);
|
|
72
|
-
* ```
|
|
73
|
-
*/
|
|
74
|
-
async remove(entity, recordId, relationship, targets) {
|
|
75
|
-
const body = { data: targets };
|
|
76
|
-
await this.httpClient.request({
|
|
77
|
-
method: 'DELETE',
|
|
78
|
-
path: `${this.basePath}/records/${entity}/${recordId}/relationships/${relationship}`,
|
|
79
|
-
body,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Async iterator for paginating through all related records.
|
|
84
|
-
*
|
|
85
|
-
* @param entity - The entity type of the source record
|
|
86
|
-
* @param recordId - The ID of the source record
|
|
87
|
-
* @param relationship - The name of the relationship
|
|
88
|
-
* @param options - Filter and sort options (pagination is handled automatically)
|
|
89
|
-
* @yields Individual related records
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```typescript
|
|
93
|
-
* for await (const person of clarify.records.relationships.iterate('company', 'company-id', 'people')) {
|
|
94
|
-
* console.log(person.attributes.name);
|
|
95
|
-
* }
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
async *iterate(entity, recordId, relationship, options) {
|
|
99
|
-
let cursor;
|
|
100
|
-
do {
|
|
101
|
-
const response = await this.list(entity, recordId, relationship, {
|
|
102
|
-
...options,
|
|
103
|
-
page: { cursor, limit: 100 },
|
|
104
|
-
});
|
|
105
|
-
for (const record of response.data) {
|
|
106
|
-
yield record;
|
|
107
|
-
}
|
|
108
|
-
// Extract cursor from next link if available
|
|
109
|
-
cursor = this.extractCursor(response.links?.next);
|
|
110
|
-
} while (cursor);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Builds query parameters from list options.
|
|
114
|
-
*/
|
|
115
|
-
buildListQuery(options) {
|
|
116
|
-
const query = {};
|
|
117
|
-
if (options?.page?.cursor) {
|
|
118
|
-
query['page[cursor]'] = options.page.cursor;
|
|
119
|
-
}
|
|
120
|
-
if (options?.page?.limit) {
|
|
121
|
-
query['page[limit]'] = options.page.limit;
|
|
122
|
-
}
|
|
123
|
-
if (options?.filter) {
|
|
124
|
-
for (const [key, value] of Object.entries(options.filter)) {
|
|
125
|
-
if (value !== undefined) {
|
|
126
|
-
query[`filter[${key}]`] = Array.isArray(value)
|
|
127
|
-
? value.join(',')
|
|
128
|
-
: String(value);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
if (options?.sort) {
|
|
133
|
-
const sorts = Array.isArray(options.sort) ? options.sort : [options.sort];
|
|
134
|
-
query['sort'] = sorts
|
|
135
|
-
.map((s) => (s.direction === 'desc' ? `-${s.field}` : s.field))
|
|
136
|
-
.join(',');
|
|
137
|
-
}
|
|
138
|
-
return query;
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Extracts the cursor from a pagination URL.
|
|
142
|
-
*/
|
|
143
|
-
extractCursor(url) {
|
|
144
|
-
if (!url) {
|
|
145
|
-
return undefined;
|
|
146
|
-
}
|
|
147
|
-
try {
|
|
148
|
-
const parsedUrl = new URL(url);
|
|
149
|
-
return parsedUrl.searchParams.get('page[cursor]') ?? undefined;
|
|
150
|
-
}
|
|
151
|
-
catch {
|
|
152
|
-
return undefined;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.RelationshipsResource = RelationshipsResource;
|
|
157
|
-
//# sourceMappingURL=relationships.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relationships.js","sourceRoot":"","sources":["../../../src/resources/relationships.ts"],"names":[],"mappings":";;;AAQA,yDAAkD;AAgBlD;;GAEG;AACH,MAAa,qBAAsB,SAAQ,+BAAY;IACrD,YAAY,UAAsB,EAAE,MAAsB;QACxD,KAAK,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI,CACR,MAAc,EACd,QAAgB,EAChB,YAAoB,EACpB,OAAqB;QAErB,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QAE3C,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAkB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,GAAG,IAAI,CAAC,QAAQ,YAAY,MAAM,IAAI,QAAQ,kBAAkB,YAAY,EAAE;YACpF,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,KAAK,CAAC,GAAG,CACP,MAAc,EACd,QAAgB,EA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GAAG,CAAC,CAAC;QACf,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,GAAY;QAChC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;YAC/B,OAAO,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC;QACjE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AAzLD,sDAyLC"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
-
import type { ListOptions, ListResponse, ResolvedConfig, Resource, ResourceCreate, ResourceUpdate, SingleResponse } from '../types/index.js';
|
|
3
|
-
import { BaseResource } from './base-resource.js';
|
|
4
|
-
/**
|
|
5
|
-
* Task status values.
|
|
6
|
-
*/
|
|
7
|
-
export declare enum TaskStatus {
|
|
8
|
-
Pending = "pending",
|
|
9
|
-
InProgress = "in_progress",
|
|
10
|
-
Completed = "completed",
|
|
11
|
-
Cancelled = "cancelled"
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Task priority values.
|
|
15
|
-
*/
|
|
16
|
-
export declare enum TaskPriority {
|
|
17
|
-
Low = "low",
|
|
18
|
-
Medium = "medium",
|
|
19
|
-
High = "high",
|
|
20
|
-
Urgent = "urgent"
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Task attributes.
|
|
24
|
-
*/
|
|
25
|
-
export interface TaskAttributes {
|
|
26
|
-
title?: string;
|
|
27
|
-
description?: string;
|
|
28
|
-
status?: TaskStatus;
|
|
29
|
-
priority?: TaskPriority;
|
|
30
|
-
due_date?: string;
|
|
31
|
-
assignee_id?: string;
|
|
32
|
-
record_id?: string;
|
|
33
|
-
record_type?: string;
|
|
34
|
-
[key: string]: unknown;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Manages tasks in the Clarify platform.
|
|
38
|
-
*/
|
|
39
|
-
export declare class TasksResource extends BaseResource {
|
|
40
|
-
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
41
|
-
/**
|
|
42
|
-
* Lists tasks.
|
|
43
|
-
*
|
|
44
|
-
* @param options - Pagination, filter, and sort options
|
|
45
|
-
* @returns Paginated list of tasks
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* const tasks = await clarify.tasks.list({
|
|
50
|
-
* page: { limit: 20 },
|
|
51
|
-
* filter: { status: 'pending', assignee_id: 'user-id' },
|
|
52
|
-
* });
|
|
53
|
-
* ```
|
|
54
|
-
*/
|
|
55
|
-
list<T extends TaskAttributes = TaskAttributes>(options?: ListOptions): Promise<ListResponse<T>>;
|
|
56
|
-
/**
|
|
57
|
-
* Gets a single task by ID.
|
|
58
|
-
*
|
|
59
|
-
* @param id - The task ID
|
|
60
|
-
* @returns The task
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* const task = await clarify.tasks.get('task-id');
|
|
65
|
-
* console.log(task.data.attributes.title);
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
get<T extends TaskAttributes = TaskAttributes>(id: string): Promise<SingleResponse<T>>;
|
|
69
|
-
/**
|
|
70
|
-
* Creates a new task.
|
|
71
|
-
*
|
|
72
|
-
* @param data - The task data to create
|
|
73
|
-
* @returns The created task
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* const task = await clarify.tasks.create({
|
|
78
|
-
* type: 'task',
|
|
79
|
-
* attributes: {
|
|
80
|
-
* title: 'Follow up with client',
|
|
81
|
-
* description: 'Schedule a demo call',
|
|
82
|
-
* status: TaskStatus.Pending,
|
|
83
|
-
* priority: TaskPriority.High,
|
|
84
|
-
* due_date: '2024-12-31',
|
|
85
|
-
* },
|
|
86
|
-
* });
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
create<T extends TaskAttributes = TaskAttributes>(data: ResourceCreate<T>): Promise<SingleResponse<T>>;
|
|
90
|
-
/**
|
|
91
|
-
* Updates an existing task.
|
|
92
|
-
*
|
|
93
|
-
* @param id - The task ID
|
|
94
|
-
* @param data - The task data to update
|
|
95
|
-
* @returns The updated task
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```typescript
|
|
99
|
-
* const task = await clarify.tasks.update('task-id', {
|
|
100
|
-
* type: 'task',
|
|
101
|
-
* id: 'task-id',
|
|
102
|
-
* attributes: { status: TaskStatus.Completed },
|
|
103
|
-
* });
|
|
104
|
-
* ```
|
|
105
|
-
*/
|
|
106
|
-
update<T extends TaskAttributes = TaskAttributes>(id: string, data: ResourceUpdate<T>): Promise<SingleResponse<T>>;
|
|
107
|
-
/**
|
|
108
|
-
* Deletes a task.
|
|
109
|
-
*
|
|
110
|
-
* @param id - The task ID
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* ```typescript
|
|
114
|
-
* await clarify.tasks.delete('task-id');
|
|
115
|
-
* ```
|
|
116
|
-
*/
|
|
117
|
-
delete(id: string): Promise<void>;
|
|
118
|
-
/**
|
|
119
|
-
* Async iterator for paginating through all tasks.
|
|
120
|
-
*
|
|
121
|
-
* @param options - Filter and sort options (pagination is handled automatically)
|
|
122
|
-
* @yields Individual tasks
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* for await (const task of clarify.tasks.iterate({ filter: { status: 'pending' } })) {
|
|
127
|
-
* console.log(task.attributes.title);
|
|
128
|
-
* }
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
iterate<T extends TaskAttributes = TaskAttributes>(options?: Omit<ListOptions, 'page'>): AsyncGenerator<Resource<T>, void, undefined>;
|
|
132
|
-
/**
|
|
133
|
-
* Builds query parameters from list options.
|
|
134
|
-
*/
|
|
135
|
-
private buildListQuery;
|
|
136
|
-
/**
|
|
137
|
-
* Extracts the cursor from a pagination URL.
|
|
138
|
-
*/
|
|
139
|
-
private extractCursor;
|
|
140
|
-
}
|
|
141
|
-
//# sourceMappingURL=tasks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../../src/resources/tasks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,EACd,cAAc,EAEf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,UAAU,gBAAgB;IAC1B,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D;;;;;;;;;;;;;OAaG;IACG,IAAI,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EAClD,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAU3B;;;;;;;;;;;OAWG;IACG,GAAG,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACjD,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAO7B;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACpD,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAU7B;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACpD,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,GACtB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;IAU7B;;;;;;;;;OASG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOvC;;;;;;;;;;;;OAYG;IACI,OAAO,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,EACtD,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAClC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC;IAiB/C;;OAEG;IACH,OAAO,CAAC,cAAc;IAgCtB;;OAEG;IACH,OAAO,CAAC,aAAa;CAYtB"}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TasksResource = exports.TaskPriority = exports.TaskStatus = void 0;
|
|
4
|
-
const base_resource_js_1 = require("./base-resource.js");
|
|
5
|
-
/**
|
|
6
|
-
* Task status values.
|
|
7
|
-
*/
|
|
8
|
-
var TaskStatus;
|
|
9
|
-
(function (TaskStatus) {
|
|
10
|
-
TaskStatus["Pending"] = "pending";
|
|
11
|
-
TaskStatus["InProgress"] = "in_progress";
|
|
12
|
-
TaskStatus["Completed"] = "completed";
|
|
13
|
-
TaskStatus["Cancelled"] = "cancelled";
|
|
14
|
-
})(TaskStatus || (exports.TaskStatus = TaskStatus = {}));
|
|
15
|
-
/**
|
|
16
|
-
* Task priority values.
|
|
17
|
-
*/
|
|
18
|
-
var TaskPriority;
|
|
19
|
-
(function (TaskPriority) {
|
|
20
|
-
TaskPriority["Low"] = "low";
|
|
21
|
-
TaskPriority["Medium"] = "medium";
|
|
22
|
-
TaskPriority["High"] = "high";
|
|
23
|
-
TaskPriority["Urgent"] = "urgent";
|
|
24
|
-
})(TaskPriority || (exports.TaskPriority = TaskPriority = {}));
|
|
25
|
-
/**
|
|
26
|
-
* Manages tasks in the Clarify platform.
|
|
27
|
-
*/
|
|
28
|
-
class TasksResource extends base_resource_js_1.BaseResource {
|
|
29
|
-
constructor(httpClient, config) {
|
|
30
|
-
super(httpClient, config);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Lists tasks.
|
|
34
|
-
*
|
|
35
|
-
* @param options - Pagination, filter, and sort options
|
|
36
|
-
* @returns Paginated list of tasks
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```typescript
|
|
40
|
-
* const tasks = await clarify.tasks.list({
|
|
41
|
-
* page: { limit: 20 },
|
|
42
|
-
* filter: { status: 'pending', assignee_id: 'user-id' },
|
|
43
|
-
* });
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
async list(options) {
|
|
47
|
-
const query = this.buildListQuery(options);
|
|
48
|
-
return this.httpClient.request({
|
|
49
|
-
method: 'GET',
|
|
50
|
-
path: `${this.basePath}/tasks`,
|
|
51
|
-
query,
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Gets a single task by ID.
|
|
56
|
-
*
|
|
57
|
-
* @param id - The task ID
|
|
58
|
-
* @returns The task
|
|
59
|
-
*
|
|
60
|
-
* @example
|
|
61
|
-
* ```typescript
|
|
62
|
-
* const task = await clarify.tasks.get('task-id');
|
|
63
|
-
* console.log(task.data.attributes.title);
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
async get(id) {
|
|
67
|
-
return this.httpClient.request({
|
|
68
|
-
method: 'GET',
|
|
69
|
-
path: `${this.basePath}/tasks/${id}`,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Creates a new task.
|
|
74
|
-
*
|
|
75
|
-
* @param data - The task data to create
|
|
76
|
-
* @returns The created task
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```typescript
|
|
80
|
-
* const task = await clarify.tasks.create({
|
|
81
|
-
* type: 'task',
|
|
82
|
-
* attributes: {
|
|
83
|
-
* title: 'Follow up with client',
|
|
84
|
-
* description: 'Schedule a demo call',
|
|
85
|
-
* status: TaskStatus.Pending,
|
|
86
|
-
* priority: TaskPriority.High,
|
|
87
|
-
* due_date: '2024-12-31',
|
|
88
|
-
* },
|
|
89
|
-
* });
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
async create(data) {
|
|
93
|
-
const body = { data };
|
|
94
|
-
return this.httpClient.request({
|
|
95
|
-
method: 'POST',
|
|
96
|
-
path: `${this.basePath}/tasks`,
|
|
97
|
-
body,
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Updates an existing task.
|
|
102
|
-
*
|
|
103
|
-
* @param id - The task ID
|
|
104
|
-
* @param data - The task data to update
|
|
105
|
-
* @returns The updated task
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* ```typescript
|
|
109
|
-
* const task = await clarify.tasks.update('task-id', {
|
|
110
|
-
* type: 'task',
|
|
111
|
-
* id: 'task-id',
|
|
112
|
-
* attributes: { status: TaskStatus.Completed },
|
|
113
|
-
* });
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
async update(id, data) {
|
|
117
|
-
const body = { data };
|
|
118
|
-
return this.httpClient.request({
|
|
119
|
-
method: 'PATCH',
|
|
120
|
-
path: `${this.basePath}/tasks/${id}`,
|
|
121
|
-
body,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Deletes a task.
|
|
126
|
-
*
|
|
127
|
-
* @param id - The task ID
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* await clarify.tasks.delete('task-id');
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
async delete(id) {
|
|
135
|
-
await this.httpClient.request({
|
|
136
|
-
method: 'DELETE',
|
|
137
|
-
path: `${this.basePath}/tasks/${id}`,
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Async iterator for paginating through all tasks.
|
|
142
|
-
*
|
|
143
|
-
* @param options - Filter and sort options (pagination is handled automatically)
|
|
144
|
-
* @yields Individual tasks
|
|
145
|
-
*
|
|
146
|
-
* @example
|
|
147
|
-
* ```typescript
|
|
148
|
-
* for await (const task of clarify.tasks.iterate({ filter: { status: 'pending' } })) {
|
|
149
|
-
* console.log(task.attributes.title);
|
|
150
|
-
* }
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
async *iterate(options) {
|
|
154
|
-
let cursor;
|
|
155
|
-
do {
|
|
156
|
-
const response = await this.list({
|
|
157
|
-
...options,
|
|
158
|
-
page: { cursor, limit: 100 },
|
|
159
|
-
});
|
|
160
|
-
for (const task of response.data) {
|
|
161
|
-
yield task;
|
|
162
|
-
}
|
|
163
|
-
cursor = this.extractCursor(response.links?.next);
|
|
164
|
-
} while (cursor);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Builds query parameters from list options.
|
|
168
|
-
*/
|
|
169
|
-
buildListQuery(options) {
|
|
170
|
-
const query = {};
|
|
171
|
-
if (options?.page?.cursor) {
|
|
172
|
-
query['page[cursor]'] = options.page.cursor;
|
|
173
|
-
}
|
|
174
|
-
if (options?.page?.limit) {
|
|
175
|
-
query['page[limit]'] = options.page.limit;
|
|
176
|
-
}
|
|
177
|
-
if (options?.filter) {
|
|
178
|
-
for (const [key, value] of Object.entries(options.filter)) {
|
|
179
|
-
if (value !== undefined) {
|
|
180
|
-
query[`filter[${key}]`] = Array.isArray(value)
|
|
181
|
-
? value.join(',')
|
|
182
|
-
: String(value);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
if (options?.sort) {
|
|
187
|
-
const sorts = Array.isArray(options.sort) ? options.sort : [options.sort];
|
|
188
|
-
query['sort'] = sorts
|
|
189
|
-
.map((s) => (s.direction === 'desc' ? `-${s.field}` : s.field))
|
|
190
|
-
.join(',');
|
|
191
|
-
}
|
|
192
|
-
return query;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Extracts the cursor from a pagination URL.
|
|
196
|
-
*/
|
|
197
|
-
extractCursor(url) {
|
|
198
|
-
if (!url) {
|
|
199
|
-
return undefined;
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
const parsedUrl = new URL(url);
|
|
203
|
-
return parsedUrl.searchParams.get('page[cursor]') ?? undefined;
|
|
204
|
-
}
|
|
205
|
-
catch {
|
|
206
|
-
return undefined;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
exports.TasksResource = TasksResource;
|
|
211
|
-
//# sourceMappingURL=tasks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../../src/resources/tasks.ts"],"names":[],"mappings":";;;AAYA,yDAAkD;AAElD;;GAEG;AACH,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,iCAAmB,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B,OAAO,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,SAAS,CAAC;QACjE,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,SAAS,CAAC;QACnB,CAAC;IACH,CAAC;CACF;AApND,sCAoNC"}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { HttpClient } from '../http/http-client.js';
|
|
2
|
-
import type { ListOptions, ListResponse, ResolvedConfig, Resource, ResourceCreate, SingleResponse } from '../types/index.js';
|
|
3
|
-
import { BaseResource } from './base-resource.js';
|
|
4
|
-
/**
|
|
5
|
-
* Message attributes.
|
|
6
|
-
*/
|
|
7
|
-
export interface MessageAttributes {
|
|
8
|
-
subject?: string;
|
|
9
|
-
body?: string;
|
|
10
|
-
from?: string;
|
|
11
|
-
to?: string[];
|
|
12
|
-
cc?: string[];
|
|
13
|
-
bcc?: string[];
|
|
14
|
-
sent_at?: string;
|
|
15
|
-
received_at?: string;
|
|
16
|
-
[key: string]: unknown;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Manages messages in the Clarify platform.
|
|
20
|
-
*/
|
|
21
|
-
export declare class MessagesResource extends BaseResource {
|
|
22
|
-
constructor(httpClient: HttpClient, config: ResolvedConfig);
|
|
23
|
-
/**
|
|
24
|
-
* Lists messages.
|
|
25
|
-
*
|
|
26
|
-
* @param options - Pagination, filter, and sort options
|
|
27
|
-
* @returns Paginated list of messages
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* const messages = await clarify.messages.list({
|
|
32
|
-
* page: { limit: 20 },
|
|
33
|
-
* filter: { from: 'user@example.com' },
|
|
34
|
-
* });
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
list<T extends MessageAttributes = MessageAttributes>(options?: ListOptions): Promise<ListResponse<T>>;
|
|
38
|
-
/**
|
|
39
|
-
* Gets a single message by ID.
|
|
40
|
-
*
|
|
41
|
-
* @param id - The message ID
|
|
42
|
-
* @returns The message
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const message = await clarify.messages.get('message-id');
|
|
47
|
-
* console.log(message.data.attributes.subject);
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
get<T extends MessageAttributes = MessageAttributes>(id: string): Promise<SingleResponse<T>>;
|
|
51
|
-
/**
|
|
52
|
-
* Creates a new message.
|
|
53
|
-
*
|
|
54
|
-
* @param data - The message data to create
|
|
55
|
-
* @returns The created message
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* const message = await clarify.messages.create({
|
|
60
|
-
* type: 'message',
|
|
61
|
-
* attributes: {
|
|
62
|
-
* subject: 'Hello',
|
|
63
|
-
* body: 'Message content',
|
|
64
|
-
* from: 'sender@example.com',
|
|
65
|
-
* to: ['recipient@example.com'],
|
|
66
|
-
* },
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
create<T extends MessageAttributes = MessageAttributes>(data: ResourceCreate<T>): Promise<SingleResponse<T>>;
|
|
71
|
-
/**
|
|
72
|
-
* Deletes a message.
|
|
73
|
-
*
|
|
74
|
-
* @param id - The message ID
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* await clarify.messages.delete('message-id');
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
delete(id: string): Promise<void>;
|
|
82
|
-
/**
|
|
83
|
-
* Async iterator for paginating through all messages.
|
|
84
|
-
*
|
|
85
|
-
* @param options - Filter and sort options (pagination is handled automatically)
|
|
86
|
-
* @yields Individual messages
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* ```typescript
|
|
90
|
-
* for await (const message of clarify.messages.iterate()) {
|
|
91
|
-
* console.log(message.attributes.subject);
|
|
92
|
-
* }
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
iterate<T extends MessageAttributes = MessageAttributes>(options?: Omit<ListOptions, 'page'>): AsyncGenerator<Resource<T>, void, undefined>;
|
|
96
|
-
/**
|
|
97
|
-
* Builds query parameters from list options.
|
|
98
|
-
*/
|
|
99
|
-
private buildListQuery;
|
|
100
|
-
/**
|
|
101
|
-
* Extracts the cursor from a pagination URL.
|
|
102
|
-
*/
|
|
103
|
-
private extractCursor;
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/resources/messages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAEV,WAAW,EACX,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;gBACpC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc;IAI1D;;;;;;;;;;;;;OAaG;IACG,IAAI,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,EACxD,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAA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