@major-tech/resource-client 0.2.47 → 0.2.48
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/bin/generate-clients.mjs +5 -3
- package/dist/clients/linear.d.ts +10 -0
- package/dist/clients/linear.d.ts.map +1 -0
- package/dist/clients/ringcentral.d.ts +111 -0
- package/dist/clients/ringcentral.d.ts.map +1 -0
- package/dist/index.cjs +249 -0
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +249 -0
- package/dist/index.js.map +3 -3
- package/dist/payload-builders/from-extracted-params.d.ts.map +1 -1
- package/dist/payload-builders/index.d.ts +2 -0
- package/dist/payload-builders/index.d.ts.map +1 -1
- package/dist/payload-builders/linear.d.ts +7 -0
- package/dist/payload-builders/linear.d.ts.map +1 -0
- package/dist/payload-builders/ringcentral.d.ts +63 -0
- package/dist/payload-builders/ringcentral.d.ts.map +1 -0
- package/dist/schemas/api-linear.d.ts +9 -0
- package/dist/schemas/api-linear.d.ts.map +1 -0
- package/dist/schemas/api-ringcentral.d.ts +20 -0
- package/dist/schemas/api-ringcentral.d.ts.map +1 -0
- package/dist/schemas/index.d.ts +5 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/response.d.ts +8 -0
- package/dist/schemas/response.d.ts.map +1 -1
- package/package.json +1 -1
package/bin/generate-clients.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* npx @major-tech/resource-client list
|
|
11
11
|
*
|
|
12
12
|
* Modes: app (default) | tool
|
|
13
|
-
* Types: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks | gong | dynamics
|
|
13
|
+
* Types: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks | gong | dynamics | linear | ringcentral
|
|
14
14
|
*
|
|
15
15
|
* Examples:
|
|
16
16
|
* npx @major-tech/resource-client add "abc-123" "orders-db" "postgresql" "Orders database" "app-123"
|
|
@@ -208,6 +208,8 @@ function getClientClass(type) {
|
|
|
208
208
|
'quickbooks': 'QuickBooksResourceClient',
|
|
209
209
|
'gong': 'GongResourceClient',
|
|
210
210
|
'dynamics': 'DynamicsResourceClient',
|
|
211
|
+
'linear': 'LinearResourceClient',
|
|
212
|
+
'ringcentral': 'RingCentralResourceClient',
|
|
211
213
|
};
|
|
212
214
|
return typeMap[type] || 'PostgresResourceClient';
|
|
213
215
|
}
|
|
@@ -266,7 +268,7 @@ function generateIndexFile(resources) {
|
|
|
266
268
|
}
|
|
267
269
|
|
|
268
270
|
function addResource(resourceId, name, type, description, applicationId, framework, mode) {
|
|
269
|
-
const validTypes = ['postgresql', 'mssql', 'dynamodb', 'cosmosdb', 'snowflake', 'bigquery', 'neo4j', 'hubspot', 'googlesheets', 'outreach', 'custom', 'graphql', 'lambda', 'salesforce', 's3', 'slack', 'majorauth', 'googleanalytics', 'quickbooks', 'gong', 'dynamics'];
|
|
271
|
+
const validTypes = ['postgresql', 'mssql', 'dynamodb', 'cosmosdb', 'snowflake', 'bigquery', 'neo4j', 'hubspot', 'googlesheets', 'outreach', 'custom', 'graphql', 'lambda', 'salesforce', 's3', 'slack', 'majorauth', 'googleanalytics', 'quickbooks', 'gong', 'dynamics', 'linear', 'ringcentral'];
|
|
270
272
|
if (!validTypes.includes(type)) {
|
|
271
273
|
console.error(`❌ Invalid type: ${type}`);
|
|
272
274
|
console.error(` Valid types: ${validTypes.join(', ')}`);
|
|
@@ -421,7 +423,7 @@ function main() {
|
|
|
421
423
|
console.log('\nModes: app (default) | tool');
|
|
422
424
|
console.log(' app — requires <application_id>, reads MAJOR_API_BASE_URL');
|
|
423
425
|
console.log(' tool — embeds toolId from tool.json at generation time, reads RESOURCE_API_URL');
|
|
424
|
-
console.log('\nTypes: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks | gong | dynamics');
|
|
426
|
+
console.log('\nTypes: postgresql | mssql | dynamodb | cosmosdb | snowflake | bigquery | neo4j | hubspot | googlesheets | outreach | custom | graphql | lambda | salesforce | s3 | slack | majorauth | googleanalytics | quickbooks | gong | dynamics | linear | ringcentral');
|
|
425
427
|
return;
|
|
426
428
|
}
|
|
427
429
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiInvokeResponse } from "../schemas";
|
|
2
|
+
import { BaseResourceClient } from "../base";
|
|
3
|
+
export declare class LinearResourceClient extends BaseResourceClient {
|
|
4
|
+
graphql(query: string, invocationKey: string, options?: {
|
|
5
|
+
variables?: Record<string, unknown>;
|
|
6
|
+
operationName?: string;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}): Promise<ApiInvokeResponse>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=linear.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linear.d.ts","sourceRoot":"","sources":["../../src/clients/linear.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C,qBAAa,oBAAqB,SAAQ,kBAAkB;IACpD,OAAO,CACX,KAAK,EAAE,MAAM,EACb,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QACP,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACpC,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,iBAAiB,CAAC;CAI9B"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { HttpMethod, QueryParams, RingCentralInvokeResponse } from "../schemas";
|
|
2
|
+
import { BaseResourceClient } from "../base";
|
|
3
|
+
/**
|
|
4
|
+
* Client for interacting with RingCentral API resources.
|
|
5
|
+
*
|
|
6
|
+
* This client provides a simple interface for making authenticated requests
|
|
7
|
+
* to the RingCentral REST API. Authentication is handled automatically.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* // List recent call log entries
|
|
12
|
+
* const calls = await client.listCallLog("list-calls", {
|
|
13
|
+
* dateFrom: "2024-01-01T00:00:00Z",
|
|
14
|
+
* perPage: 25,
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Send an SMS
|
|
18
|
+
* const sms = await client.sendSms("+15551234567", "+15559876543", "Hello!", "send-sms");
|
|
19
|
+
*
|
|
20
|
+
* // Generic API call
|
|
21
|
+
* const result = await client.invoke("GET", "/v1.0/account/~/extension", "list-ext");
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare class RingCentralResourceClient extends BaseResourceClient {
|
|
25
|
+
/**
|
|
26
|
+
* Invoke a RingCentral API request
|
|
27
|
+
*
|
|
28
|
+
* @param method - HTTP method (GET, POST, PUT, PATCH, DELETE)
|
|
29
|
+
* @param path - RingCentral API path (e.g., "/v1.0/account/~/call-log")
|
|
30
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
31
|
+
* @param options - Optional query params, body, and timeout
|
|
32
|
+
* @returns The API response with status and body
|
|
33
|
+
*/
|
|
34
|
+
invoke(method: HttpMethod, path: string, invocationKey: string, options?: {
|
|
35
|
+
query?: QueryParams;
|
|
36
|
+
body?: {
|
|
37
|
+
type: "json";
|
|
38
|
+
value: unknown;
|
|
39
|
+
};
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}): Promise<RingCentralInvokeResponse>;
|
|
42
|
+
/**
|
|
43
|
+
* List call log entries
|
|
44
|
+
*
|
|
45
|
+
* @param invocationKey - Unique key for this invocation
|
|
46
|
+
* @param options - Optional filters (dateFrom, dateTo, direction, type, perPage, page)
|
|
47
|
+
* @returns Call log records
|
|
48
|
+
*/
|
|
49
|
+
listCallLog(invocationKey: string, options?: {
|
|
50
|
+
dateFrom?: string;
|
|
51
|
+
dateTo?: string;
|
|
52
|
+
direction?: string;
|
|
53
|
+
type?: string;
|
|
54
|
+
perPage?: number;
|
|
55
|
+
page?: number;
|
|
56
|
+
}): Promise<RingCentralInvokeResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* Get a specific call record by ID
|
|
59
|
+
*
|
|
60
|
+
* @param callRecordId - The call record ID
|
|
61
|
+
* @param invocationKey - Unique key for this invocation
|
|
62
|
+
* @returns The call record details
|
|
63
|
+
*/
|
|
64
|
+
getCallRecord(callRecordId: string, invocationKey: string): Promise<RingCentralInvokeResponse>;
|
|
65
|
+
/**
|
|
66
|
+
* Send an SMS message
|
|
67
|
+
*
|
|
68
|
+
* @param from - Sender phone number
|
|
69
|
+
* @param to - Recipient phone number
|
|
70
|
+
* @param text - Message text
|
|
71
|
+
* @param invocationKey - Unique key for this invocation
|
|
72
|
+
* @returns The sent message details
|
|
73
|
+
*/
|
|
74
|
+
sendSms(from: string, to: string, text: string, invocationKey: string): Promise<RingCentralInvokeResponse>;
|
|
75
|
+
/**
|
|
76
|
+
* List messages from the message store
|
|
77
|
+
*
|
|
78
|
+
* @param invocationKey - Unique key for this invocation
|
|
79
|
+
* @param options - Optional filters (messageType, dateFrom, dateTo, perPage, page)
|
|
80
|
+
* @returns Message records
|
|
81
|
+
*/
|
|
82
|
+
listMessages(invocationKey: string, options?: {
|
|
83
|
+
messageType?: string;
|
|
84
|
+
dateFrom?: string;
|
|
85
|
+
dateTo?: string;
|
|
86
|
+
perPage?: number;
|
|
87
|
+
page?: number;
|
|
88
|
+
}): Promise<RingCentralInvokeResponse>;
|
|
89
|
+
/**
|
|
90
|
+
* List extensions on the account
|
|
91
|
+
*
|
|
92
|
+
* @param invocationKey - Unique key for this invocation
|
|
93
|
+
* @param options - Optional filters (type, status, perPage, page)
|
|
94
|
+
* @returns Extension records
|
|
95
|
+
*/
|
|
96
|
+
listExtensions(invocationKey: string, options?: {
|
|
97
|
+
type?: string;
|
|
98
|
+
status?: string;
|
|
99
|
+
perPage?: number;
|
|
100
|
+
page?: number;
|
|
101
|
+
}): Promise<RingCentralInvokeResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* Get a specific extension by ID
|
|
104
|
+
*
|
|
105
|
+
* @param extensionId - The extension ID
|
|
106
|
+
* @param invocationKey - Unique key for this invocation
|
|
107
|
+
* @returns The extension details
|
|
108
|
+
*/
|
|
109
|
+
getExtension(extensionId: string, invocationKey: string): Promise<RingCentralInvokeResponse>;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=ringcentral.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ringcentral.d.ts","sourceRoot":"","sources":["../../src/clients/ringcentral.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG7C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IAC/D;;;;;;;;OAQG;IACG,MAAM,CACV,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;QACP,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,OAAO,CAAA;SAAE,CAAC;QACxC,SAAS,CAAC,EAAE,MAAM,CAAC;KACf,GACL,OAAO,CAAC,yBAAyB,CAAC;IAKrC;;;;;;OAMG;IACG,WAAW,CACf,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,yBAAyB,CAAC;IAcrC;;;;;;OAMG;IACG,aAAa,CACjB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,yBAAyB,CAAC;IAIrC;;;;;;;;OAQG;IACG,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,yBAAyB,CAAC;IAarC;;;;;;OAMG;IACG,YAAY,CAChB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,yBAAyB,CAAC;IAarC;;;;;;OAMG;IACG,cAAc,CAClB,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GACA,OAAO,CAAC,yBAAyB,CAAC;IAYrC;;;;;;OAMG;IACG,YAAY,CAChB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,yBAAyB,CAAC;CAGtC"}
|
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ __export(index_exports, {
|
|
|
32
32
|
GraphQLResourceClient: () => GraphQLResourceClient,
|
|
33
33
|
HubSpotResourceClient: () => HubSpotResourceClient,
|
|
34
34
|
LambdaResourceClient: () => LambdaResourceClient,
|
|
35
|
+
LinearResourceClient: () => LinearResourceClient,
|
|
35
36
|
MajorAuthResourceClient: () => MajorAuthResourceClient,
|
|
36
37
|
MssqlResourceClient: () => MssqlResourceClient,
|
|
37
38
|
Neo4jResourceClient: () => Neo4jResourceClient,
|
|
@@ -39,6 +40,7 @@ __export(index_exports, {
|
|
|
39
40
|
PostgresResourceClient: () => PostgresResourceClient,
|
|
40
41
|
QuickBooksResourceClient: () => QuickBooksResourceClient,
|
|
41
42
|
ResourceInvokeError: () => ResourceInvokeError,
|
|
43
|
+
RingCentralResourceClient: () => RingCentralResourceClient,
|
|
42
44
|
S3ResourceClient: () => S3ResourceClient,
|
|
43
45
|
SalesforceResourceClient: () => SalesforceResourceClient,
|
|
44
46
|
SlackResourceClient: () => SlackResourceClient,
|
|
@@ -86,6 +88,7 @@ __export(index_exports, {
|
|
|
86
88
|
buildGraphQLInvokePayload: () => buildGraphQLInvokePayload,
|
|
87
89
|
buildHubSpotInvokePayload: () => buildHubSpotInvokePayload,
|
|
88
90
|
buildLambdaInvokePayload: () => buildLambdaInvokePayload,
|
|
91
|
+
buildLinearGraphQLPayload: () => buildLinearGraphQLPayload,
|
|
89
92
|
buildMssqlInvokePayload: () => buildMssqlInvokePayload,
|
|
90
93
|
buildNeo4jInvokePayload: () => buildNeo4jInvokePayload,
|
|
91
94
|
buildOutreachInvokePayload: () => buildOutreachInvokePayload,
|
|
@@ -93,6 +96,13 @@ __export(index_exports, {
|
|
|
93
96
|
buildPostgresInvokePayload: () => buildPostgresInvokePayload,
|
|
94
97
|
buildQuickBooksInvokePayload: () => buildQuickBooksInvokePayload,
|
|
95
98
|
buildQuickBooksQueryPayload: () => buildQuickBooksQueryPayload,
|
|
99
|
+
buildRingCentralGetCallRecordPayload: () => buildRingCentralGetCallRecordPayload,
|
|
100
|
+
buildRingCentralGetExtensionPayload: () => buildRingCentralGetExtensionPayload,
|
|
101
|
+
buildRingCentralInvokePayload: () => buildRingCentralInvokePayload,
|
|
102
|
+
buildRingCentralListCallLogPayload: () => buildRingCentralListCallLogPayload,
|
|
103
|
+
buildRingCentralListExtensionsPayload: () => buildRingCentralListExtensionsPayload,
|
|
104
|
+
buildRingCentralListMessagesPayload: () => buildRingCentralListMessagesPayload,
|
|
105
|
+
buildRingCentralSendSmsPayload: () => buildRingCentralSendSmsPayload,
|
|
96
106
|
buildS3InvokePayload: () => buildS3InvokePayload,
|
|
97
107
|
buildSalesforceCreateRecordPayload: () => buildSalesforceCreateRecordPayload,
|
|
98
108
|
buildSalesforceDeleteRecordPayload: () => buildSalesforceDeleteRecordPayload,
|
|
@@ -1716,6 +1726,202 @@ var DynamicsResourceClient = class extends BaseResourceClient {
|
|
|
1716
1726
|
}
|
|
1717
1727
|
};
|
|
1718
1728
|
|
|
1729
|
+
// src/payload-builders/linear.ts
|
|
1730
|
+
function buildLinearGraphQLPayload(query, options) {
|
|
1731
|
+
return {
|
|
1732
|
+
type: "api",
|
|
1733
|
+
subtype: "linear",
|
|
1734
|
+
query,
|
|
1735
|
+
variables: options?.variables,
|
|
1736
|
+
operationName: options?.operationName,
|
|
1737
|
+
timeoutMs: options?.timeoutMs ?? 3e4
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
// src/clients/linear.ts
|
|
1742
|
+
var LinearResourceClient = class extends BaseResourceClient {
|
|
1743
|
+
async graphql(query, invocationKey, options = {}) {
|
|
1744
|
+
const payload = buildLinearGraphQLPayload(query, options);
|
|
1745
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1746
|
+
}
|
|
1747
|
+
};
|
|
1748
|
+
|
|
1749
|
+
// src/payload-builders/ringcentral.ts
|
|
1750
|
+
function buildRingCentralInvokePayload(method, path, options) {
|
|
1751
|
+
return {
|
|
1752
|
+
type: "api",
|
|
1753
|
+
subtype: "ringcentral",
|
|
1754
|
+
method,
|
|
1755
|
+
path,
|
|
1756
|
+
query: options?.query,
|
|
1757
|
+
body: options?.body,
|
|
1758
|
+
timeoutMs: options?.timeoutMs ?? 3e4
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
function buildRingCentralListCallLogPayload(options) {
|
|
1762
|
+
const query = {};
|
|
1763
|
+
if (options?.dateFrom) query.dateFrom = options.dateFrom;
|
|
1764
|
+
if (options?.dateTo) query.dateTo = options.dateTo;
|
|
1765
|
+
if (options?.direction) query.direction = options.direction;
|
|
1766
|
+
if (options?.type) query.type = options.type;
|
|
1767
|
+
if (options?.perPage !== void 0) query.perPage = String(options.perPage);
|
|
1768
|
+
if (options?.page !== void 0) query.page = String(options.page);
|
|
1769
|
+
return buildRingCentralInvokePayload("GET", "/v1.0/account/~/call-log", {
|
|
1770
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
1771
|
+
});
|
|
1772
|
+
}
|
|
1773
|
+
function buildRingCentralGetCallRecordPayload(callRecordId) {
|
|
1774
|
+
return buildRingCentralInvokePayload("GET", `/v1.0/account/~/call-log/${callRecordId}`);
|
|
1775
|
+
}
|
|
1776
|
+
function buildRingCentralSendSmsPayload(from, to, text) {
|
|
1777
|
+
return buildRingCentralInvokePayload("POST", "/v1.0/account/~/extension/~/sms", {
|
|
1778
|
+
body: {
|
|
1779
|
+
type: "json",
|
|
1780
|
+
value: {
|
|
1781
|
+
from: { phoneNumber: from },
|
|
1782
|
+
to: [{ phoneNumber: to }],
|
|
1783
|
+
text
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
function buildRingCentralListMessagesPayload(options) {
|
|
1789
|
+
const query = {};
|
|
1790
|
+
if (options?.messageType) query.messageType = options.messageType;
|
|
1791
|
+
if (options?.dateFrom) query.dateFrom = options.dateFrom;
|
|
1792
|
+
if (options?.dateTo) query.dateTo = options.dateTo;
|
|
1793
|
+
if (options?.perPage !== void 0) query.perPage = String(options.perPage);
|
|
1794
|
+
if (options?.page !== void 0) query.page = String(options.page);
|
|
1795
|
+
return buildRingCentralInvokePayload("GET", "/v1.0/account/~/extension/~/message-store", {
|
|
1796
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
function buildRingCentralListExtensionsPayload(options) {
|
|
1800
|
+
const query = {};
|
|
1801
|
+
if (options?.type) query.type = options.type;
|
|
1802
|
+
if (options?.status) query.status = options.status;
|
|
1803
|
+
if (options?.perPage !== void 0) query.perPage = String(options.perPage);
|
|
1804
|
+
if (options?.page !== void 0) query.page = String(options.page);
|
|
1805
|
+
return buildRingCentralInvokePayload("GET", "/v1.0/account/~/extension", {
|
|
1806
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
function buildRingCentralGetExtensionPayload(extensionId) {
|
|
1810
|
+
return buildRingCentralInvokePayload("GET", `/v1.0/account/~/extension/${extensionId}`);
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
// src/clients/ringcentral.ts
|
|
1814
|
+
var RingCentralResourceClient = class extends BaseResourceClient {
|
|
1815
|
+
/**
|
|
1816
|
+
* Invoke a RingCentral API request
|
|
1817
|
+
*
|
|
1818
|
+
* @param method - HTTP method (GET, POST, PUT, PATCH, DELETE)
|
|
1819
|
+
* @param path - RingCentral API path (e.g., "/v1.0/account/~/call-log")
|
|
1820
|
+
* @param invocationKey - Unique key for this invocation (for tracking)
|
|
1821
|
+
* @param options - Optional query params, body, and timeout
|
|
1822
|
+
* @returns The API response with status and body
|
|
1823
|
+
*/
|
|
1824
|
+
async invoke(method, path, invocationKey, options = {}) {
|
|
1825
|
+
const payload = buildRingCentralInvokePayload(method, path, options);
|
|
1826
|
+
return this.invokeRaw(payload, invocationKey);
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* List call log entries
|
|
1830
|
+
*
|
|
1831
|
+
* @param invocationKey - Unique key for this invocation
|
|
1832
|
+
* @param options - Optional filters (dateFrom, dateTo, direction, type, perPage, page)
|
|
1833
|
+
* @returns Call log records
|
|
1834
|
+
*/
|
|
1835
|
+
async listCallLog(invocationKey, options) {
|
|
1836
|
+
const query = {};
|
|
1837
|
+
if (options?.dateFrom) query.dateFrom = options.dateFrom;
|
|
1838
|
+
if (options?.dateTo) query.dateTo = options.dateTo;
|
|
1839
|
+
if (options?.direction) query.direction = options.direction;
|
|
1840
|
+
if (options?.type) query.type = options.type;
|
|
1841
|
+
if (options?.perPage !== void 0) query.perPage = String(options.perPage);
|
|
1842
|
+
if (options?.page !== void 0) query.page = String(options.page);
|
|
1843
|
+
return this.invoke("GET", "/v1.0/account/~/call-log", invocationKey, {
|
|
1844
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
1845
|
+
});
|
|
1846
|
+
}
|
|
1847
|
+
/**
|
|
1848
|
+
* Get a specific call record by ID
|
|
1849
|
+
*
|
|
1850
|
+
* @param callRecordId - The call record ID
|
|
1851
|
+
* @param invocationKey - Unique key for this invocation
|
|
1852
|
+
* @returns The call record details
|
|
1853
|
+
*/
|
|
1854
|
+
async getCallRecord(callRecordId, invocationKey) {
|
|
1855
|
+
return this.invoke("GET", `/v1.0/account/~/call-log/${callRecordId}`, invocationKey);
|
|
1856
|
+
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Send an SMS message
|
|
1859
|
+
*
|
|
1860
|
+
* @param from - Sender phone number
|
|
1861
|
+
* @param to - Recipient phone number
|
|
1862
|
+
* @param text - Message text
|
|
1863
|
+
* @param invocationKey - Unique key for this invocation
|
|
1864
|
+
* @returns The sent message details
|
|
1865
|
+
*/
|
|
1866
|
+
async sendSms(from, to, text, invocationKey) {
|
|
1867
|
+
return this.invoke("POST", "/v1.0/account/~/extension/~/sms", invocationKey, {
|
|
1868
|
+
body: {
|
|
1869
|
+
type: "json",
|
|
1870
|
+
value: {
|
|
1871
|
+
from: { phoneNumber: from },
|
|
1872
|
+
to: [{ phoneNumber: to }],
|
|
1873
|
+
text
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
});
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* List messages from the message store
|
|
1880
|
+
*
|
|
1881
|
+
* @param invocationKey - Unique key for this invocation
|
|
1882
|
+
* @param options - Optional filters (messageType, dateFrom, dateTo, perPage, page)
|
|
1883
|
+
* @returns Message records
|
|
1884
|
+
*/
|
|
1885
|
+
async listMessages(invocationKey, options) {
|
|
1886
|
+
const query = {};
|
|
1887
|
+
if (options?.messageType) query.messageType = options.messageType;
|
|
1888
|
+
if (options?.dateFrom) query.dateFrom = options.dateFrom;
|
|
1889
|
+
if (options?.dateTo) query.dateTo = options.dateTo;
|
|
1890
|
+
if (options?.perPage !== void 0) query.perPage = String(options.perPage);
|
|
1891
|
+
if (options?.page !== void 0) query.page = String(options.page);
|
|
1892
|
+
return this.invoke("GET", "/v1.0/account/~/extension/~/message-store", invocationKey, {
|
|
1893
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
/**
|
|
1897
|
+
* List extensions on the account
|
|
1898
|
+
*
|
|
1899
|
+
* @param invocationKey - Unique key for this invocation
|
|
1900
|
+
* @param options - Optional filters (type, status, perPage, page)
|
|
1901
|
+
* @returns Extension records
|
|
1902
|
+
*/
|
|
1903
|
+
async listExtensions(invocationKey, options) {
|
|
1904
|
+
const query = {};
|
|
1905
|
+
if (options?.type) query.type = options.type;
|
|
1906
|
+
if (options?.status) query.status = options.status;
|
|
1907
|
+
if (options?.perPage !== void 0) query.perPage = String(options.perPage);
|
|
1908
|
+
if (options?.page !== void 0) query.page = String(options.page);
|
|
1909
|
+
return this.invoke("GET", "/v1.0/account/~/extension", invocationKey, {
|
|
1910
|
+
query: Object.keys(query).length > 0 ? query : void 0
|
|
1911
|
+
});
|
|
1912
|
+
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Get a specific extension by ID
|
|
1915
|
+
*
|
|
1916
|
+
* @param extensionId - The extension ID
|
|
1917
|
+
* @param invocationKey - Unique key for this invocation
|
|
1918
|
+
* @returns The extension details
|
|
1919
|
+
*/
|
|
1920
|
+
async getExtension(extensionId, invocationKey) {
|
|
1921
|
+
return this.invoke("GET", `/v1.0/account/~/extension/${extensionId}`, invocationKey);
|
|
1922
|
+
}
|
|
1923
|
+
};
|
|
1924
|
+
|
|
1719
1925
|
// src/payload-builders/outreach.ts
|
|
1720
1926
|
function buildOutreachInvokePayload(method, path, options) {
|
|
1721
1927
|
return {
|
|
@@ -2156,6 +2362,49 @@ function buildPayloadFromExtractedParams(subtype, methodName, extractedParams) {
|
|
|
2156
2362
|
const options = findParam(extractedParams, "Options");
|
|
2157
2363
|
return buildDynamicsInvokePayload(method, path, options);
|
|
2158
2364
|
}
|
|
2365
|
+
// =========================================================================
|
|
2366
|
+
// Linear
|
|
2367
|
+
// =========================================================================
|
|
2368
|
+
case "linear": {
|
|
2369
|
+
const query = findParam(extractedParams, "Query");
|
|
2370
|
+
const options = findParam(extractedParams, "Options");
|
|
2371
|
+
return buildLinearGraphQLPayload(query, options);
|
|
2372
|
+
}
|
|
2373
|
+
// =========================================================================
|
|
2374
|
+
// RingCentral
|
|
2375
|
+
// =========================================================================
|
|
2376
|
+
case "ringcentral": {
|
|
2377
|
+
if (methodName === "listCallLog") {
|
|
2378
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2379
|
+
return buildRingCentralListCallLogPayload(options2);
|
|
2380
|
+
}
|
|
2381
|
+
if (methodName === "getCallRecord") {
|
|
2382
|
+
const callRecordId = findParam(extractedParams, "CallRecordId");
|
|
2383
|
+
return buildRingCentralGetCallRecordPayload(callRecordId);
|
|
2384
|
+
}
|
|
2385
|
+
if (methodName === "sendSms") {
|
|
2386
|
+
const from = findParam(extractedParams, "From");
|
|
2387
|
+
const to = findParam(extractedParams, "To");
|
|
2388
|
+
const text = findParam(extractedParams, "Text");
|
|
2389
|
+
return buildRingCentralSendSmsPayload(from, to, text);
|
|
2390
|
+
}
|
|
2391
|
+
if (methodName === "listMessages") {
|
|
2392
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2393
|
+
return buildRingCentralListMessagesPayload(options2);
|
|
2394
|
+
}
|
|
2395
|
+
if (methodName === "listExtensions") {
|
|
2396
|
+
const options2 = findParam(extractedParams, "Options");
|
|
2397
|
+
return buildRingCentralListExtensionsPayload(options2);
|
|
2398
|
+
}
|
|
2399
|
+
if (methodName === "getExtension") {
|
|
2400
|
+
const extensionId = findParam(extractedParams, "ExtensionId");
|
|
2401
|
+
return buildRingCentralGetExtensionPayload(extensionId);
|
|
2402
|
+
}
|
|
2403
|
+
const method = findParam(extractedParams, "Method");
|
|
2404
|
+
const path = findParam(extractedParams, "Path");
|
|
2405
|
+
const options = findParam(extractedParams, "Options");
|
|
2406
|
+
return buildRingCentralInvokePayload(method, path, options);
|
|
2407
|
+
}
|
|
2159
2408
|
default:
|
|
2160
2409
|
throw new Error(`Unsupported resource subtype: ${subtype}`);
|
|
2161
2410
|
}
|