@orq-ai/node 3.1.3 → 3.1.4

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 (149) hide show
  1. package/README.md +8 -23
  2. package/docs/sdks/files/README.md +8 -8
  3. package/docs/sdks/{remoteconfig → remoteconfigs}/README.md +8 -8
  4. package/funcs/{filesUpload.d.ts → filesCreate.d.ts} +3 -3
  5. package/funcs/{filesUpload.d.ts.map → filesCreate.d.ts.map} +1 -1
  6. package/funcs/{filesUpload.js → filesCreate.js} +4 -4
  7. package/funcs/{filesUpload.js.map → filesCreate.js.map} +1 -1
  8. package/funcs/filesGet.d.ts +4 -1
  9. package/funcs/filesGet.d.ts.map +1 -1
  10. package/funcs/filesGet.js +4 -1
  11. package/funcs/filesGet.js.map +1 -1
  12. package/funcs/filesList.d.ts +3 -0
  13. package/funcs/filesList.d.ts.map +1 -1
  14. package/funcs/filesList.js +5 -3
  15. package/funcs/filesList.js.map +1 -1
  16. package/funcs/{remoteconfigGetConfig.d.ts → remoteconfigsRetrieve.d.ts} +3 -3
  17. package/funcs/{remoteconfigGetConfig.d.ts.map → remoteconfigsRetrieve.d.ts.map} +1 -1
  18. package/funcs/{remoteconfigGetConfig.js → remoteconfigsRetrieve.js} +4 -4
  19. package/funcs/{remoteconfigGetConfig.js.map → remoteconfigsRetrieve.js.map} +1 -1
  20. package/jsr.json +1 -1
  21. package/lib/config.d.ts +2 -2
  22. package/lib/config.js +2 -2
  23. package/models/errors/index.d.ts +0 -1
  24. package/models/errors/index.d.ts.map +1 -1
  25. package/models/errors/index.js +0 -1
  26. package/models/errors/index.js.map +1 -1
  27. package/models/operations/createcontact.js +2 -2
  28. package/models/operations/createprompt.d.ts +348 -348
  29. package/models/operations/createprompt.d.ts.map +1 -1
  30. package/models/operations/createprompt.js +486 -483
  31. package/models/operations/createprompt.js.map +1 -1
  32. package/models/operations/fileget.js +2 -2
  33. package/models/operations/filelist.d.ts +13 -6
  34. package/models/operations/filelist.d.ts.map +1 -1
  35. package/models/operations/filelist.js +18 -10
  36. package/models/operations/filelist.js.map +1 -1
  37. package/models/operations/fileupload.js +2 -2
  38. package/models/operations/index.d.ts +0 -6
  39. package/models/operations/index.d.ts.map +1 -1
  40. package/models/operations/index.js +0 -6
  41. package/models/operations/index.js.map +1 -1
  42. package/models/operations/updateprompt.d.ts +30 -30
  43. package/models/operations/updateprompt.d.ts.map +1 -1
  44. package/models/operations/updateprompt.js +38 -38
  45. package/models/operations/updateprompt.js.map +1 -1
  46. package/package.json +1 -1
  47. package/sdk/files.d.ts +9 -3
  48. package/sdk/files.d.ts.map +1 -1
  49. package/sdk/files.js +11 -5
  50. package/sdk/files.js.map +1 -1
  51. package/sdk/remoteconfigs.d.ts +9 -0
  52. package/sdk/remoteconfigs.d.ts.map +1 -0
  53. package/sdk/remoteconfigs.js +19 -0
  54. package/sdk/remoteconfigs.js.map +1 -0
  55. package/sdk/sdk.d.ts +3 -6
  56. package/sdk/sdk.d.ts.map +1 -1
  57. package/sdk/sdk.js +3 -7
  58. package/sdk/sdk.js.map +1 -1
  59. package/src/funcs/{filesUpload.ts → filesCreate.ts} +2 -2
  60. package/src/funcs/filesGet.ts +4 -1
  61. package/src/funcs/filesList.ts +5 -3
  62. package/src/funcs/{remoteconfigGetConfig.ts → remoteconfigsRetrieve.ts} +2 -2
  63. package/src/lib/config.ts +2 -2
  64. package/src/models/errors/index.ts +0 -1
  65. package/src/models/operations/createcontact.ts +2 -2
  66. package/src/models/operations/createprompt.ts +668 -770
  67. package/src/models/operations/fileget.ts +2 -2
  68. package/src/models/operations/filelist.ts +31 -16
  69. package/src/models/operations/fileupload.ts +2 -2
  70. package/src/models/operations/index.ts +0 -6
  71. package/src/models/operations/updateprompt.ts +64 -81
  72. package/src/sdk/files.ts +11 -5
  73. package/src/sdk/{remoteconfig.ts → remoteconfigs.ts} +5 -5
  74. package/src/sdk/sdk.ts +4 -10
  75. package/docs/sdks/promptsnippets/README.md +0 -488
  76. package/funcs/promptSnippetsCreate.d.ts +0 -12
  77. package/funcs/promptSnippetsCreate.d.ts.map +0 -1
  78. package/funcs/promptSnippetsCreate.js +0 -106
  79. package/funcs/promptSnippetsCreate.js.map +0 -1
  80. package/funcs/promptSnippetsDelete.d.ts +0 -12
  81. package/funcs/promptSnippetsDelete.d.ts.map +0 -1
  82. package/funcs/promptSnippetsDelete.js +0 -110
  83. package/funcs/promptSnippetsDelete.js.map +0 -1
  84. package/funcs/promptSnippetsGet.d.ts +0 -12
  85. package/funcs/promptSnippetsGet.d.ts.map +0 -1
  86. package/funcs/promptSnippetsGet.js +0 -109
  87. package/funcs/promptSnippetsGet.js.map +0 -1
  88. package/funcs/promptSnippetsGetByKey.d.ts +0 -12
  89. package/funcs/promptSnippetsGetByKey.d.ts.map +0 -1
  90. package/funcs/promptSnippetsGetByKey.js +0 -109
  91. package/funcs/promptSnippetsGetByKey.js.map +0 -1
  92. package/funcs/promptSnippetsList.d.ts +0 -12
  93. package/funcs/promptSnippetsList.d.ts.map +0 -1
  94. package/funcs/promptSnippetsList.js +0 -109
  95. package/funcs/promptSnippetsList.js.map +0 -1
  96. package/funcs/promptSnippetsUpdate.d.ts +0 -13
  97. package/funcs/promptSnippetsUpdate.d.ts.map +0 -1
  98. package/funcs/promptSnippetsUpdate.js +0 -114
  99. package/funcs/promptSnippetsUpdate.js.map +0 -1
  100. package/models/errors/updatepromptsnippet.d.ts +0 -36
  101. package/models/errors/updatepromptsnippet.d.ts.map +0 -1
  102. package/models/errors/updatepromptsnippet.js +0 -79
  103. package/models/errors/updatepromptsnippet.js.map +0 -1
  104. package/models/operations/createpromptsnippet.d.ts +0 -3567
  105. package/models/operations/createpromptsnippet.d.ts.map +0 -1
  106. package/models/operations/createpromptsnippet.js +0 -3056
  107. package/models/operations/createpromptsnippet.js.map +0 -1
  108. package/models/operations/deletepromptsnippet.d.ts +0 -32
  109. package/models/operations/deletepromptsnippet.d.ts.map +0 -1
  110. package/models/operations/deletepromptsnippet.js +0 -69
  111. package/models/operations/deletepromptsnippet.js.map +0 -1
  112. package/models/operations/findonebykeypromptsnippet.d.ts +0 -2448
  113. package/models/operations/findonebykeypromptsnippet.d.ts.map +0 -1
  114. package/models/operations/findonebykeypromptsnippet.js +0 -2133
  115. package/models/operations/findonebykeypromptsnippet.js.map +0 -1
  116. package/models/operations/findonepromptsnippet.d.ts +0 -2448
  117. package/models/operations/findonepromptsnippet.d.ts.map +0 -1
  118. package/models/operations/findonepromptsnippet.js +0 -2124
  119. package/models/operations/findonepromptsnippet.js.map +0 -1
  120. package/models/operations/getallpromptsnippets.d.ts +0 -2512
  121. package/models/operations/getallpromptsnippets.d.ts.map +0 -1
  122. package/models/operations/getallpromptsnippets.js +0 -2195
  123. package/models/operations/getallpromptsnippets.js.map +0 -1
  124. package/models/operations/updatepromptsnippet.d.ts +0 -3595
  125. package/models/operations/updatepromptsnippet.d.ts.map +0 -1
  126. package/models/operations/updatepromptsnippet.js +0 -3116
  127. package/models/operations/updatepromptsnippet.js.map +0 -1
  128. package/sdk/promptsnippets.d.ts +0 -29
  129. package/sdk/promptsnippets.d.ts.map +0 -1
  130. package/sdk/promptsnippets.js +0 -54
  131. package/sdk/promptsnippets.js.map +0 -1
  132. package/sdk/remoteconfig.d.ts +0 -9
  133. package/sdk/remoteconfig.d.ts.map +0 -1
  134. package/sdk/remoteconfig.js +0 -19
  135. package/sdk/remoteconfig.js.map +0 -1
  136. package/src/funcs/promptSnippetsCreate.ts +0 -128
  137. package/src/funcs/promptSnippetsDelete.ts +0 -131
  138. package/src/funcs/promptSnippetsGet.ts +0 -130
  139. package/src/funcs/promptSnippetsGetByKey.ts +0 -132
  140. package/src/funcs/promptSnippetsList.ts +0 -132
  141. package/src/funcs/promptSnippetsUpdate.ts +0 -139
  142. package/src/models/errors/updatepromptsnippet.ts +0 -71
  143. package/src/models/operations/createpromptsnippet.ts +0 -6239
  144. package/src/models/operations/deletepromptsnippet.ts +0 -69
  145. package/src/models/operations/findonebykeypromptsnippet.ts +0 -4483
  146. package/src/models/operations/findonepromptsnippet.ts +0 -4343
  147. package/src/models/operations/getallpromptsnippets.ts +0 -4472
  148. package/src/models/operations/updatepromptsnippet.ts +0 -6544
  149. package/src/sdk/promptsnippets.ts +0 -99
