@orq-ai/node 4.16.6 → 4.16.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 (130) hide show
  1. package/jsr.json +1 -1
  2. package/lib/config.d.ts +2 -2
  3. package/lib/config.js +2 -2
  4. package/models/components/reasoningpart.js +1 -1
  5. package/models/operations/createtool.js +4 -4
  6. package/models/operations/getalltools.js +4 -4
  7. package/models/operations/getv2humanevalsets.js +2 -2
  8. package/models/operations/getv2humanevalsetsid.js +2 -2
  9. package/models/operations/patchv2humanevalsetsid.js +2 -2
  10. package/models/operations/postv2feedbackevaluation.js +4 -4
  11. package/models/operations/postv2humanevalsets.js +2 -2
  12. package/models/operations/retrievetool.js +4 -4
  13. package/models/operations/runagent.js +1 -1
  14. package/models/operations/streamrunagent.js +1 -1
  15. package/models/operations/updatetool.js +4 -4
  16. package/package.json +1 -1
  17. package/packages/orq-rc/src/funcs/agentsExternalCreate.ts +163 -0
  18. package/packages/orq-rc/src/funcs/agentsExternalDelete.ts +169 -0
  19. package/packages/orq-rc/src/funcs/agentsExternalList.ts +172 -0
  20. package/packages/orq-rc/src/funcs/agentsExternalRefreshCard.ts +174 -0
  21. package/packages/orq-rc/src/funcs/agentsExternalRetrieve.ts +168 -0
  22. package/packages/orq-rc/src/funcs/agentsExternalTestConnection.ts +174 -0
  23. package/packages/orq-rc/src/funcs/agentsExternalUpdate.ts +172 -0
  24. package/packages/orq-rc/src/funcs/agentsUpdate.ts +2 -2
  25. package/packages/orq-rc/src/funcs/monitorsCreate.ts +162 -0
  26. package/packages/orq-rc/src/funcs/monitorsDelete.ts +168 -0
  27. package/packages/orq-rc/src/funcs/monitorsGet.ts +168 -0
  28. package/packages/orq-rc/src/funcs/monitorsList.ts +173 -0
  29. package/packages/orq-rc/src/funcs/monitorsListPresets.ts +144 -0
  30. package/packages/orq-rc/src/funcs/monitorsUpdate.ts +171 -0
  31. package/packages/orq-rc/src/funcs/usersCreate.ts +171 -0
  32. package/packages/orq-rc/src/funcs/usersDelete.ts +168 -0
  33. package/packages/orq-rc/src/funcs/usersGet.ts +168 -0
  34. package/packages/orq-rc/src/funcs/usersList.ts +144 -0
  35. package/packages/orq-rc/src/funcs/usersUpdate.ts +169 -0
  36. package/packages/orq-rc/src/lib/config.ts +2 -2
  37. package/packages/orq-rc/src/models/components/autorouterv2config.ts +30 -0
  38. package/packages/orq-rc/src/models/components/autorouterv2creatorconfig.ts +4 -4
  39. package/packages/orq-rc/src/models/components/autorouterv2effortconfig.ts +24 -0
  40. package/packages/orq-rc/src/models/components/createexternalagentrequest.ts +73 -0
  41. package/packages/orq-rc/src/models/components/createexternalagentresponse.ts +32 -0
  42. package/packages/orq-rc/src/models/components/createmonitorrequest.ts +108 -0
  43. package/packages/orq-rc/src/models/components/createmonitorresponse.ts +35 -0
  44. package/packages/orq-rc/src/models/components/createusersrequest.ts +40 -0
  45. package/packages/orq-rc/src/models/components/createusersresponse.ts +32 -0
  46. package/packages/orq-rc/src/models/components/deleteexternalagentresponse.ts +27 -0
  47. package/packages/orq-rc/src/models/components/deletemonitorresponse.ts +27 -0
  48. package/packages/orq-rc/src/models/components/deleteuserresponse.ts +27 -0
  49. package/packages/orq-rc/src/models/components/externalagent.ts +107 -0
  50. package/packages/orq-rc/src/models/components/externalagentheader.ts +55 -0
  51. package/packages/orq-rc/src/models/components/getexternalagentresponse.ts +32 -0
  52. package/packages/orq-rc/src/models/components/getmonitorresponse.ts +35 -0
  53. package/packages/orq-rc/src/models/components/getuserresponse.ts +35 -0
  54. package/packages/orq-rc/src/models/components/index.ts +40 -0
  55. package/packages/orq-rc/src/models/components/listexternalagentsresponse.ts +41 -0
  56. package/packages/orq-rc/src/models/components/listmonitorpresetsresponse.ts +40 -0
  57. package/packages/orq-rc/src/models/components/listmonitorsresponse.ts +53 -0
  58. package/packages/orq-rc/src/models/components/listusersresponse.ts +32 -0
  59. package/packages/orq-rc/src/models/components/monitor.ts +133 -0
  60. package/packages/orq-rc/src/models/components/monitorpreset.ts +120 -0
  61. package/packages/orq-rc/src/models/components/monitortelemetrysource.ts +23 -0
  62. package/packages/orq-rc/src/models/components/monitorwidget.ts +145 -0
  63. package/packages/orq-rc/src/models/components/monitorwidgetcompute.ts +61 -0
  64. package/packages/orq-rc/src/models/components/monitorwidgetdisplay.ts +196 -0
  65. package/packages/orq-rc/src/models/components/monitorwidgetlayout.ts +75 -0
  66. package/packages/orq-rc/src/models/components/monitorwidgetquery.ts +165 -0
  67. package/packages/orq-rc/src/models/components/openaicontextmanagement.ts +43 -0
  68. package/packages/orq-rc/src/models/components/piiredactionconfig.ts +3 -2
  69. package/packages/orq-rc/src/models/components/piiredactionplugin.ts +1 -1
  70. package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
  71. package/packages/orq-rc/src/models/components/refreshexternalagentcardrequest.ts +27 -0
  72. package/packages/orq-rc/src/models/components/refreshexternalagentcardresponse.ts +32 -0
  73. package/packages/orq-rc/src/models/components/testexternalagentconnectionrequest.ts +27 -0
  74. package/packages/orq-rc/src/models/components/testexternalagentconnectionresponse.ts +50 -0
  75. package/packages/orq-rc/src/models/components/thinkingparam.ts +112 -0
  76. package/packages/orq-rc/src/models/components/updateexternalagentrequest.ts +74 -0
  77. package/packages/orq-rc/src/models/components/updateexternalagentresponse.ts +32 -0
  78. package/packages/orq-rc/src/models/components/updatemonitorrequest.ts +80 -0
  79. package/packages/orq-rc/src/models/components/updatemonitorresponse.ts +35 -0
  80. package/packages/orq-rc/src/models/components/updateuserrequest.ts +42 -0
  81. package/packages/orq-rc/src/models/components/updateuserresponse.ts +35 -0
  82. package/packages/orq-rc/src/models/components/user.ts +90 -0
  83. package/packages/orq-rc/src/models/components/userinvitationdata.ts +38 -0
  84. package/packages/orq-rc/src/models/operations/createrouterresponse.ts +24 -0
  85. package/packages/orq-rc/src/models/operations/createtool.ts +4 -4
  86. package/packages/orq-rc/src/models/operations/externalagentdelete.ts +36 -0
  87. package/packages/orq-rc/src/models/operations/externalagentget.ts +36 -0
  88. package/packages/orq-rc/src/models/operations/externalagentlist.ts +43 -0
  89. package/packages/orq-rc/src/models/operations/externalagentrefreshcard.ts +45 -0
  90. package/packages/orq-rc/src/models/operations/externalagenttestconnection.ts +46 -0
  91. package/packages/orq-rc/src/models/operations/externalagentupdate.ts +42 -0
  92. package/packages/orq-rc/src/models/operations/getalltools.ts +4 -4
  93. package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
  94. package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
  95. package/packages/orq-rc/src/models/operations/index.ts +14 -0
  96. package/packages/orq-rc/src/models/operations/monitordelete.ts +39 -0
  97. package/packages/orq-rc/src/models/operations/monitorget.ts +39 -0
  98. package/packages/orq-rc/src/models/operations/monitorlist.ts +84 -0
  99. package/packages/orq-rc/src/models/operations/monitorupdate.ts +44 -0
  100. package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  101. package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +4 -4
  102. package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
  103. package/packages/orq-rc/src/models/operations/retrievetool.ts +4 -4
  104. package/packages/orq-rc/src/models/operations/runagent.ts +1 -1
  105. package/packages/orq-rc/src/models/operations/searchweb.ts +1 -1
  106. package/packages/orq-rc/src/models/operations/streamrunagent.ts +1 -1
  107. package/packages/orq-rc/src/models/operations/updateagent.ts +16 -11
  108. package/packages/orq-rc/src/models/operations/updatetool.ts +4 -4
  109. package/packages/orq-rc/src/models/operations/usercreate.ts +44 -0
  110. package/packages/orq-rc/src/models/operations/userdelete.ts +39 -0
  111. package/packages/orq-rc/src/models/operations/userget.ts +35 -0
  112. package/packages/orq-rc/src/models/operations/userupdate.ts +44 -0
  113. package/packages/orq-rc/src/sdk/agents.ts +7 -1
  114. package/packages/orq-rc/src/sdk/external.ts +136 -0
  115. package/packages/orq-rc/src/sdk/monitors.ts +116 -0
  116. package/packages/orq-rc/src/sdk/sdk.ts +12 -0
  117. package/packages/orq-rc/src/sdk/users.ts +98 -0
  118. package/src/lib/config.ts +2 -2
  119. package/src/models/components/reasoningpart.ts +1 -1
  120. package/src/models/operations/createtool.ts +4 -4
  121. package/src/models/operations/getalltools.ts +4 -4
  122. package/src/models/operations/getv2humanevalsets.ts +2 -2
  123. package/src/models/operations/getv2humanevalsetsid.ts +2 -2
  124. package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  125. package/src/models/operations/postv2feedbackevaluation.ts +4 -4
  126. package/src/models/operations/postv2humanevalsets.ts +2 -2
  127. package/src/models/operations/retrievetool.ts +4 -4
  128. package/src/models/operations/runagent.ts +1 -1
  129. package/src/models/operations/streamrunagent.ts +1 -1
  130. package/src/models/operations/updatetool.ts +4 -4
