@ominity/api-typescript 1.1.5 → 1.2.0

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 (242) hide show
  1. package/README.md +1 -0
  2. package/dist/commonjs/funcs/cms/contentCreate.d.ts +11 -0
  3. package/dist/commonjs/funcs/cms/contentCreate.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/cms/contentCreate.js +110 -0
  5. package/dist/commonjs/funcs/cms/contentCreate.js.map +1 -0
  6. package/dist/commonjs/funcs/cms/contentDelete.d.ts +10 -0
  7. package/dist/commonjs/funcs/cms/contentDelete.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/cms/contentDelete.js +110 -0
  9. package/dist/commonjs/funcs/cms/contentDelete.js.map +1 -0
  10. package/dist/commonjs/funcs/cms/contentGet.d.ts +11 -0
  11. package/dist/commonjs/funcs/cms/contentGet.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/cms/contentGet.js +110 -0
  13. package/dist/commonjs/funcs/cms/contentGet.js.map +1 -0
  14. package/dist/commonjs/funcs/cms/contentList.d.ts +11 -0
  15. package/dist/commonjs/funcs/cms/contentList.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/cms/contentList.js +117 -0
  17. package/dist/commonjs/funcs/cms/contentList.js.map +1 -0
  18. package/dist/commonjs/funcs/cms/contentTypesGet.d.ts +10 -0
  19. package/dist/commonjs/funcs/cms/contentTypesGet.d.ts.map +1 -0
  20. package/dist/commonjs/funcs/cms/contentTypesGet.js +114 -0
  21. package/dist/commonjs/funcs/cms/contentTypesGet.js.map +1 -0
  22. package/dist/commonjs/funcs/cms/contentTypesList.d.ts +10 -0
  23. package/dist/commonjs/funcs/cms/contentTypesList.d.ts.map +1 -0
  24. package/dist/commonjs/funcs/cms/contentTypesList.js +121 -0
  25. package/dist/commonjs/funcs/cms/contentTypesList.js.map +1 -0
  26. package/dist/commonjs/funcs/cms/contentUpdate.d.ts +11 -0
  27. package/dist/commonjs/funcs/cms/contentUpdate.d.ts.map +1 -0
  28. package/dist/commonjs/funcs/cms/contentUpdate.js +111 -0
  29. package/dist/commonjs/funcs/cms/contentUpdate.js.map +1 -0
  30. package/dist/commonjs/funcs/cms/index.d.ts +7 -0
  31. package/dist/commonjs/funcs/cms/index.d.ts.map +1 -1
  32. package/dist/commonjs/funcs/cms/index.js +7 -0
  33. package/dist/commonjs/funcs/cms/index.js.map +1 -1
  34. package/dist/commonjs/funcs/index.d.ts +1 -0
  35. package/dist/commonjs/funcs/index.d.ts.map +1 -1
  36. package/dist/commonjs/funcs/index.js +1 -0
  37. package/dist/commonjs/funcs/index.js.map +1 -1
  38. package/dist/commonjs/index.d.ts +1 -0
  39. package/dist/commonjs/index.d.ts.map +1 -1
  40. package/dist/commonjs/index.js +1 -0
  41. package/dist/commonjs/index.js.map +1 -1
  42. package/dist/commonjs/lib/config.d.ts +3 -3
  43. package/dist/commonjs/lib/config.js +1 -1
  44. package/dist/commonjs/models/cms/content-entry.d.ts +14 -0
  45. package/dist/commonjs/models/cms/content-entry.d.ts.map +1 -0
  46. package/dist/commonjs/models/cms/content-entry.js +57 -0
  47. package/dist/commonjs/models/cms/content-entry.js.map +1 -0
  48. package/dist/commonjs/models/cms/content-type-field.d.ts +27 -0
  49. package/dist/commonjs/models/cms/content-type-field.d.ts.map +1 -0
  50. package/dist/commonjs/models/cms/content-type-field.js +65 -0
  51. package/dist/commonjs/models/cms/content-type-field.js.map +1 -0
  52. package/dist/commonjs/models/cms/content-type.d.ts +32 -0
  53. package/dist/commonjs/models/cms/content-type.d.ts.map +1 -0
  54. package/dist/commonjs/models/cms/content-type.js +78 -0
  55. package/dist/commonjs/models/cms/content-type.js.map +1 -0
  56. package/dist/commonjs/models/cms/index.d.ts +3 -0
  57. package/dist/commonjs/models/cms/index.d.ts.map +1 -1
  58. package/dist/commonjs/models/cms/index.js +3 -0
  59. package/dist/commonjs/models/cms/index.js.map +1 -1
  60. package/dist/commonjs/models/commerce/route.d.ts +2 -2
  61. package/dist/commonjs/models/commerce/route.d.ts.map +1 -1
  62. package/dist/commonjs/models/commerce/route.js +2 -2
  63. package/dist/commonjs/models/commerce/route.js.map +1 -1
  64. package/dist/commonjs/models/index.d.ts +1 -0
  65. package/dist/commonjs/models/index.d.ts.map +1 -1
  66. package/dist/commonjs/models/index.js +1 -0
  67. package/dist/commonjs/models/index.js.map +1 -1
  68. package/dist/commonjs/models/operations/cms-content-types.d.ts +29 -0
  69. package/dist/commonjs/models/operations/cms-content-types.d.ts.map +1 -0
  70. package/dist/commonjs/models/operations/cms-content-types.js +71 -0
  71. package/dist/commonjs/models/operations/cms-content-types.js.map +1 -0
  72. package/dist/commonjs/models/operations/cms-content.d.ts +55 -0
  73. package/dist/commonjs/models/operations/cms-content.d.ts.map +1 -0
  74. package/dist/commonjs/models/operations/cms-content.js +92 -0
  75. package/dist/commonjs/models/operations/cms-content.js.map +1 -0
  76. package/dist/commonjs/models/operations/index.d.ts +2 -0
  77. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  78. package/dist/commonjs/models/operations/index.js +2 -0
  79. package/dist/commonjs/models/operations/index.js.map +1 -1
  80. package/dist/commonjs/sdk/cms/content-types.d.ts +7 -0
  81. package/dist/commonjs/sdk/cms/content-types.d.ts.map +1 -0
  82. package/dist/commonjs/sdk/cms/content-types.js +20 -0
  83. package/dist/commonjs/sdk/cms/content-types.js.map +1 -0
  84. package/dist/commonjs/sdk/cms/content.d.ts +11 -0
  85. package/dist/commonjs/sdk/cms/content.d.ts.map +1 -0
  86. package/dist/commonjs/sdk/cms/content.js +32 -0
  87. package/dist/commonjs/sdk/cms/content.js.map +1 -0
  88. package/dist/commonjs/sdk/cms/index.d.ts +8 -0
  89. package/dist/commonjs/sdk/cms/index.d.ts.map +1 -1
  90. package/dist/commonjs/sdk/cms/index.js +13 -1
  91. package/dist/commonjs/sdk/cms/index.js.map +1 -1
  92. package/dist/commonjs/sdk/index.d.ts +1 -0
  93. package/dist/commonjs/sdk/index.d.ts.map +1 -1
  94. package/dist/commonjs/sdk/index.js +1 -0
  95. package/dist/commonjs/sdk/index.js.map +1 -1
  96. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  97. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  98. package/dist/commonjs/sdk/sdk.js +4 -0
  99. package/dist/commonjs/sdk/sdk.js.map +1 -1
  100. package/dist/commonjs/sdk/tracking/events.d.ts +27 -0
  101. package/dist/commonjs/sdk/tracking/events.d.ts.map +1 -0
  102. package/dist/commonjs/sdk/tracking/events.js +137 -0
  103. package/dist/commonjs/sdk/tracking/events.js.map +1 -0
  104. package/dist/commonjs/sdk/tracking/index.d.ts +12 -0
  105. package/dist/commonjs/sdk/tracking/index.d.ts.map +1 -0
  106. package/dist/commonjs/sdk/tracking/index.js +35 -0
  107. package/dist/commonjs/sdk/tracking/index.js.map +1 -0
  108. package/dist/esm/funcs/cms/contentCreate.d.ts +11 -0
  109. package/dist/esm/funcs/cms/contentCreate.d.ts.map +1 -0
  110. package/dist/esm/funcs/cms/contentCreate.js +74 -0
  111. package/dist/esm/funcs/cms/contentCreate.js.map +1 -0
  112. package/dist/esm/funcs/cms/contentDelete.d.ts +10 -0
  113. package/dist/esm/funcs/cms/contentDelete.d.ts.map +1 -0
  114. package/dist/esm/funcs/cms/contentDelete.js +74 -0
  115. package/dist/esm/funcs/cms/contentDelete.js.map +1 -0
  116. package/dist/esm/funcs/cms/contentGet.d.ts +11 -0
  117. package/dist/esm/funcs/cms/contentGet.d.ts.map +1 -0
  118. package/dist/esm/funcs/cms/contentGet.js +74 -0
  119. package/dist/esm/funcs/cms/contentGet.js.map +1 -0
  120. package/dist/esm/funcs/cms/contentList.d.ts +11 -0
  121. package/dist/esm/funcs/cms/contentList.d.ts.map +1 -0
  122. package/dist/esm/funcs/cms/contentList.js +81 -0
  123. package/dist/esm/funcs/cms/contentList.js.map +1 -0
  124. package/dist/esm/funcs/cms/contentTypesGet.d.ts +10 -0
  125. package/dist/esm/funcs/cms/contentTypesGet.d.ts.map +1 -0
  126. package/dist/esm/funcs/cms/contentTypesGet.js +78 -0
  127. package/dist/esm/funcs/cms/contentTypesGet.js.map +1 -0
  128. package/dist/esm/funcs/cms/contentTypesList.d.ts +10 -0
  129. package/dist/esm/funcs/cms/contentTypesList.d.ts.map +1 -0
  130. package/dist/esm/funcs/cms/contentTypesList.js +85 -0
  131. package/dist/esm/funcs/cms/contentTypesList.js.map +1 -0
  132. package/dist/esm/funcs/cms/contentUpdate.d.ts +11 -0
  133. package/dist/esm/funcs/cms/contentUpdate.d.ts.map +1 -0
  134. package/dist/esm/funcs/cms/contentUpdate.js +75 -0
  135. package/dist/esm/funcs/cms/contentUpdate.js.map +1 -0
  136. package/dist/esm/funcs/cms/index.d.ts +7 -0
  137. package/dist/esm/funcs/cms/index.d.ts.map +1 -1
  138. package/dist/esm/funcs/cms/index.js +7 -0
  139. package/dist/esm/funcs/cms/index.js.map +1 -1
  140. package/dist/esm/funcs/index.d.ts +1 -0
  141. package/dist/esm/funcs/index.d.ts.map +1 -1
  142. package/dist/esm/funcs/index.js +1 -0
  143. package/dist/esm/funcs/index.js.map +1 -1
  144. package/dist/esm/index.d.ts +1 -0
  145. package/dist/esm/index.d.ts.map +1 -1
  146. package/dist/esm/index.js +1 -0
  147. package/dist/esm/index.js.map +1 -1
  148. package/dist/esm/lib/config.d.ts +3 -3
  149. package/dist/esm/lib/config.js +1 -1
  150. package/dist/esm/models/cms/content-entry.d.ts +14 -0
  151. package/dist/esm/models/cms/content-entry.d.ts.map +1 -0
  152. package/dist/esm/models/cms/content-entry.js +21 -0
  153. package/dist/esm/models/cms/content-entry.js.map +1 -0
  154. package/dist/esm/models/cms/content-type-field.d.ts +27 -0
  155. package/dist/esm/models/cms/content-type-field.d.ts.map +1 -0
  156. package/dist/esm/models/cms/content-type-field.js +29 -0
  157. package/dist/esm/models/cms/content-type-field.js.map +1 -0
  158. package/dist/esm/models/cms/content-type.d.ts +32 -0
  159. package/dist/esm/models/cms/content-type.d.ts.map +1 -0
  160. package/dist/esm/models/cms/content-type.js +42 -0
  161. package/dist/esm/models/cms/content-type.js.map +1 -0
  162. package/dist/esm/models/cms/index.d.ts +3 -0
  163. package/dist/esm/models/cms/index.d.ts.map +1 -1
  164. package/dist/esm/models/cms/index.js +3 -0
  165. package/dist/esm/models/cms/index.js.map +1 -1
  166. package/dist/esm/models/commerce/route.d.ts +2 -2
  167. package/dist/esm/models/commerce/route.d.ts.map +1 -1
  168. package/dist/esm/models/commerce/route.js +2 -2
  169. package/dist/esm/models/commerce/route.js.map +1 -1
  170. package/dist/esm/models/index.d.ts +1 -0
  171. package/dist/esm/models/index.d.ts.map +1 -1
  172. package/dist/esm/models/index.js +1 -0
  173. package/dist/esm/models/index.js.map +1 -1
  174. package/dist/esm/models/operations/cms-content-types.d.ts +29 -0
  175. package/dist/esm/models/operations/cms-content-types.d.ts.map +1 -0
  176. package/dist/esm/models/operations/cms-content-types.js +35 -0
  177. package/dist/esm/models/operations/cms-content-types.js.map +1 -0
  178. package/dist/esm/models/operations/cms-content.d.ts +55 -0
  179. package/dist/esm/models/operations/cms-content.d.ts.map +1 -0
  180. package/dist/esm/models/operations/cms-content.js +56 -0
  181. package/dist/esm/models/operations/cms-content.js.map +1 -0
  182. package/dist/esm/models/operations/index.d.ts +2 -0
  183. package/dist/esm/models/operations/index.d.ts.map +1 -1
  184. package/dist/esm/models/operations/index.js +2 -0
  185. package/dist/esm/models/operations/index.js.map +1 -1
  186. package/dist/esm/sdk/cms/content-types.d.ts +7 -0
  187. package/dist/esm/sdk/cms/content-types.d.ts.map +1 -0
  188. package/dist/esm/sdk/cms/content-types.js +16 -0
  189. package/dist/esm/sdk/cms/content-types.js.map +1 -0
  190. package/dist/esm/sdk/cms/content.d.ts +11 -0
  191. package/dist/esm/sdk/cms/content.d.ts.map +1 -0
  192. package/dist/esm/sdk/cms/content.js +28 -0
  193. package/dist/esm/sdk/cms/content.js.map +1 -0
  194. package/dist/esm/sdk/cms/index.d.ts +8 -0
  195. package/dist/esm/sdk/cms/index.d.ts.map +1 -1
  196. package/dist/esm/sdk/cms/index.js +10 -0
  197. package/dist/esm/sdk/cms/index.js.map +1 -1
  198. package/dist/esm/sdk/index.d.ts +1 -0
  199. package/dist/esm/sdk/index.d.ts.map +1 -1
  200. package/dist/esm/sdk/index.js +1 -0
  201. package/dist/esm/sdk/index.js.map +1 -1
  202. package/dist/esm/sdk/sdk.d.ts +3 -0
  203. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  204. package/dist/esm/sdk/sdk.js +4 -0
  205. package/dist/esm/sdk/sdk.js.map +1 -1
  206. package/dist/esm/sdk/tracking/events.d.ts +27 -0
  207. package/dist/esm/sdk/tracking/events.d.ts.map +1 -0
  208. package/dist/esm/sdk/tracking/events.js +133 -0
  209. package/dist/esm/sdk/tracking/events.js.map +1 -0
  210. package/dist/esm/sdk/tracking/index.d.ts +12 -0
  211. package/dist/esm/sdk/tracking/index.d.ts.map +1 -0
  212. package/dist/esm/sdk/tracking/index.js +31 -0
  213. package/dist/esm/sdk/tracking/index.js.map +1 -0
  214. package/jsr.json +1 -1
  215. package/package.json +1 -1
  216. package/src/funcs/cms/contentCreate.ts +171 -0
  217. package/src/funcs/cms/contentDelete.ts +157 -0
  218. package/src/funcs/cms/contentGet.ts +171 -0
  219. package/src/funcs/cms/contentList.ts +179 -0
  220. package/src/funcs/cms/contentTypesGet.ts +162 -0
  221. package/src/funcs/cms/contentTypesList.ts +169 -0
  222. package/src/funcs/cms/contentUpdate.ts +172 -0
  223. package/src/funcs/cms/index.ts +7 -0
  224. package/src/funcs/index.ts +1 -0
  225. package/src/index.ts +1 -0
  226. package/src/lib/config.ts +1 -1
  227. package/src/models/cms/content-entry.ts +31 -0
  228. package/src/models/cms/content-type-field.ts +54 -0
  229. package/src/models/cms/content-type.ts +75 -0
  230. package/src/models/cms/index.ts +3 -3
  231. package/src/models/commerce/route.ts +4 -4
  232. package/src/models/index.ts +1 -0
  233. package/src/models/operations/cms-content-types.ts +74 -0
  234. package/src/models/operations/cms-content.ts +132 -0
  235. package/src/models/operations/index.ts +2 -0
  236. package/src/sdk/cms/content-types.ts +25 -0
  237. package/src/sdk/cms/content.ts +50 -0
  238. package/src/sdk/cms/index.ts +14 -0
  239. package/src/sdk/index.ts +1 -0
  240. package/src/sdk/sdk.ts +6 -0
  241. package/src/sdk/tracking/events.ts +200 -0
  242. package/src/sdk/tracking/index.ts +34 -0
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Create CMS content entry.
3
+ */
4
+
5
+ import { ClientSDK, RequestOptions } from "../../lib/sdks.js";
6
+
7
+ import * as M from "../../lib/matchers.js";
8
+ import { safeParse } from "../../lib/schemas.js";
9
+ import { extractSecurity, resolveGlobalSecurity } from "../../lib/security.js";
10
+ import * as errors from "../../models/errors/index.js";
11
+ import { ResponseValidationError } from "../../models/errors/response-validation-error.js";
12
+ import { SDKValidationError } from "../../models/errors/sdk-validation-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../../models/errors/http-client-errors.js";
20
+ import { ContentEntry } from "../../models/cms/content-entry.js";
21
+ import * as operations from "../../models/operations/index.js";
22
+ import { APICall, APIPromise } from "../../types/async.js";
23
+ import { OK, Result } from "../../types/fp.js";
24
+
25
+ export function contentCreate<TEntry extends ContentEntry = ContentEntry>(
26
+ client: ClientSDK,
27
+ request: operations.CreateContentRequest,
28
+ options?: RequestOptions,
29
+ ): APIPromise<
30
+ Result<
31
+ operations.CreateContentResponse<TEntry>,
32
+ | errors.ErrorResponse
33
+ | errors.OminityDefaultError
34
+ | ResponseValidationError
35
+ | ConnectionError
36
+ | RequestAbortedError
37
+ | RequestTimeoutError
38
+ | InvalidRequestError
39
+ | UnexpectedClientError
40
+ | SDKValidationError
41
+ >
42
+ > {
43
+ return new APIPromise($do(
44
+ client,
45
+ request,
46
+ options,
47
+ )) as APIPromise<
48
+ Result<
49
+ operations.CreateContentResponse<TEntry>,
50
+ | errors.ErrorResponse
51
+ | errors.OminityDefaultError
52
+ | ResponseValidationError
53
+ | ConnectionError
54
+ | RequestAbortedError
55
+ | RequestTimeoutError
56
+ | InvalidRequestError
57
+ | UnexpectedClientError
58
+ | SDKValidationError
59
+ >
60
+ >;
61
+ }
62
+
63
+ async function $do(
64
+ client: ClientSDK,
65
+ request: operations.CreateContentRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ operations.CreateContentResponse,
71
+ | errors.ErrorResponse
72
+ | errors.OminityDefaultError
73
+ | ResponseValidationError
74
+ | ConnectionError
75
+ | RequestAbortedError
76
+ | RequestTimeoutError
77
+ | InvalidRequestError
78
+ | UnexpectedClientError
79
+ | SDKValidationError
80
+ >,
81
+ APICall,
82
+ ]
83
+ > {
84
+ const parsed = safeParse(
85
+ request,
86
+ (value) => operations.CreateContentRequest$outboundSchema.parse(value),
87
+ "Input validation failed",
88
+ );
89
+ if (!parsed.ok) {
90
+ return [parsed, { status: "invalid" }];
91
+ }
92
+ const payload = parsed.value;
93
+
94
+ const safeSlug = encodeURIComponent(payload.slug);
95
+ const path = `/cms/content/${safeSlug}`;
96
+
97
+ const headers = new Headers({
98
+ "Content-Type": "application/json",
99
+ });
100
+
101
+ const securityInput = await extractSecurity(client._options.security);
102
+ const requestSecurity = resolveGlobalSecurity(securityInput);
103
+
104
+ const context = {
105
+ options: client._options,
106
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
107
+ operationID: "cms.content.create",
108
+ oAuth2Scopes: null,
109
+ resolvedSecurity: requestSecurity,
110
+ securitySource: client._options.security,
111
+ retryConfig: options?.retries
112
+ || client._options.retryConfig
113
+ || { strategy: "none" },
114
+ retryCodes: options?.retryCodes || ["429", "5XX"],
115
+ };
116
+
117
+ const requestRes = client._createRequest(context, {
118
+ security: requestSecurity,
119
+ method: "POST",
120
+ baseURL: options?.serverURL,
121
+ path,
122
+ headers,
123
+ body: JSON.stringify(payload.data),
124
+ userAgent: client._options.userAgent,
125
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
+ }, options);
127
+ if (!requestRes.ok) {
128
+ return [requestRes, { status: "invalid" }];
129
+ }
130
+ const req = requestRes.value;
131
+
132
+ const doResult = await client._do(req, {
133
+ context,
134
+ errorCodes: ["4XX", "5XX"],
135
+ retryConfig: context.retryConfig,
136
+ retryCodes: context.retryCodes,
137
+ });
138
+ if (!doResult.ok) {
139
+ return [doResult, { status: "request-error", request: req }];
140
+ }
141
+ const response = doResult.value;
142
+
143
+ const responseFields = {
144
+ HttpMeta: { Response: response, Request: req },
145
+ };
146
+
147
+ const [result] = await M.match<
148
+ operations.CreateContentResponse,
149
+ | errors.ErrorResponse
150
+ | errors.OminityDefaultError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, operations.CreateContentResponse$inboundSchema, { ctype: "application/hal+json" }),
160
+ M.json(201, operations.CreateContentResponse$inboundSchema, { ctype: "application/hal+json" }),
161
+ M.jsonErr("4XX", errors.ErrorResponse$inboundSchema, {
162
+ ctype: "application/hal+json",
163
+ }),
164
+ M.fail("5XX"),
165
+ )(response, req, { extraFields: responseFields });
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [OK(result.value), { status: "complete", request: req, response }];
171
+ }
@@ -0,0 +1,157 @@
1
+ /*
2
+ * Delete CMS content entry.
3
+ */
4
+
5
+ import { ClientSDK, RequestOptions } from "../../lib/sdks.js";
6
+
7
+ import * as M from "../../lib/matchers.js";
8
+ import { safeParse } from "../../lib/schemas.js";
9
+ import { extractSecurity, resolveGlobalSecurity } from "../../lib/security.js";
10
+ import * as errors from "../../models/errors/index.js";
11
+ import { ResponseValidationError } from "../../models/errors/response-validation-error.js";
12
+ import { SDKValidationError } from "../../models/errors/sdk-validation-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../../models/errors/http-client-errors.js";
20
+ import * as operations from "../../models/operations/index.js";
21
+ import { APICall, APIPromise } from "../../types/async.js";
22
+ import { OK, Result } from "../../types/fp.js";
23
+
24
+ export function contentDelete(
25
+ client: ClientSDK,
26
+ request: operations.DeleteContentRequest,
27
+ options?: RequestOptions,
28
+ ): APIPromise<
29
+ Result<
30
+ operations.DeleteContentResponse,
31
+ | errors.ErrorResponse
32
+ | errors.OminityDefaultError
33
+ | ResponseValidationError
34
+ | ConnectionError
35
+ | RequestAbortedError
36
+ | RequestTimeoutError
37
+ | InvalidRequestError
38
+ | UnexpectedClientError
39
+ | SDKValidationError
40
+ >
41
+ > {
42
+ return new APIPromise($do(
43
+ client,
44
+ request,
45
+ options,
46
+ ));
47
+ }
48
+
49
+ async function $do(
50
+ client: ClientSDK,
51
+ request: operations.DeleteContentRequest,
52
+ options?: RequestOptions,
53
+ ): Promise<
54
+ [
55
+ Result<
56
+ operations.DeleteContentResponse,
57
+ | errors.ErrorResponse
58
+ | errors.OminityDefaultError
59
+ | ResponseValidationError
60
+ | ConnectionError
61
+ | RequestAbortedError
62
+ | RequestTimeoutError
63
+ | InvalidRequestError
64
+ | UnexpectedClientError
65
+ | SDKValidationError
66
+ >,
67
+ APICall,
68
+ ]
69
+ > {
70
+ const parsed = safeParse(
71
+ request,
72
+ (value) => operations.DeleteContentRequest$outboundSchema.parse(value),
73
+ "Input validation failed",
74
+ );
75
+ if (!parsed.ok) {
76
+ return [parsed, { status: "invalid" }];
77
+ }
78
+ const payload = parsed.value;
79
+ const body = null;
80
+
81
+ const safeSlug = encodeURIComponent(payload.slug);
82
+ const safeId = encodeURIComponent(payload.id);
83
+ const path = `/cms/content/${safeSlug}/${safeId}`;
84
+
85
+ const headers = new Headers();
86
+
87
+ const securityInput = await extractSecurity(client._options.security);
88
+ const requestSecurity = resolveGlobalSecurity(securityInput);
89
+
90
+ const context = {
91
+ options: client._options,
92
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
93
+ operationID: "cms.content.delete",
94
+ oAuth2Scopes: null,
95
+ resolvedSecurity: requestSecurity,
96
+ securitySource: client._options.security,
97
+ retryConfig: options?.retries
98
+ || client._options.retryConfig
99
+ || { strategy: "none" },
100
+ retryCodes: options?.retryCodes || ["429", "5XX"],
101
+ };
102
+
103
+ const requestRes = client._createRequest(context, {
104
+ security: requestSecurity,
105
+ method: "DELETE",
106
+ baseURL: options?.serverURL,
107
+ path,
108
+ headers,
109
+ body,
110
+ userAgent: client._options.userAgent,
111
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
112
+ }, options);
113
+ if (!requestRes.ok) {
114
+ return [requestRes, { status: "invalid" }];
115
+ }
116
+ const req = requestRes.value;
117
+
118
+ const doResult = await client._do(req, {
119
+ context,
120
+ errorCodes: ["4XX", "5XX"],
121
+ retryConfig: context.retryConfig,
122
+ retryCodes: context.retryCodes,
123
+ });
124
+ if (!doResult.ok) {
125
+ return [doResult, { status: "request-error", request: req }];
126
+ }
127
+ const response = doResult.value;
128
+
129
+ const responseFields = {
130
+ HttpMeta: { Response: response, Request: req },
131
+ };
132
+
133
+ const [result] = await M.match<
134
+ operations.DeleteContentResponse,
135
+ | errors.ErrorResponse
136
+ | errors.OminityDefaultError
137
+ | ResponseValidationError
138
+ | ConnectionError
139
+ | RequestAbortedError
140
+ | RequestTimeoutError
141
+ | InvalidRequestError
142
+ | UnexpectedClientError
143
+ | SDKValidationError
144
+ >(
145
+ M.json(200, operations.DeleteContentResponse$inboundSchema),
146
+ M.jsonErr("4XX", errors.ErrorResponse$inboundSchema, {
147
+ ctype: "application/hal+json",
148
+ }),
149
+ M.fail("4XX"),
150
+ M.fail("5XX"),
151
+ )(response, req, { extraFields: responseFields });
152
+ if (!result.ok) {
153
+ return [result, { status: "complete", request: req, response }];
154
+ }
155
+
156
+ return [OK(result.value), { status: "complete", request: req, response }];
157
+ }
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Get CMS content entry.
3
+ */
4
+
5
+ import { ClientSDK, RequestOptions } from "../../lib/sdks.js";
6
+
7
+ import * as M from "../../lib/matchers.js";
8
+ import { safeParse } from "../../lib/schemas.js";
9
+ import { extractSecurity, resolveGlobalSecurity } from "../../lib/security.js";
10
+ import * as errors from "../../models/errors/index.js";
11
+ import { ResponseValidationError } from "../../models/errors/response-validation-error.js";
12
+ import { SDKValidationError } from "../../models/errors/sdk-validation-error.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../../models/errors/http-client-errors.js";
20
+ import { ContentEntry } from "../../models/cms/content-entry.js";
21
+ import * as operations from "../../models/operations/index.js";
22
+ import { APICall, APIPromise } from "../../types/async.js";
23
+ import { OK, Result } from "../../types/fp.js";
24
+
25
+ export function contentGet<TEntry extends ContentEntry = ContentEntry>(
26
+ client: ClientSDK,
27
+ request: operations.GetContentRequest,
28
+ options?: RequestOptions,
29
+ ): APIPromise<
30
+ Result<
31
+ operations.GetContentResponse<TEntry>,
32
+ | errors.ErrorResponse
33
+ | errors.OminityDefaultError
34
+ | ResponseValidationError
35
+ | ConnectionError
36
+ | RequestAbortedError
37
+ | RequestTimeoutError
38
+ | InvalidRequestError
39
+ | UnexpectedClientError
40
+ | SDKValidationError
41
+ >
42
+ > {
43
+ return new APIPromise($do(
44
+ client,
45
+ request,
46
+ options,
47
+ )) as APIPromise<
48
+ Result<
49
+ operations.GetContentResponse<TEntry>,
50
+ | errors.ErrorResponse
51
+ | errors.OminityDefaultError
52
+ | ResponseValidationError
53
+ | ConnectionError
54
+ | RequestAbortedError
55
+ | RequestTimeoutError
56
+ | InvalidRequestError
57
+ | UnexpectedClientError
58
+ | SDKValidationError
59
+ >
60
+ >;
61
+ }
62
+
63
+ async function $do(
64
+ client: ClientSDK,
65
+ request: operations.GetContentRequest,
66
+ options?: RequestOptions,
67
+ ): Promise<
68
+ [
69
+ Result<
70
+ operations.GetContentResponse,
71
+ | errors.ErrorResponse
72
+ | errors.OminityDefaultError
73
+ | ResponseValidationError
74
+ | ConnectionError
75
+ | RequestAbortedError
76
+ | RequestTimeoutError
77
+ | InvalidRequestError
78
+ | UnexpectedClientError
79
+ | SDKValidationError
80
+ >,
81
+ APICall,
82
+ ]
83
+ > {
84
+ const parsed = safeParse(
85
+ request,
86
+ (value) => operations.GetContentRequest$outboundSchema.parse(value),
87
+ "Input validation failed",
88
+ );
89
+ if (!parsed.ok) {
90
+ return [parsed, { status: "invalid" }];
91
+ }
92
+ const payload = parsed.value;
93
+ const body = null;
94
+
95
+ const safeSlug = encodeURIComponent(payload.slug);
96
+ const safeId = encodeURIComponent(payload.id);
97
+ const path = `/cms/content/${safeSlug}/${safeId}`;
98
+
99
+ const headers = new Headers();
100
+
101
+ const securityInput = await extractSecurity(client._options.security);
102
+ const requestSecurity = resolveGlobalSecurity(securityInput);
103
+
104
+ const context = {
105
+ options: client._options,
106
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
107
+ operationID: "cms.content.get",
108
+ oAuth2Scopes: null,
109
+ resolvedSecurity: requestSecurity,
110
+ securitySource: client._options.security,
111
+ retryConfig: options?.retries
112
+ || client._options.retryConfig
113
+ || { strategy: "none" },
114
+ retryCodes: options?.retryCodes || ["429", "5XX"],
115
+ };
116
+
117
+ const requestRes = client._createRequest(context, {
118
+ security: requestSecurity,
119
+ method: "GET",
120
+ baseURL: options?.serverURL,
121
+ path,
122
+ headers,
123
+ body,
124
+ userAgent: client._options.userAgent,
125
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
+ }, options);
127
+ if (!requestRes.ok) {
128
+ return [requestRes, { status: "invalid" }];
129
+ }
130
+ const req = requestRes.value;
131
+
132
+ const doResult = await client._do(req, {
133
+ context,
134
+ errorCodes: ["4XX", "5XX"],
135
+ retryConfig: context.retryConfig,
136
+ retryCodes: context.retryCodes,
137
+ });
138
+ if (!doResult.ok) {
139
+ return [doResult, { status: "request-error", request: req }];
140
+ }
141
+ const response = doResult.value;
142
+
143
+ const responseFields = {
144
+ HttpMeta: { Response: response, Request: req },
145
+ };
146
+
147
+ const [result] = await M.match<
148
+ operations.GetContentResponse,
149
+ | errors.ErrorResponse
150
+ | errors.OminityDefaultError
151
+ | ResponseValidationError
152
+ | ConnectionError
153
+ | RequestAbortedError
154
+ | RequestTimeoutError
155
+ | InvalidRequestError
156
+ | UnexpectedClientError
157
+ | SDKValidationError
158
+ >(
159
+ M.json(200, operations.GetContentResponse$inboundSchema, { ctype: "application/hal+json" }),
160
+ M.jsonErr("4XX", errors.ErrorResponse$inboundSchema, {
161
+ ctype: "application/hal+json",
162
+ }),
163
+ M.fail("4XX"),
164
+ M.fail("5XX"),
165
+ )(response, req, { extraFields: responseFields });
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [OK(result.value), { status: "complete", request: req, response }];
171
+ }
@@ -0,0 +1,179 @@
1
+ /*
2
+ * List CMS content.
3
+ */
4
+
5
+ import { ClientSDK, RequestOptions } from "../../lib/sdks.js";
6
+ import { encodeFormQuery } from "../../lib/encodings.js";
7
+
8
+ import * as M from "../../lib/matchers.js";
9
+ import { safeParse } from "../../lib/schemas.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../../lib/security.js";
11
+ import * as errors from "../../models/errors/index.js";
12
+ import { ResponseValidationError } from "../../models/errors/response-validation-error.js";
13
+ import { SDKValidationError } from "../../models/errors/sdk-validation-error.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../../models/errors/http-client-errors.js";
21
+ import { ContentEntry } from "../../models/cms/content-entry.js";
22
+ import * as operations from "../../models/operations/index.js";
23
+ import { APICall, APIPromise } from "../../types/async.js";
24
+ import { OK, Result } from "../../types/fp.js";
25
+
26
+ export function contentList<TEntry extends ContentEntry = ContentEntry>(
27
+ client: ClientSDK,
28
+ request: operations.ListContentRequest,
29
+ options?: RequestOptions,
30
+ ): APIPromise<
31
+ Result<
32
+ operations.ListContentResponse<TEntry>,
33
+ | errors.ErrorResponse
34
+ | errors.OminityDefaultError
35
+ | ResponseValidationError
36
+ | ConnectionError
37
+ | RequestAbortedError
38
+ | RequestTimeoutError
39
+ | InvalidRequestError
40
+ | UnexpectedClientError
41
+ | SDKValidationError
42
+ >
43
+ > {
44
+ return new APIPromise($do(
45
+ client,
46
+ request,
47
+ options,
48
+ )) as APIPromise<
49
+ Result<
50
+ operations.ListContentResponse<TEntry>,
51
+ | errors.ErrorResponse
52
+ | errors.OminityDefaultError
53
+ | ResponseValidationError
54
+ | ConnectionError
55
+ | RequestAbortedError
56
+ | RequestTimeoutError
57
+ | InvalidRequestError
58
+ | UnexpectedClientError
59
+ | SDKValidationError
60
+ >
61
+ >;
62
+ }
63
+
64
+ async function $do(
65
+ client: ClientSDK,
66
+ request: operations.ListContentRequest,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.ListContentResponse,
72
+ | errors.ErrorResponse
73
+ | errors.OminityDefaultError
74
+ | ResponseValidationError
75
+ | ConnectionError
76
+ | RequestAbortedError
77
+ | RequestTimeoutError
78
+ | InvalidRequestError
79
+ | UnexpectedClientError
80
+ | SDKValidationError
81
+ >,
82
+ APICall,
83
+ ]
84
+ > {
85
+ const parsed = safeParse(
86
+ request,
87
+ (value) => operations.ListContentRequest$outboundSchema.parse(value),
88
+ "Input validation failed",
89
+ );
90
+ if (!parsed.ok) {
91
+ return [parsed, { status: "invalid" }];
92
+ }
93
+ const payload = parsed.value;
94
+ const body = null;
95
+
96
+ const safeSlug = encodeURIComponent(payload.slug);
97
+ const path = `/cms/content/${safeSlug}`;
98
+
99
+ const query = encodeFormQuery({
100
+ "filter[id]": payload.filterId,
101
+ sort: payload.sort,
102
+ page: payload.page,
103
+ limit: payload.limit,
104
+ });
105
+
106
+ const headers = new Headers();
107
+
108
+ const securityInput = await extractSecurity(client._options.security);
109
+ const requestSecurity = resolveGlobalSecurity(securityInput);
110
+
111
+ const context = {
112
+ options: client._options,
113
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
114
+ operationID: "cms.content.list",
115
+ oAuth2Scopes: null,
116
+ resolvedSecurity: requestSecurity,
117
+ securitySource: client._options.security,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "5XX"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "GET",
127
+ baseURL: options?.serverURL,
128
+ path,
129
+ headers,
130
+ query,
131
+ body,
132
+ userAgent: client._options.userAgent,
133
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
134
+ }, options);
135
+ if (!requestRes.ok) {
136
+ return [requestRes, { status: "invalid" }];
137
+ }
138
+ const req = requestRes.value;
139
+
140
+ const doResult = await client._do(req, {
141
+ context,
142
+ errorCodes: ["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 responseFields = {
152
+ HttpMeta: { Response: response, Request: req },
153
+ };
154
+
155
+ const [result] = await M.match<
156
+ operations.ListContentResponse,
157
+ | errors.ErrorResponse
158
+ | errors.OminityDefaultError
159
+ | ResponseValidationError
160
+ | ConnectionError
161
+ | RequestAbortedError
162
+ | RequestTimeoutError
163
+ | InvalidRequestError
164
+ | UnexpectedClientError
165
+ | SDKValidationError
166
+ >(
167
+ M.json(200, operations.ListContentResponse$inboundSchema, { ctype: "application/hal+json" }),
168
+ M.jsonErr("4XX", errors.ErrorResponse$inboundSchema, {
169
+ ctype: "application/hal+json",
170
+ }),
171
+ M.fail("4XX"),
172
+ M.fail("5XX"),
173
+ )(response, req, { extraFields: responseFields });
174
+ if (!result.ok) {
175
+ return [result, { status: "complete", request: req, response }];
176
+ }
177
+
178
+ return [OK(result.value), { status: "complete", request: req, response }];
179
+ }