@orq-ai/node 4.15.15 → 4.15.17

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 (84) 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/createdataset.js +1 -1
  6. package/models/operations/createdatasetitem.js +5 -5
  7. package/models/operations/createtool.js +4 -4
  8. package/models/operations/getalltools.js +4 -4
  9. package/models/operations/getv2humanevalsets.js +2 -2
  10. package/models/operations/getv2humanevalsetsid.js +2 -2
  11. package/models/operations/listdatasetdatapoints.js +5 -5
  12. package/models/operations/listdatasets.js +1 -1
  13. package/models/operations/patchv2humanevalsetsid.js +2 -2
  14. package/models/operations/postv2feedbackevaluation.js +4 -4
  15. package/models/operations/postv2humanevalsets.js +2 -2
  16. package/models/operations/retrievedatapoint.js +5 -5
  17. package/models/operations/retrievedataset.js +1 -1
  18. package/models/operations/retrievetool.js +4 -4
  19. package/models/operations/runagent.js +1 -1
  20. package/models/operations/streamrunagent.js +1 -1
  21. package/models/operations/updatedatapoint.js +5 -5
  22. package/models/operations/updatedataset.js +1 -1
  23. package/models/operations/updatetool.js +4 -4
  24. package/package.json +7 -7
  25. package/packages/orq-rc/src/funcs/logsSearch.ts +1 -1
  26. package/packages/orq-rc/src/funcs/tracesSearch.ts +1 -1
  27. package/packages/orq-rc/src/funcs/viewsCreate.ts +159 -0
  28. package/packages/orq-rc/src/funcs/viewsDelete.ts +165 -0
  29. package/packages/orq-rc/src/funcs/viewsGet.ts +165 -0
  30. package/packages/orq-rc/src/funcs/viewsList.ts +168 -0
  31. package/packages/orq-rc/src/funcs/viewsUpdate.ts +166 -0
  32. package/packages/orq-rc/src/lib/config.ts +2 -2
  33. package/packages/orq-rc/src/models/components/createviewrequest.ts +64 -0
  34. package/packages/orq-rc/src/models/components/createviewresponse.ts +32 -0
  35. package/packages/orq-rc/src/models/components/deleteviewresponse.ts +27 -0
  36. package/packages/orq-rc/src/models/components/getviewresponse.ts +32 -0
  37. package/packages/orq-rc/src/models/components/index.ts +8 -0
  38. package/packages/orq-rc/src/models/components/listviewsresponse.ts +39 -0
  39. package/packages/orq-rc/src/models/components/piiredactionplugin.ts +1 -1
  40. package/packages/orq-rc/src/models/components/reasoningpart.ts +1 -1
  41. package/packages/orq-rc/src/models/components/updateviewrequest.ts +65 -0
  42. package/packages/orq-rc/src/models/components/updateviewresponse.ts +32 -0
  43. package/packages/orq-rc/src/models/components/view.ts +74 -0
  44. package/packages/orq-rc/src/models/operations/createtool.ts +4 -4
  45. package/packages/orq-rc/src/models/operations/getalltools.ts +4 -4
  46. package/packages/orq-rc/src/models/operations/getv2humanevalsets.ts +2 -2
  47. package/packages/orq-rc/src/models/operations/getv2humanevalsetsid.ts +2 -2
  48. package/packages/orq-rc/src/models/operations/index.ts +4 -0
  49. package/packages/orq-rc/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  50. package/packages/orq-rc/src/models/operations/postv2feedbackevaluation.ts +4 -4
  51. package/packages/orq-rc/src/models/operations/postv2humanevalsets.ts +2 -2
  52. package/packages/orq-rc/src/models/operations/retrievetool.ts +4 -4
  53. package/packages/orq-rc/src/models/operations/runagent.ts +1 -1
  54. package/packages/orq-rc/src/models/operations/streamrunagent.ts +1 -1
  55. package/packages/orq-rc/src/models/operations/updatetool.ts +4 -4
  56. package/packages/orq-rc/src/models/operations/viewdelete.ts +36 -0
  57. package/packages/orq-rc/src/models/operations/viewget.ts +32 -0
  58. package/packages/orq-rc/src/models/operations/viewlist.ts +44 -0
  59. package/packages/orq-rc/src/models/operations/viewupdate.ts +41 -0
  60. package/packages/orq-rc/src/sdk/logs.ts +1 -1
  61. package/packages/orq-rc/src/sdk/sdk.ts +6 -0
  62. package/packages/orq-rc/src/sdk/traces.ts +1 -1
  63. package/packages/orq-rc/src/sdk/views.ts +85 -0
  64. package/src/lib/config.ts +2 -2
  65. package/src/models/components/reasoningpart.ts +1 -1
  66. package/src/models/operations/createdataset.ts +1 -1
  67. package/src/models/operations/createdatasetitem.ts +5 -5
  68. package/src/models/operations/createtool.ts +4 -4
  69. package/src/models/operations/getalltools.ts +4 -4
  70. package/src/models/operations/getv2humanevalsets.ts +2 -2
  71. package/src/models/operations/getv2humanevalsetsid.ts +2 -2
  72. package/src/models/operations/listdatasetdatapoints.ts +5 -5
  73. package/src/models/operations/listdatasets.ts +1 -1
  74. package/src/models/operations/patchv2humanevalsetsid.ts +2 -2
  75. package/src/models/operations/postv2feedbackevaluation.ts +4 -4
  76. package/src/models/operations/postv2humanevalsets.ts +2 -2
  77. package/src/models/operations/retrievedatapoint.ts +5 -5
  78. package/src/models/operations/retrievedataset.ts +1 -1
  79. package/src/models/operations/retrievetool.ts +4 -4
  80. package/src/models/operations/runagent.ts +1 -1
  81. package/src/models/operations/streamrunagent.ts +1 -1
  82. package/src/models/operations/updatedatapoint.ts +5 -5
  83. package/src/models/operations/updatedataset.ts +1 -1
  84. package/src/models/operations/updatetool.ts +4 -4