@@ -0,0 +1,173 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List monitors
31
+ *
32
+ * @remarks
33
+ * Returns the monitors visible to the caller, newest first. A human filtering by project sees that project's monitors plus workspace-wide monitors. A project-scoped API key sees only monitors in its strict project scope. Use `starting_after` or `ending_before` to page.
34
+ */
35
+ export function monitorsList(
36
+ client: OrqCore,
37
+ request?: operations.MonitorListRequest | undefined,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.ListMonitorsResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request?: operations.MonitorListRequest | undefined,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.ListMonitorsResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) =>
82
+ operations.MonitorListRequest$outboundSchema.optional().parse(value),
83
+ "Input validation failed",
84
+ );
85
+ if (!parsed.ok) {
86
+ return [parsed, { status: "invalid" }];
87
+ }
88
+ const payload = parsed.value;
89
+ const body = null;
90
+
91
+ const path = pathToFunc("/v2/monitors")();
92
+
93
+ const query = encodeFormQuery({
94
+ "ending_before": payload?.ending_before,
95
+ "limit": payload?.limit,
96
+ "project_id": payload?.project_id,
97
+ "search": payload?.search,
98
+ "starting_after": payload?.starting_after,
99
+ "workspace_wide": payload?.workspace_wide,
100
+ });
101
+
102
+ const headers = new Headers(compactMap({
103
+ Accept: "application/json",
104
+ }));
105
+
106
+ const secConfig = await extractSecurity(client._options.apiKey);
107
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
108
+ const requestSecurity = resolveGlobalSecurity(securityInput);
109
+
110
+ const context = {
111
+ options: client._options,
112
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
113
+ operationID: "MonitorList",
114
+ oAuth2Scopes: null,
115
+
116
+ resolvedSecurity: requestSecurity,
117
+
118
+ securitySource: client._options.apiKey,
119
+ retryConfig: options?.retries
120
+ || client._options.retryConfig
121
+ || { strategy: "none" },
122
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
123
+ };
124
+
125
+ const requestRes = client._createRequest(context, {
126
+ security: requestSecurity,
127
+ method: "GET",
128
+ baseURL: options?.serverURL,
129
+ path: path,
130
+ headers: headers,
131
+ query: query,
132
+ body: body,
133
+ userAgent: client._options.userAgent,
134
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
135
+ }, options);
136
+ if (!requestRes.ok) {
137
+ return [requestRes, { status: "invalid" }];
138
+ }
139
+ const req = requestRes.value;
140
+
141
+ const doResult = await client._do(req, {
142
+ context,
143
+ isErrorStatusCode: (statusCode: number) =>
144
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
145
+ retryConfig: context.retryConfig,
146
+ retryCodes: context.retryCodes,
147
+ });
148
+ if (!doResult.ok) {
149
+ return [doResult, { status: "request-error", request: req }];
150
+ }
151
+ const response = doResult.value;
152
+
153
+ const [result] = await M.match<
154
+ components.ListMonitorsResponse,
155
+ | OrqError
156
+ | ResponseValidationError
157
+ | ConnectionError
158
+ | RequestAbortedError
159
+ | RequestTimeoutError
160
+ | InvalidRequestError
161
+ | UnexpectedClientError
162
+ | SDKValidationError
163
+ >(
164
+ M.json(200, components.ListMonitorsResponse$inboundSchema),
165
+ M.fail("4XX"),
166
+ M.fail("5XX"),
167
+ )(response, req);
168
+ if (!result.ok) {
169
+ return [result, { status: "complete", request: req, response }];
170
+ }
171
+
172
+ return [result, { status: "complete", request: req, response }];
173
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { matchStatusCode } from "../lib/http.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import * as components from "../models/components/index.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { OrqError } from "../models/errors/orqerror.js";
21
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import { APICall, APIPromise } from "../types/async.js";
24
+ import { Result } from "../types/fp.js";
25
+
26
+ /**
27
+ * List monitor presets
28
+ *
29
+ * @remarks
30
+ * Returns the built-in monitor templates (preset dashboards and preset widgets). Presets are defined by the platform and versioned with it; create a monitor from a preset by copying its widgets into a create request and stamping `preset_key`.
31
+ */
32
+ export function monitorsListPresets(
33
+ client: OrqCore,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ components.ListMonitorPresetsResponse,
38
+ | OrqError
39
+ | ResponseValidationError
40
+ | ConnectionError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | InvalidRequestError
44
+ | UnexpectedClientError
45
+ | SDKValidationError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ options,
51
+ ));
52
+ }
53
+
54
+ async function $do(
55
+ client: OrqCore,
56
+ options?: RequestOptions,
57
+ ): Promise<
58
+ [
59
+ Result<
60
+ components.ListMonitorPresetsResponse,
61
+ | OrqError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >,
70
+ APICall,
71
+ ]
72
+ > {
73
+ const path = pathToFunc("/v2/monitors/presets")();
74
+
75
+ const headers = new Headers(compactMap({
76
+ Accept: "application/json",
77
+ }));
78
+
79
+ const secConfig = await extractSecurity(client._options.apiKey);
80
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
81
+ const requestSecurity = resolveGlobalSecurity(securityInput);
82
+
83
+ const context = {
84
+ options: client._options,
85
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
86
+ operationID: "MonitorListPresets",
87
+ oAuth2Scopes: null,
88
+
89
+ resolvedSecurity: requestSecurity,
90
+
91
+ securitySource: client._options.apiKey,
92
+ retryConfig: options?.retries
93
+ || client._options.retryConfig
94
+ || { strategy: "none" },
95
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
96
+ };
97
+
98
+ const requestRes = client._createRequest(context, {
99
+ security: requestSecurity,
100
+ method: "GET",
101
+ baseURL: options?.serverURL,
102
+ path: path,
103
+ headers: headers,
104
+ userAgent: client._options.userAgent,
105
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
106
+ }, options);
107
+ if (!requestRes.ok) {
108
+ return [requestRes, { status: "invalid" }];
109
+ }
110
+ const req = requestRes.value;
111
+
112
+ const doResult = await client._do(req, {
113
+ context,
114
+ isErrorStatusCode: (statusCode: number) =>
115
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
116
+ retryConfig: context.retryConfig,
117
+ retryCodes: context.retryCodes,
118
+ });
119
+ if (!doResult.ok) {
120
+ return [doResult, { status: "request-error", request: req }];
121
+ }
122
+ const response = doResult.value;
123
+
124
+ const [result] = await M.match<
125
+ components.ListMonitorPresetsResponse,
126
+ | OrqError
127
+ | ResponseValidationError
128
+ | ConnectionError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | InvalidRequestError
132
+ | UnexpectedClientError
133
+ | SDKValidationError
134
+ >(
135
+ M.json(200, components.ListMonitorPresetsResponse$inboundSchema),
136
+ M.fail("4XX"),
137
+ M.fail("5XX"),
138
+ )(response, req);
139
+ if (!result.ok) {
140
+ return [result, { status: "complete", request: req, response }];
141
+ }
142
+
143
+ return [result, { status: "complete", request: req, response }];
144
+ }
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Update a monitor
31
+ *
32
+ * @remarks
33
+ * Updates monitor metadata and widgets. With `update_mask`, listed paths are replaced and `widgets` may be explicitly cleared. Without `update_mask`, legacy behavior is preserved: a non-empty `widgets` array replaces the set and an empty or omitted array keeps it. `project_id` is immutable.
34
+ */
35
+ export function monitorsUpdate(
36
+ client: OrqCore,
37
+ request: operations.MonitorUpdateRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.UpdateMonitorResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.MonitorUpdateRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.UpdateMonitorResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.MonitorUpdateRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = encodeJSON("body", payload.UpdateMonitorRequest, {
89
+ explode: true,
90
+ });
91
+
92
+ const pathParams = {
93
+ monitor_id: encodeSimple("monitor_id", payload.monitor_id, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ };
98
+ const path = pathToFunc("/v2/monitors/{monitor_id}")(pathParams);
99
+
100
+ const headers = new Headers(compactMap({
101
+ "Content-Type": "application/json",
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "MonitorUpdate",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "PATCH",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ isErrorStatusCode: (statusCode: number) =>
142
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
143
+ retryConfig: context.retryConfig,
144
+ retryCodes: context.retryCodes,
145
+ });
146
+ if (!doResult.ok) {
147
+ return [doResult, { status: "request-error", request: req }];
148
+ }
149
+ const response = doResult.value;
150
+
151
+ const [result] = await M.match<
152
+ components.UpdateMonitorResponse,
153
+ | OrqError
154
+ | ResponseValidationError
155
+ | ConnectionError
156
+ | RequestAbortedError
157
+ | RequestTimeoutError
158
+ | InvalidRequestError
159
+ | UnexpectedClientError
160
+ | SDKValidationError
161
+ >(
162
+ M.json(200, components.UpdateMonitorResponse$inboundSchema),
163
+ M.fail("4XX"),
164
+ M.fail("5XX"),
165
+ )(response, req);
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import { OrqError } from "../models/errors/orqerror.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Create or add workspace users
31
+ *
32
+ * @remarks
33
+ * Creates accounts when necessary, adds each user to the current workspace and specified team, assigns the workspace role, and sends the welcome email for newly created accounts. Requires a Management Key with user permissions or an authenticated workspace admin session. Standard API keys are not supported.
34
+ */
35
+ export function usersCreate(
36
+ client: OrqCore,
37
+ request: operations.UserCreateRequest,
38
+ options?: RequestOptions,
39
+ ): APIPromise<
40
+ Result<
41
+ components.CreateUsersResponse,
42
+ | OrqError
43
+ | ResponseValidationError
44
+ | ConnectionError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | InvalidRequestError
48
+ | UnexpectedClientError
49
+ | SDKValidationError
50
+ >
51
+ > {
52
+ return new APIPromise($do(
53
+ client,
54
+ request,
55
+ options,
56
+ ));
57
+ }
58
+
59
+ async function $do(
60
+ client: OrqCore,
61
+ request: operations.UserCreateRequest,
62
+ options?: RequestOptions,
63
+ ): Promise<
64
+ [
65
+ Result<
66
+ components.CreateUsersResponse,
67
+ | OrqError
68
+ | ResponseValidationError
69
+ | ConnectionError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | InvalidRequestError
73
+ | UnexpectedClientError
74
+ | SDKValidationError
75
+ >,
76
+ APICall,
77
+ ]
78
+ > {
79
+ const parsed = safeParse(
80
+ request,
81
+ (value) => operations.UserCreateRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = encodeJSON("body", payload.CreateUsersRequest, {
89
+ explode: true,
90
+ });
91
+
92
+ const pathParams = {
93
+ id: encodeSimple("id", payload.team_id, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ };
98
+ const path = pathToFunc("/v3/users/{id}")(pathParams);
99
+
100
+ const headers = new Headers(compactMap({
101
+ "Content-Type": "application/json",
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const secConfig = await extractSecurity(client._options.apiKey);
106
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "UserCreate",
113
+ oAuth2Scopes: null,
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.apiKey,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "POST",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ isErrorStatusCode: (statusCode: number) =>
142
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
143
+ retryConfig: context.retryConfig,
144
+ retryCodes: context.retryCodes,
145
+ });
146
+ if (!doResult.ok) {
147
+ return [doResult, { status: "request-error", request: req }];
148
+ }
149
+ const response = doResult.value;
150
+
151
+ const [result] = await M.match<
152
+ components.CreateUsersResponse,
153
+ | OrqError
154
+ | ResponseValidationError
155
+ | ConnectionError
156
+ | RequestAbortedError
157
+ | RequestTimeoutError
158
+ | InvalidRequestError
159
+ | UnexpectedClientError
160
+ | SDKValidationError
161
+ >(
162
+ M.json(200, components.CreateUsersResponse$inboundSchema),
163
+ M.fail("4XX"),
164
+ M.fail("5XX"),
165
+ )(response, req);
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [result, { status: "complete", request: req, response }];
171
+ }