@@ -1,130 +0,0 @@
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 * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import { APIError } from "../models/errors/apierror.js";
14
- import {
15
- ConnectionError,
16
- InvalidRequestError,
17
- RequestAbortedError,
18
- RequestTimeoutError,
19
- UnexpectedClientError,
20
- } from "../models/errors/httpclienterrors.js";
21
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
- import * as operations from "../models/operations/index.js";
23
- import { Result } from "../types/fp.js";
24
-
25
- /**
26
- * Retrieve a prompt snippet
27
- */
28
- export async function promptSnippetsGet(
29
- client: OrqCore,
30
- request: operations.FindOnePromptSnippetRequest,
31
- options?: RequestOptions,
32
- ): Promise<
33
- Result<
34
- operations.FindOnePromptSnippetResponseBody,
35
- | APIError
36
- | SDKValidationError
37
- | UnexpectedClientError
38
- | InvalidRequestError
39
- | RequestAbortedError
40
- | RequestTimeoutError
41
- | ConnectionError
42
- >
43
- > {
44
- const parsed = safeParse(
45
- request,
46
- (value) =>
47
- operations.FindOnePromptSnippetRequest$outboundSchema.parse(value),
48
- "Input validation failed",
49
- );
50
- if (!parsed.ok) {
51
- return parsed;
52
- }
53
- const payload = parsed.value;
54
- const body = null;
55
-
56
- const pathParams = {
57
- id: encodeSimple("id", payload.id, {
58
- explode: false,
59
- charEncoding: "percent",
60
- }),
61
- };
62
-
63
- const path = pathToFunc("/v2/resources/prompts/snippets/{id}")(pathParams);
64
-
65
- const headers = new Headers(compactMap({
66
- Accept: "application/json",
67
- }));
68
-
69
- const secConfig = await extractSecurity(client._options.apiKey);
70
- const securityInput = secConfig == null ? {} : { apiKey: secConfig };
71
- const requestSecurity = resolveGlobalSecurity(securityInput);
72
-
73
- const context = {
74
- operationID: "FindOnePromptSnippet",
75
- oAuth2Scopes: [],
76
-
77
- resolvedSecurity: requestSecurity,
78
-
79
- securitySource: client._options.apiKey,
80
- retryConfig: options?.retries
81
- || client._options.retryConfig
82
- || { strategy: "none" },
83
- retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
84
- };
85
-
86
- const requestRes = client._createRequest(context, {
87
- security: requestSecurity,
88
- method: "GET",
89
- baseURL: options?.serverURL,
90
- path: path,
91
- headers: headers,
92
- body: body,
93
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
94
- }, options);
95
- if (!requestRes.ok) {
96
- return requestRes;
97
- }
98
- const req = requestRes.value;
99
-
100
- const doResult = await client._do(req, {
101
- context,
102
- errorCodes: ["400", "404", "4XX", "5XX"],
103
- retryConfig: context.retryConfig,
104
- retryCodes: context.retryCodes,
105
- });
106
- if (!doResult.ok) {
107
- return doResult;
108
- }
109
- const response = doResult.value;
110
-
111
- const [result] = await M.match<
112
- operations.FindOnePromptSnippetResponseBody,
113
- | APIError
114
- | SDKValidationError
115
- | UnexpectedClientError
116
- | InvalidRequestError
117
- | RequestAbortedError
118
- | RequestTimeoutError
119
- | ConnectionError
120
- >(
121
- M.json(200, operations.FindOnePromptSnippetResponseBody$inboundSchema),
122
- M.fail([400, 404, "4XX"]),
123
- M.fail("5XX"),
124
- )(response);
125
- if (!result.ok) {
126
- return result;
127
- }
128
-
129
- return result;
130
- }
@@ -1,132 +0,0 @@
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 * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import { APIError } from "../models/errors/apierror.js";
14
- import {
15
- ConnectionError,
16
- InvalidRequestError,
17
- RequestAbortedError,
18
- RequestTimeoutError,
19
- UnexpectedClientError,
20
- } from "../models/errors/httpclienterrors.js";
21
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
- import * as operations from "../models/operations/index.js";
23
- import { Result } from "../types/fp.js";
24
-
25
- /**
26
- * Retrieve a prompt snippet by key
27
- */
28
- export async function promptSnippetsGetByKey(
29
- client: OrqCore,
30
- request: operations.FindOneByKeyPromptSnippetRequest,
31
- options?: RequestOptions,
32
- ): Promise<
33
- Result<
34
- operations.FindOneByKeyPromptSnippetResponseBody,
35
- | APIError
36
- | SDKValidationError
37
- | UnexpectedClientError
38
- | InvalidRequestError
39
- | RequestAbortedError
40
- | RequestTimeoutError
41
- | ConnectionError
42
- >
43
- > {
44
- const parsed = safeParse(
45
- request,
46
- (value) =>
47
- operations.FindOneByKeyPromptSnippetRequest$outboundSchema.parse(value),
48
- "Input validation failed",
49
- );
50
- if (!parsed.ok) {
51
- return parsed;
52
- }
53
- const payload = parsed.value;
54
- const body = null;
55
-
56
- const pathParams = {
57
- key: encodeSimple("key", payload.key, {
58
- explode: false,
59
- charEncoding: "percent",
60
- }),
61
- };
62
-
63
- const path = pathToFunc("/v2/resources/prompts/snippets/key/{key}")(
64
- pathParams,
65
- );
66
-
67
- const headers = new Headers(compactMap({
68
- Accept: "application/json",
69
- }));
70
-
71
- const secConfig = await extractSecurity(client._options.apiKey);
72
- const securityInput = secConfig == null ? {} : { apiKey: secConfig };
73
- const requestSecurity = resolveGlobalSecurity(securityInput);
74
-
75
- const context = {
76
- operationID: "FindOneByKeyPromptSnippet",
77
- oAuth2Scopes: [],
78
-
79
- resolvedSecurity: requestSecurity,
80
-
81
- securitySource: client._options.apiKey,
82
- retryConfig: options?.retries
83
- || client._options.retryConfig
84
- || { strategy: "none" },
85
- retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
86
- };
87
-
88
- const requestRes = client._createRequest(context, {
89
- security: requestSecurity,
90
- method: "GET",
91
- baseURL: options?.serverURL,
92
- path: path,
93
- headers: headers,
94
- body: body,
95
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
96
- }, options);
97
- if (!requestRes.ok) {
98
- return requestRes;
99
- }
100
- const req = requestRes.value;
101
-
102
- const doResult = await client._do(req, {
103
- context,
104
- errorCodes: ["400", "404", "4XX", "5XX"],
105
- retryConfig: context.retryConfig,
106
- retryCodes: context.retryCodes,
107
- });
108
- if (!doResult.ok) {
109
- return doResult;
110
- }
111
- const response = doResult.value;
112
-
113
- const [result] = await M.match<
114
- operations.FindOneByKeyPromptSnippetResponseBody,
115
- | APIError
116
- | SDKValidationError
117
- | UnexpectedClientError
118
- | InvalidRequestError
119
- | RequestAbortedError
120
- | RequestTimeoutError
121
- | ConnectionError
122
- >(
123
- M.json(200, operations.FindOneByKeyPromptSnippetResponseBody$inboundSchema),
124
- M.fail([400, 404, "4XX"]),
125
- M.fail("5XX"),
126
- )(response);
127
- if (!result.ok) {
128
- return result;
129
- }
130
-
131
- return result;
132
- }
@@ -1,132 +0,0 @@
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 * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import { APIError } from "../models/errors/apierror.js";
14
- import {
15
- ConnectionError,
16
- InvalidRequestError,
17
- RequestAbortedError,
18
- RequestTimeoutError,
19
- UnexpectedClientError,
20
- } from "../models/errors/httpclienterrors.js";
21
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
- import * as operations from "../models/operations/index.js";
23
- import { Result } from "../types/fp.js";
24
-
25
- /**
26
- * List all prompts snippets
27
- */
28
- export async function promptSnippetsList(
29
- client: OrqCore,
30
- request?: operations.GetAllPromptSnippetsRequest | undefined,
31
- options?: RequestOptions,
32
- ): Promise<
33
- Result<
34
- operations.GetAllPromptSnippetsResponseBody,
35
- | APIError
36
- | SDKValidationError
37
- | UnexpectedClientError
38
- | InvalidRequestError
39
- | RequestAbortedError
40
- | RequestTimeoutError
41
- | ConnectionError
42
- >
43
- > {
44
- const parsed = safeParse(
45
- request,
46
- (value) =>
47
- operations.GetAllPromptSnippetsRequest$outboundSchema.optional().parse(
48
- value,
49
- ),
50
- "Input validation failed",
51
- );
52
- if (!parsed.ok) {
53
- return parsed;
54
- }
55
- const payload = parsed.value;
56
- const body = null;
57
-
58
- const path = pathToFunc("/v2/resources/prompts/snippets/")();
59
-
60
- const query = encodeFormQuery({
61
- "ending_before": payload?.ending_before,
62
- "limit": payload?.limit,
63
- "starting_after": payload?.starting_after,
64
- });
65
-
66
- const headers = new Headers(compactMap({
67
- Accept: "application/json",
68
- }));
69
-
70
- const secConfig = await extractSecurity(client._options.apiKey);
71
- const securityInput = secConfig == null ? {} : { apiKey: secConfig };
72
- const requestSecurity = resolveGlobalSecurity(securityInput);
73
-
74
- const context = {
75
- operationID: "GetAllPromptSnippets",
76
- oAuth2Scopes: [],
77
-
78
- resolvedSecurity: requestSecurity,
79
-
80
- securitySource: client._options.apiKey,
81
- retryConfig: options?.retries
82
- || client._options.retryConfig
83
- || { strategy: "none" },
84
- retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
85
- };
86
-
87
- const requestRes = client._createRequest(context, {
88
- security: requestSecurity,
89
- method: "GET",
90
- baseURL: options?.serverURL,
91
- path: path,
92
- headers: headers,
93
- query: query,
94
- body: body,
95
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
96
- }, options);
97
- if (!requestRes.ok) {
98
- return requestRes;
99
- }
100
- const req = requestRes.value;
101
-
102
- const doResult = await client._do(req, {
103
- context,
104
- errorCodes: ["4XX", "5XX"],
105
- retryConfig: context.retryConfig,
106
- retryCodes: context.retryCodes,
107
- });
108
- if (!doResult.ok) {
109
- return doResult;
110
- }
111
- const response = doResult.value;
112
-
113
- const [result] = await M.match<
114
- operations.GetAllPromptSnippetsResponseBody,
115
- | APIError
116
- | SDKValidationError
117
- | UnexpectedClientError
118
- | InvalidRequestError
119
- | RequestAbortedError
120
- | RequestTimeoutError
121
- | ConnectionError
122
- >(
123
- M.json(200, operations.GetAllPromptSnippetsResponseBody$inboundSchema),
124
- M.fail("4XX"),
125
- M.fail("5XX"),
126
- )(response);
127
- if (!result.ok) {
128
- return result;
129
- }
130
-
131
- return result;
132
- }
@@ -1,139 +0,0 @@
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 * as M from "../lib/matchers.js";
8
- import { compactMap } from "../lib/primitives.js";
9
- import { safeParse } from "../lib/schemas.js";
10
- import { RequestOptions } from "../lib/sdks.js";
11
- import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
- import { pathToFunc } from "../lib/url.js";
13
- import { APIError } from "../models/errors/apierror.js";
14
- import {
15
- ConnectionError,
16
- InvalidRequestError,
17
- RequestAbortedError,
18
- RequestTimeoutError,
19
- UnexpectedClientError,
20
- } from "../models/errors/httpclienterrors.js";
21
- import * as errors from "../models/errors/index.js";
22
- import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
- import * as operations from "../models/operations/index.js";
24
- import { Result } from "../types/fp.js";
25
-
26
- /**
27
- * Update a prompt snippet
28
- */
29
- export async function promptSnippetsUpdate(
30
- client: OrqCore,
31
- request: operations.UpdatePromptSnippetRequest,
32
- options?: RequestOptions,
33
- ): Promise<
34
- Result<
35
- operations.UpdatePromptSnippetResponseBody,
36
- | errors.UpdatePromptSnippetResponseBody
37
- | APIError
38
- | SDKValidationError
39
- | UnexpectedClientError
40
- | InvalidRequestError
41
- | RequestAbortedError
42
- | RequestTimeoutError
43
- | ConnectionError
44
- >
45
- > {
46
- const parsed = safeParse(
47
- request,
48
- (value) =>
49
- operations.UpdatePromptSnippetRequest$outboundSchema.parse(value),
50
- "Input validation failed",
51
- );
52
- if (!parsed.ok) {
53
- return parsed;
54
- }
55
- const payload = parsed.value;
56
- const body = encodeJSON("body", payload.RequestBody, { explode: true });
57
-
58
- const pathParams = {
59
- id: encodeSimple("id", payload.id, {
60
- explode: false,
61
- charEncoding: "percent",
62
- }),
63
- };
64
-
65
- const path = pathToFunc("/v2/resources/prompts/snippets/{id}")(pathParams);
66
-
67
- const headers = new Headers(compactMap({
68
- "Content-Type": "application/json",
69
- Accept: "application/json",
70
- }));
71
-
72
- const secConfig = await extractSecurity(client._options.apiKey);
73
- const securityInput = secConfig == null ? {} : { apiKey: secConfig };
74
- const requestSecurity = resolveGlobalSecurity(securityInput);
75
-
76
- const context = {
77
- operationID: "UpdatePromptSnippet",
78
- oAuth2Scopes: [],
79
-
80
- resolvedSecurity: requestSecurity,
81
-
82
- securitySource: client._options.apiKey,
83
- retryConfig: options?.retries
84
- || client._options.retryConfig
85
- || { strategy: "none" },
86
- retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
87
- };
88
-
89
- const requestRes = client._createRequest(context, {
90
- security: requestSecurity,
91
- method: "PATCH",
92
- baseURL: options?.serverURL,
93
- path: path,
94
- headers: headers,
95
- body: body,
96
- timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
97
- }, options);
98
- if (!requestRes.ok) {
99
- return requestRes;
100
- }
101
- const req = requestRes.value;
102
-
103
- const doResult = await client._do(req, {
104
- context,
105
- errorCodes: ["404", "4XX", "5XX"],
106
- retryConfig: context.retryConfig,
107
- retryCodes: context.retryCodes,
108
- });
109
- if (!doResult.ok) {
110
- return doResult;
111
- }
112
- const response = doResult.value;
113
-
114
- const responseFields = {
115
- HttpMeta: { Response: response, Request: req },
116
- };
117
-
118
- const [result] = await M.match<
119
- operations.UpdatePromptSnippetResponseBody,
120
- | errors.UpdatePromptSnippetResponseBody
121
- | APIError
122
- | SDKValidationError
123
- | UnexpectedClientError
124
- | InvalidRequestError
125
- | RequestAbortedError
126
- | RequestTimeoutError
127
- | ConnectionError
128
- >(
129
- M.json(200, operations.UpdatePromptSnippetResponseBody$inboundSchema),
130
- M.jsonErr(404, errors.UpdatePromptSnippetResponseBody$inboundSchema),
131
- M.fail("4XX"),
132
- M.fail("5XX"),
133
- )(response, { extraFields: responseFields });
134
- if (!result.ok) {
135
- return result;
136
- }
137
-
138
- return result;
139
- }
@@ -1,71 +0,0 @@
1
- /*
2
- * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
- */
4
-
5
- import * as z from "zod";
6
-
7
- /**
8
- * Prompt snippet not found.
9
- */
10
- export type UpdatePromptSnippetResponseBodyData = {
11
- message: string;
12
- };
13
-
14
- /**
15
- * Prompt snippet not found.
16
- */
17
- export class UpdatePromptSnippetResponseBody extends Error {
18
- /** The original data that was passed to this error instance. */
19
- data$: UpdatePromptSnippetResponseBodyData;
20
-
21
- constructor(err: UpdatePromptSnippetResponseBodyData) {
22
- const message = "message" in err && typeof err.message === "string"
23
- ? err.message
24
- : `API error occurred: ${JSON.stringify(err)}`;
25
- super(message);
26
- this.data$ = err;
27
-
28
- this.name = "UpdatePromptSnippetResponseBody";
29
- }
30
- }
31
-
32
- /** @internal */
33
- export const UpdatePromptSnippetResponseBody$inboundSchema: z.ZodType<
34
- UpdatePromptSnippetResponseBody,
35
- z.ZodTypeDef,
36
- unknown
37
- > = z.object({
38
- message: z.string(),
39
- })
40
- .transform((v) => {
41
- return new UpdatePromptSnippetResponseBody(v);
42
- });
43
-
44
- /** @internal */
45
- export type UpdatePromptSnippetResponseBody$Outbound = {
46
- message: string;
47
- };
48
-
49
- /** @internal */
50
- export const UpdatePromptSnippetResponseBody$outboundSchema: z.ZodType<
51
- UpdatePromptSnippetResponseBody$Outbound,
52
- z.ZodTypeDef,
53
- UpdatePromptSnippetResponseBody
54
- > = z.instanceof(UpdatePromptSnippetResponseBody)
55
- .transform(v => v.data$)
56
- .pipe(z.object({
57
- message: z.string(),
58
- }));
59
-
60
- /**
61
- * @internal
62
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
63
- */
64
- export namespace UpdatePromptSnippetResponseBody$ {
65
- /** @deprecated use `UpdatePromptSnippetResponseBody$inboundSchema` instead. */
66
- export const inboundSchema = UpdatePromptSnippetResponseBody$inboundSchema;
67
- /** @deprecated use `UpdatePromptSnippetResponseBody$outboundSchema` instead. */
68
- export const outboundSchema = UpdatePromptSnippetResponseBody$outboundSchema;
69
- /** @deprecated use `UpdatePromptSnippetResponseBody$Outbound` instead. */
70
- export type Outbound = UpdatePromptSnippetResponseBody$Outbound;
71
- }