@@ -0,0 +1,159 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { encodeJSON } 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 { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Create a saved view
30
+ */
31
+ export function viewsCreate(
32
+ client: OrqCore,
33
+ request: components.CreateViewRequest,
34
+ options?: RequestOptions,
35
+ ): APIPromise<
36
+ Result<
37
+ components.CreateViewResponse,
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
+ request,
51
+ options,
52
+ ));
53
+ }
54
+
55
+ async function $do(
56
+ client: OrqCore,
57
+ request: components.CreateViewRequest,
58
+ options?: RequestOptions,
59
+ ): Promise<
60
+ [
61
+ Result<
62
+ components.CreateViewResponse,
63
+ | OrqError
64
+ | ResponseValidationError
65
+ | ConnectionError
66
+ | RequestAbortedError
67
+ | RequestTimeoutError
68
+ | InvalidRequestError
69
+ | UnexpectedClientError
70
+ | SDKValidationError
71
+ >,
72
+ APICall,
73
+ ]
74
+ > {
75
+ const parsed = safeParse(
76
+ request,
77
+ (value) => components.CreateViewRequest$outboundSchema.parse(value),
78
+ "Input validation failed",
79
+ );
80
+ if (!parsed.ok) {
81
+ return [parsed, { status: "invalid" }];
82
+ }
83
+ const payload = parsed.value;
84
+ const body = encodeJSON("body", payload, { explode: true });
85
+
86
+ const path = pathToFunc("/v3/views")();
87
+
88
+ const headers = new Headers(compactMap({
89
+ "Content-Type": "application/json",
90
+ Accept: "application/json",
91
+ }));
92
+
93
+ const secConfig = await extractSecurity(client._options.apiKey);
94
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
95
+ const requestSecurity = resolveGlobalSecurity(securityInput);
96
+
97
+ const context = {
98
+ options: client._options,
99
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
100
+ operationID: "ViewCreate",
101
+ oAuth2Scopes: null,
102
+
103
+ resolvedSecurity: requestSecurity,
104
+
105
+ securitySource: client._options.apiKey,
106
+ retryConfig: options?.retries
107
+ || client._options.retryConfig
108
+ || { strategy: "none" },
109
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
110
+ };
111
+
112
+ const requestRes = client._createRequest(context, {
113
+ security: requestSecurity,
114
+ method: "POST",
115
+ baseURL: options?.serverURL,
116
+ path: path,
117
+ headers: headers,
118
+ body: body,
119
+ userAgent: client._options.userAgent,
120
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
121
+ }, options);
122
+ if (!requestRes.ok) {
123
+ return [requestRes, { status: "invalid" }];
124
+ }
125
+ const req = requestRes.value;
126
+
127
+ const doResult = await client._do(req, {
128
+ context,
129
+ isErrorStatusCode: (statusCode: number) =>
130
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
131
+ retryConfig: context.retryConfig,
132
+ retryCodes: context.retryCodes,
133
+ });
134
+ if (!doResult.ok) {
135
+ return [doResult, { status: "request-error", request: req }];
136
+ }
137
+ const response = doResult.value;
138
+
139
+ const [result] = await M.match<
140
+ components.CreateViewResponse,
141
+ | OrqError
142
+ | ResponseValidationError
143
+ | ConnectionError
144
+ | RequestAbortedError
145
+ | RequestTimeoutError
146
+ | InvalidRequestError
147
+ | UnexpectedClientError
148
+ | SDKValidationError
149
+ >(
150
+ M.json(200, components.CreateViewResponse$inboundSchema),
151
+ M.fail("4XX"),
152
+ M.fail("5XX"),
153
+ )(response, req);
154
+ if (!result.ok) {
155
+ return [result, { status: "complete", request: req, response }];
156
+ }
157
+
158
+ return [result, { status: "complete", request: req, response }];
159
+ }
@@ -0,0 +1,165 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { 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
+ * Delete a saved view
31
+ */
32
+ export function viewsDelete(
33
+ client: OrqCore,
34
+ request: operations.ViewDeleteRequest,
35
+ options?: RequestOptions,
36
+ ): APIPromise<
37
+ Result<
38
+ components.DeleteViewResponse,
39
+ | OrqError
40
+ | ResponseValidationError
41
+ | ConnectionError
42
+ | RequestAbortedError
43
+ | RequestTimeoutError
44
+ | InvalidRequestError
45
+ | UnexpectedClientError
46
+ | SDKValidationError
47
+ >
48
+ > {
49
+ return new APIPromise($do(
50
+ client,
51
+ request,
52
+ options,
53
+ ));
54
+ }
55
+
56
+ async function $do(
57
+ client: OrqCore,
58
+ request: operations.ViewDeleteRequest,
59
+ options?: RequestOptions,
60
+ ): Promise<
61
+ [
62
+ Result<
63
+ components.DeleteViewResponse,
64
+ | OrqError
65
+ | ResponseValidationError
66
+ | ConnectionError
67
+ | RequestAbortedError
68
+ | RequestTimeoutError
69
+ | InvalidRequestError
70
+ | UnexpectedClientError
71
+ | SDKValidationError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed = safeParse(
77
+ request,
78
+ (value) => operations.ViewDeleteRequest$outboundSchema.parse(value),
79
+ "Input validation failed",
80
+ );
81
+ if (!parsed.ok) {
82
+ return [parsed, { status: "invalid" }];
83
+ }
84
+ const payload = parsed.value;
85
+ const body = null;
86
+
87
+ const pathParams = {
88
+ view_id: encodeSimple("view_id", payload.view_id, {
89
+ explode: false,
90
+ charEncoding: "percent",
91
+ }),
92
+ };
93
+ const path = pathToFunc("/v3/views/{view_id}")(pathParams);
94
+
95
+ const headers = new Headers(compactMap({
96
+ Accept: "application/json",
97
+ }));
98
+
99
+ const secConfig = await extractSecurity(client._options.apiKey);
100
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
101
+ const requestSecurity = resolveGlobalSecurity(securityInput);
102
+
103
+ const context = {
104
+ options: client._options,
105
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
106
+ operationID: "ViewDelete",
107
+ oAuth2Scopes: null,
108
+
109
+ resolvedSecurity: requestSecurity,
110
+
111
+ securitySource: client._options.apiKey,
112
+ retryConfig: options?.retries
113
+ || client._options.retryConfig
114
+ || { strategy: "none" },
115
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
116
+ };
117
+
118
+ const requestRes = client._createRequest(context, {
119
+ security: requestSecurity,
120
+ method: "DELETE",
121
+ baseURL: options?.serverURL,
122
+ path: path,
123
+ headers: headers,
124
+ body: body,
125
+ userAgent: client._options.userAgent,
126
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
127
+ }, options);
128
+ if (!requestRes.ok) {
129
+ return [requestRes, { status: "invalid" }];
130
+ }
131
+ const req = requestRes.value;
132
+
133
+ const doResult = await client._do(req, {
134
+ context,
135
+ isErrorStatusCode: (statusCode: number) =>
136
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
137
+ retryConfig: context.retryConfig,
138
+ retryCodes: context.retryCodes,
139
+ });
140
+ if (!doResult.ok) {
141
+ return [doResult, { status: "request-error", request: req }];
142
+ }
143
+ const response = doResult.value;
144
+
145
+ const [result] = await M.match<
146
+ components.DeleteViewResponse,
147
+ | OrqError
148
+ | ResponseValidationError
149
+ | ConnectionError
150
+ | RequestAbortedError
151
+ | RequestTimeoutError
152
+ | InvalidRequestError
153
+ | UnexpectedClientError
154
+ | SDKValidationError
155
+ >(
156
+ M.json(200, components.DeleteViewResponse$inboundSchema),
157
+ M.fail("4XX"),
158
+ M.fail("5XX"),
159
+ )(response, req);
160
+ if (!result.ok) {
161
+ return [result, { status: "complete", request: req, response }];
162
+ }
163
+
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
@@ -0,0 +1,165 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { OrqCore } from "../core.js";
6
+ import { 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
+ * Retrieve a saved view
31
+ */
32
+ export function viewsGet(
33
+ client: OrqCore,
34
+ request: operations.ViewGetRequest,
35
+ options?: RequestOptions,
36
+ ): APIPromise<
37
+ Result<
38
+ components.GetViewResponse,
39
+ | OrqError
40
+ | ResponseValidationError
41
+ | ConnectionError
42
+ | RequestAbortedError
43
+ | RequestTimeoutError
44
+ | InvalidRequestError
45
+ | UnexpectedClientError
46
+ | SDKValidationError
47
+ >
48
+ > {
49
+ return new APIPromise($do(
50
+ client,
51
+ request,
52
+ options,
53
+ ));
54
+ }
55
+
56
+ async function $do(
57
+ client: OrqCore,
58
+ request: operations.ViewGetRequest,
59
+ options?: RequestOptions,
60
+ ): Promise<
61
+ [
62
+ Result<
63
+ components.GetViewResponse,
64
+ | OrqError
65
+ | ResponseValidationError
66
+ | ConnectionError
67
+ | RequestAbortedError
68
+ | RequestTimeoutError
69
+ | InvalidRequestError
70
+ | UnexpectedClientError
71
+ | SDKValidationError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed = safeParse(
77
+ request,
78
+ (value) => operations.ViewGetRequest$outboundSchema.parse(value),
79
+ "Input validation failed",
80
+ );
81
+ if (!parsed.ok) {
82
+ return [parsed, { status: "invalid" }];
83
+ }
84
+ const payload = parsed.value;
85
+ const body = null;
86
+
87
+ const pathParams = {
88
+ view_id: encodeSimple("view_id", payload.view_id, {
89
+ explode: false,
90
+ charEncoding: "percent",
91
+ }),
92
+ };
93
+ const path = pathToFunc("/v3/views/{view_id}")(pathParams);
94
+
95
+ const headers = new Headers(compactMap({
96
+ Accept: "application/json",
97
+ }));
98
+
99
+ const secConfig = await extractSecurity(client._options.apiKey);
100
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
101
+ const requestSecurity = resolveGlobalSecurity(securityInput);
102
+
103
+ const context = {
104
+ options: client._options,
105
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
106
+ operationID: "ViewGet",
107
+ oAuth2Scopes: null,
108
+
109
+ resolvedSecurity: requestSecurity,
110
+
111
+ securitySource: client._options.apiKey,
112
+ retryConfig: options?.retries
113
+ || client._options.retryConfig
114
+ || { strategy: "none" },
115
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
116
+ };
117
+
118
+ const requestRes = client._createRequest(context, {
119
+ security: requestSecurity,
120
+ method: "GET",
121
+ baseURL: options?.serverURL,
122
+ path: path,
123
+ headers: headers,
124
+ body: body,
125
+ userAgent: client._options.userAgent,
126
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
127
+ }, options);
128
+ if (!requestRes.ok) {
129
+ return [requestRes, { status: "invalid" }];
130
+ }
131
+ const req = requestRes.value;
132
+
133
+ const doResult = await client._do(req, {
134
+ context,
135
+ isErrorStatusCode: (statusCode: number) =>
136
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
137
+ retryConfig: context.retryConfig,
138
+ retryCodes: context.retryCodes,
139
+ });
140
+ if (!doResult.ok) {
141
+ return [doResult, { status: "request-error", request: req }];
142
+ }
143
+ const response = doResult.value;
144
+
145
+ const [result] = await M.match<
146
+ components.GetViewResponse,
147
+ | OrqError
148
+ | ResponseValidationError
149
+ | ConnectionError
150
+ | RequestAbortedError
151
+ | RequestTimeoutError
152
+ | InvalidRequestError
153
+ | UnexpectedClientError
154
+ | SDKValidationError
155
+ >(
156
+ M.json(200, components.GetViewResponse$inboundSchema),
157
+ M.fail("4XX"),
158
+ M.fail("5XX"),
159
+ )(response, req);
160
+ if (!result.ok) {
161
+ return [result, { status: "complete", request: req, response }];
162
+ }
163
+
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
@@ -0,0 +1,168 @@
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 visible saved views
31
+ */
32
+ export function viewsList(
33
+ client: OrqCore,
34
+ request?: operations.ViewListRequest | undefined,
35
+ options?: RequestOptions,
36
+ ): APIPromise<
37
+ Result<
38
+ components.ListViewsResponse,
39
+ | OrqError
40
+ | ResponseValidationError
41
+ | ConnectionError
42
+ | RequestAbortedError
43
+ | RequestTimeoutError
44
+ | InvalidRequestError
45
+ | UnexpectedClientError
46
+ | SDKValidationError
47
+ >
48
+ > {
49
+ return new APIPromise($do(
50
+ client,
51
+ request,
52
+ options,
53
+ ));
54
+ }
55
+
56
+ async function $do(
57
+ client: OrqCore,
58
+ request?: operations.ViewListRequest | undefined,
59
+ options?: RequestOptions,
60
+ ): Promise<
61
+ [
62
+ Result<
63
+ components.ListViewsResponse,
64
+ | OrqError
65
+ | ResponseValidationError
66
+ | ConnectionError
67
+ | RequestAbortedError
68
+ | RequestTimeoutError
69
+ | InvalidRequestError
70
+ | UnexpectedClientError
71
+ | SDKValidationError
72
+ >,
73
+ APICall,
74
+ ]
75
+ > {
76
+ const parsed = safeParse(
77
+ request,
78
+ (value) =>
79
+ operations.ViewListRequest$outboundSchema.optional().parse(value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = null;
87
+
88
+ const path = pathToFunc("/v3/views")();
89
+
90
+ const query = encodeFormQuery({
91
+ "ending_before": payload?.ending_before,
92
+ "limit": payload?.limit,
93
+ "page": payload?.page,
94
+ "starting_after": payload?.starting_after,
95
+ });
96
+
97
+ const headers = new Headers(compactMap({
98
+ Accept: "application/json",
99
+ }));
100
+
101
+ const secConfig = await extractSecurity(client._options.apiKey);
102
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
103
+ const requestSecurity = resolveGlobalSecurity(securityInput);
104
+
105
+ const context = {
106
+ options: client._options,
107
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
108
+ operationID: "ViewList",
109
+ oAuth2Scopes: null,
110
+
111
+ resolvedSecurity: requestSecurity,
112
+
113
+ securitySource: client._options.apiKey,
114
+ retryConfig: options?.retries
115
+ || client._options.retryConfig
116
+ || { strategy: "none" },
117
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
118
+ };
119
+
120
+ const requestRes = client._createRequest(context, {
121
+ security: requestSecurity,
122
+ method: "GET",
123
+ baseURL: options?.serverURL,
124
+ path: path,
125
+ headers: headers,
126
+ query: query,
127
+ body: body,
128
+ userAgent: client._options.userAgent,
129
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
130
+ }, options);
131
+ if (!requestRes.ok) {
132
+ return [requestRes, { status: "invalid" }];
133
+ }
134
+ const req = requestRes.value;
135
+
136
+ const doResult = await client._do(req, {
137
+ context,
138
+ isErrorStatusCode: (statusCode: number) =>
139
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
140
+ retryConfig: context.retryConfig,
141
+ retryCodes: context.retryCodes,
142
+ });
143
+ if (!doResult.ok) {
144
+ return [doResult, { status: "request-error", request: req }];
145
+ }
146
+ const response = doResult.value;
147
+
148
+ const [result] = await M.match<
149
+ components.ListViewsResponse,
150
+ | OrqError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, components.ListViewsResponse$inboundSchema),
160
+ M.fail("4XX"),
161
+ M.fail("5XX"),
162
+ )(response, req);
163
+ if (!result.ok) {
164
+ return [result, { status: "complete", request: req, response }];
165
+ }
166
+
167
+ return [result, { status: "complete", request: req, response }];
168
+ }