@aurora-interactive/fankare-api-sdk 0.0.5 → 0.1.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 (179) hide show
  1. package/FUNCTIONS.md +0 -1
  2. package/README.md +28 -8
  3. package/esm/funcs/internal-asset-processing-callback.d.ts +17 -0
  4. package/esm/funcs/internal-asset-processing-callback.d.ts.map +1 -0
  5. package/esm/funcs/internal-asset-processing-callback.js +96 -0
  6. package/esm/funcs/internal-asset-processing-callback.js.map +1 -0
  7. package/esm/funcs/me-confirm-avatar-upload.d.ts +14 -0
  8. package/esm/funcs/me-confirm-avatar-upload.d.ts.map +1 -0
  9. package/esm/funcs/me-confirm-avatar-upload.js +78 -0
  10. package/esm/funcs/me-confirm-avatar-upload.js.map +1 -0
  11. package/esm/funcs/me-confirm-banner-upload.d.ts +14 -0
  12. package/esm/funcs/me-confirm-banner-upload.d.ts.map +1 -0
  13. package/esm/funcs/me-confirm-banner-upload.js +78 -0
  14. package/esm/funcs/me-confirm-banner-upload.js.map +1 -0
  15. package/esm/funcs/me-get-me.d.ts +14 -0
  16. package/esm/funcs/me-get-me.d.ts.map +1 -0
  17. package/esm/funcs/me-get-me.js +67 -0
  18. package/esm/funcs/me-get-me.js.map +1 -0
  19. package/esm/funcs/me-request-avatar-upload-url.d.ts +14 -0
  20. package/esm/funcs/me-request-avatar-upload-url.d.ts.map +1 -0
  21. package/esm/funcs/me-request-avatar-upload-url.js +78 -0
  22. package/esm/funcs/me-request-avatar-upload-url.js.map +1 -0
  23. package/esm/funcs/me-request-banner-upload-url.d.ts +14 -0
  24. package/esm/funcs/me-request-banner-upload-url.d.ts.map +1 -0
  25. package/esm/funcs/me-request-banner-upload-url.js +78 -0
  26. package/esm/funcs/me-request-banner-upload-url.js.map +1 -0
  27. package/esm/funcs/me-update-me.d.ts +14 -0
  28. package/esm/funcs/me-update-me.d.ts.map +1 -0
  29. package/esm/funcs/me-update-me.js +78 -0
  30. package/esm/funcs/me-update-me.js.map +1 -0
  31. package/esm/funcs/posts-create-post.d.ts +5 -3
  32. package/esm/funcs/posts-create-post.d.ts.map +1 -1
  33. package/esm/funcs/posts-create-post.js +5 -3
  34. package/esm/funcs/posts-create-post.js.map +1 -1
  35. package/esm/funcs/posts-delete-post.d.ts +13 -0
  36. package/esm/funcs/posts-delete-post.d.ts.map +1 -0
  37. package/esm/funcs/posts-delete-post.js +86 -0
  38. package/esm/funcs/posts-delete-post.js.map +1 -0
  39. package/esm/funcs/posts-get-post.d.ts +14 -0
  40. package/esm/funcs/posts-get-post.d.ts.map +1 -0
  41. package/esm/funcs/posts-get-post.js +87 -0
  42. package/esm/funcs/posts-get-post.js.map +1 -0
  43. package/esm/funcs/posts-update-post.d.ts +17 -0
  44. package/esm/funcs/posts-update-post.d.ts.map +1 -0
  45. package/esm/funcs/posts-update-post.js +92 -0
  46. package/esm/funcs/posts-update-post.js.map +1 -0
  47. package/esm/lib/config.d.ts +3 -3
  48. package/esm/lib/config.js +3 -3
  49. package/esm/models/asset-declaration.d.ts +52 -0
  50. package/esm/models/asset-declaration.d.ts.map +1 -0
  51. package/esm/models/asset-declaration.js +37 -0
  52. package/esm/models/asset-declaration.js.map +1 -0
  53. package/esm/models/asset-processing-callback-request.d.ts +39 -0
  54. package/esm/models/asset-processing-callback-request.d.ts.map +1 -0
  55. package/esm/models/asset-processing-callback-request.js +24 -0
  56. package/esm/models/asset-processing-callback-request.js.map +1 -0
  57. package/esm/models/create-post-request.d.ts +11 -22
  58. package/esm/models/create-post-request.d.ts.map +1 -1
  59. package/esm/models/create-post-request.js +3 -16
  60. package/esm/models/create-post-request.js.map +1 -1
  61. package/esm/models/create-post-response.d.ts +18 -0
  62. package/esm/models/create-post-response.d.ts.map +1 -0
  63. package/esm/models/create-post-response.js +17 -0
  64. package/esm/models/create-post-response.js.map +1 -0
  65. package/esm/models/index.d.ts +9 -0
  66. package/esm/models/index.d.ts.map +1 -1
  67. package/esm/models/index.js +9 -0
  68. package/esm/models/index.js.map +1 -1
  69. package/esm/models/media-asset.d.ts +11 -5
  70. package/esm/models/media-asset.d.ts.map +1 -1
  71. package/esm/models/media-asset.js +4 -5
  72. package/esm/models/media-asset.js.map +1 -1
  73. package/esm/models/operations/asset-processing-callback.d.ts +17 -0
  74. package/esm/models/operations/asset-processing-callback.d.ts.map +1 -0
  75. package/esm/models/operations/asset-processing-callback.js +16 -0
  76. package/esm/models/operations/asset-processing-callback.js.map +1 -0
  77. package/esm/models/operations/delete-post.d.ts +12 -0
  78. package/esm/models/operations/delete-post.d.ts.map +1 -0
  79. package/esm/models/operations/delete-post.js +13 -0
  80. package/esm/models/operations/delete-post.js.map +1 -0
  81. package/esm/models/operations/get-post.d.ts +12 -0
  82. package/esm/models/operations/get-post.d.ts.map +1 -0
  83. package/esm/models/operations/get-post.js +13 -0
  84. package/esm/models/operations/get-post.js.map +1 -0
  85. package/esm/models/operations/index.d.ts +4 -1
  86. package/esm/models/operations/index.d.ts.map +1 -1
  87. package/esm/models/operations/index.js +4 -1
  88. package/esm/models/operations/index.js.map +1 -1
  89. package/esm/models/operations/update-post.d.ts +15 -0
  90. package/esm/models/operations/update-post.d.ts.map +1 -0
  91. package/esm/models/operations/update-post.js +15 -0
  92. package/esm/models/operations/update-post.js.map +1 -0
  93. package/esm/models/post.d.ts +20 -1
  94. package/esm/models/post.d.ts.map +1 -1
  95. package/esm/models/post.js +13 -1
  96. package/esm/models/post.js.map +1 -1
  97. package/esm/models/profile-media-confirm-request.d.ts +15 -0
  98. package/esm/models/profile-media-confirm-request.d.ts.map +1 -0
  99. package/esm/models/profile-media-confirm-request.js +13 -0
  100. package/esm/models/profile-media-confirm-request.js.map +1 -0
  101. package/esm/models/profile-media-upload-request.d.ts +30 -0
  102. package/esm/models/profile-media-upload-request.d.ts.map +1 -0
  103. package/esm/models/profile-media-upload-request.js +23 -0
  104. package/esm/models/profile-media-upload-request.js.map +1 -0
  105. package/esm/models/profile-media-upload-response.d.ts +21 -0
  106. package/esm/models/profile-media-upload-response.d.ts.map +1 -0
  107. package/esm/models/profile-media-upload-response.js +17 -0
  108. package/esm/models/profile-media-upload-response.js.map +1 -0
  109. package/esm/models/register-request.d.ts +2 -2
  110. package/esm/models/register-request.d.ts.map +1 -1
  111. package/esm/models/register-request.js +1 -1
  112. package/esm/models/register-request.js.map +1 -1
  113. package/esm/models/update-post-request.d.ts +30 -0
  114. package/esm/models/update-post-request.d.ts.map +1 -0
  115. package/esm/models/update-post-request.js +22 -0
  116. package/esm/models/update-post-request.js.map +1 -0
  117. package/esm/models/update-profile-request.d.ts +17 -0
  118. package/esm/models/update-profile-request.d.ts.map +1 -0
  119. package/esm/models/update-profile-request.js +14 -0
  120. package/esm/models/update-profile-request.js.map +1 -0
  121. package/esm/models/upload-slot.d.ts +29 -0
  122. package/esm/models/upload-slot.d.ts.map +1 -0
  123. package/esm/models/upload-slot.js +20 -0
  124. package/esm/models/upload-slot.js.map +1 -0
  125. package/esm/sdk/internal.d.ts +12 -0
  126. package/esm/sdk/internal.d.ts.map +1 -0
  127. package/esm/sdk/internal.js +19 -0
  128. package/esm/sdk/internal.js.map +1 -0
  129. package/esm/sdk/me.d.ts +29 -0
  130. package/esm/sdk/me.d.ts.map +1 -0
  131. package/esm/sdk/me.js +51 -0
  132. package/esm/sdk/me.js.map +1 -0
  133. package/esm/sdk/posts.d.ts +20 -3
  134. package/esm/sdk/posts.d.ts.map +1 -1
  135. package/esm/sdk/posts.js +28 -1
  136. package/esm/sdk/posts.js.map +1 -1
  137. package/esm/sdk/sdk.d.ts +6 -0
  138. package/esm/sdk/sdk.d.ts.map +1 -1
  139. package/esm/sdk/sdk.js +10 -0
  140. package/esm/sdk/sdk.js.map +1 -1
  141. package/examples/authenticationRegisterUser.example.ts +0 -1
  142. package/jsr.json +1 -1
  143. package/package.json +1 -1
  144. package/src/funcs/internal-asset-processing-callback.ts +190 -0
  145. package/src/funcs/me-confirm-avatar-upload.ts +161 -0
  146. package/src/funcs/me-confirm-banner-upload.ts +161 -0
  147. package/src/funcs/me-get-me.ts +142 -0
  148. package/src/funcs/me-request-avatar-upload-url.ts +161 -0
  149. package/src/funcs/me-request-banner-upload-url.ts +161 -0
  150. package/src/funcs/me-update-me.ts +161 -0
  151. package/src/funcs/posts-create-post.ts +9 -7
  152. package/src/funcs/posts-delete-post.ts +170 -0
  153. package/src/funcs/posts-get-post.ts +171 -0
  154. package/src/funcs/posts-update-post.ts +179 -0
  155. package/src/lib/config.ts +3 -3
  156. package/src/models/asset-declaration.ts +84 -0
  157. package/src/models/asset-processing-callback-request.ts +68 -0
  158. package/src/models/create-post-request.ts +17 -39
  159. package/src/models/create-post-response.ts +41 -0
  160. package/src/models/index.ts +9 -0
  161. package/src/models/media-asset.ts +16 -8
  162. package/src/models/operations/asset-processing-callback.ts +40 -0
  163. package/src/models/operations/delete-post.ts +31 -0
  164. package/src/models/operations/get-post.ts +27 -0
  165. package/src/models/operations/index.ts +4 -1
  166. package/src/models/operations/update-post.ts +35 -0
  167. package/src/models/post.ts +27 -2
  168. package/src/models/profile-media-confirm-request.ts +34 -0
  169. package/src/models/profile-media-upload-request.ts +55 -0
  170. package/src/models/profile-media-upload-response.ts +45 -0
  171. package/src/models/register-request.ts +3 -3
  172. package/src/models/update-post-request.ts +56 -0
  173. package/src/models/update-profile-request.ts +37 -0
  174. package/src/models/upload-slot.ts +53 -0
  175. package/src/sdk/internal.ts +32 -0
  176. package/src/sdk/me.ts +98 -0
  177. package/src/sdk/posts.ts +55 -3
  178. package/src/sdk/sdk.ts +12 -0
  179. package/src/models/operations/create-post.ts +0 -62
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 0d41a6f19ed9
4
+ */
5
+
6
+ import * as z from "zod/v4-mini";
7
+ import { FankareSDKCore } from "../core.js";
8
+ import { encodeJSON } from "../lib/encodings.js";
9
+ import { matchStatusCode } from "../lib/http.js";
10
+ import * as M from "../lib/matchers.js";
11
+ import { compactMap } from "../lib/primitives.js";
12
+ import { safeParse } from "../lib/schemas.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
15
+ import { pathToFunc } from "../lib/url.js";
16
+ import { FankareSDKError } from "../models/errors/fankare-sdk-error.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/http-client-errors.js";
24
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
25
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
26
+ import * as models from "../models/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Request a presigned URL to upload or replace the authenticated user's profile banner image
32
+ */
33
+ export function meRequestBannerUploadUrl(
34
+ client: FankareSDKCore,
35
+ request: models.ProfileMediaUploadRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ models.ProfileMediaUploadResponse,
40
+ | FankareSDKError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: FankareSDKCore,
59
+ request: models.ProfileMediaUploadRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ models.ProfileMediaUploadResponse,
65
+ | FankareSDKError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) => z.parse(models.ProfileMediaUploadRequest$outboundSchema, value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = encodeJSON("body", payload, { explode: true });
87
+
88
+ const path = pathToFunc("/users/me/banner/upload-url")();
89
+
90
+ const headers = new Headers(compactMap({
91
+ "Content-Type": "application/json",
92
+ Accept: "application/json",
93
+ }));
94
+
95
+ const secConfig = await extractSecurity(client._options.bearerAuth);
96
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
97
+ const requestSecurity = resolveGlobalSecurity(securityInput);
98
+
99
+ const context = {
100
+ options: client._options,
101
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
102
+ operationID: "requestBannerUploadUrl",
103
+ oAuth2Scopes: null,
104
+
105
+ resolvedSecurity: requestSecurity,
106
+
107
+ securitySource: client._options.bearerAuth,
108
+ retryConfig: options?.retries
109
+ || client._options.retryConfig
110
+ || { strategy: "none" },
111
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
112
+ };
113
+
114
+ const requestRes = client._createRequest(context, {
115
+ security: requestSecurity,
116
+ method: "POST",
117
+ baseURL: options?.serverURL,
118
+ path: path,
119
+ headers: headers,
120
+ body: body,
121
+ userAgent: client._options.userAgent,
122
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
123
+ }, options);
124
+ if (!requestRes.ok) {
125
+ return [requestRes, { status: "invalid" }];
126
+ }
127
+ const req = requestRes.value;
128
+
129
+ const doResult = await client._do(req, {
130
+ context,
131
+ isErrorStatusCode: (statusCode: number) =>
132
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
+ retryConfig: context.retryConfig,
134
+ retryCodes: context.retryCodes,
135
+ });
136
+ if (!doResult.ok) {
137
+ return [doResult, { status: "request-error", request: req }];
138
+ }
139
+ const response = doResult.value;
140
+
141
+ const [result] = await M.match<
142
+ models.ProfileMediaUploadResponse,
143
+ | FankareSDKError
144
+ | ResponseValidationError
145
+ | ConnectionError
146
+ | RequestAbortedError
147
+ | RequestTimeoutError
148
+ | InvalidRequestError
149
+ | UnexpectedClientError
150
+ | SDKValidationError
151
+ >(
152
+ M.json(200, models.ProfileMediaUploadResponse$inboundSchema),
153
+ M.fail([400, 401, "4XX"]),
154
+ M.fail("5XX"),
155
+ )(response, req);
156
+ if (!result.ok) {
157
+ return [result, { status: "complete", request: req, response }];
158
+ }
159
+
160
+ return [result, { status: "complete", request: req, response }];
161
+ }
@@ -0,0 +1,161 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 2f16b9e6792d
4
+ */
5
+
6
+ import * as z from "zod/v4-mini";
7
+ import { FankareSDKCore } from "../core.js";
8
+ import { encodeJSON } from "../lib/encodings.js";
9
+ import { matchStatusCode } from "../lib/http.js";
10
+ import * as M from "../lib/matchers.js";
11
+ import { compactMap } from "../lib/primitives.js";
12
+ import { safeParse } from "../lib/schemas.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
15
+ import { pathToFunc } from "../lib/url.js";
16
+ import { FankareSDKError } from "../models/errors/fankare-sdk-error.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/http-client-errors.js";
24
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
25
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
26
+ import * as models from "../models/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Update the authenticated user's profile text fields
32
+ */
33
+ export function meUpdateMe(
34
+ client: FankareSDKCore,
35
+ request: models.UpdateProfileRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ models.User,
40
+ | FankareSDKError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: FankareSDKCore,
59
+ request: models.UpdateProfileRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ models.User,
65
+ | FankareSDKError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) => z.parse(models.UpdateProfileRequest$outboundSchema, value),
80
+ "Input validation failed",
81
+ );
82
+ if (!parsed.ok) {
83
+ return [parsed, { status: "invalid" }];
84
+ }
85
+ const payload = parsed.value;
86
+ const body = encodeJSON("body", payload, { explode: true });
87
+
88
+ const path = pathToFunc("/users/me")();
89
+
90
+ const headers = new Headers(compactMap({
91
+ "Content-Type": "application/json",
92
+ Accept: "application/json",
93
+ }));
94
+
95
+ const secConfig = await extractSecurity(client._options.bearerAuth);
96
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
97
+ const requestSecurity = resolveGlobalSecurity(securityInput);
98
+
99
+ const context = {
100
+ options: client._options,
101
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
102
+ operationID: "updateMe",
103
+ oAuth2Scopes: null,
104
+
105
+ resolvedSecurity: requestSecurity,
106
+
107
+ securitySource: client._options.bearerAuth,
108
+ retryConfig: options?.retries
109
+ || client._options.retryConfig
110
+ || { strategy: "none" },
111
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
112
+ };
113
+
114
+ const requestRes = client._createRequest(context, {
115
+ security: requestSecurity,
116
+ method: "PATCH",
117
+ baseURL: options?.serverURL,
118
+ path: path,
119
+ headers: headers,
120
+ body: body,
121
+ userAgent: client._options.userAgent,
122
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
123
+ }, options);
124
+ if (!requestRes.ok) {
125
+ return [requestRes, { status: "invalid" }];
126
+ }
127
+ const req = requestRes.value;
128
+
129
+ const doResult = await client._do(req, {
130
+ context,
131
+ isErrorStatusCode: (statusCode: number) =>
132
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
133
+ retryConfig: context.retryConfig,
134
+ retryCodes: context.retryCodes,
135
+ });
136
+ if (!doResult.ok) {
137
+ return [doResult, { status: "request-error", request: req }];
138
+ }
139
+ const response = doResult.value;
140
+
141
+ const [result] = await M.match<
142
+ models.User,
143
+ | FankareSDKError
144
+ | ResponseValidationError
145
+ | ConnectionError
146
+ | RequestAbortedError
147
+ | RequestTimeoutError
148
+ | InvalidRequestError
149
+ | UnexpectedClientError
150
+ | SDKValidationError
151
+ >(
152
+ M.json(200, models.User$inboundSchema),
153
+ M.fail([400, 401, "4XX"]),
154
+ M.fail("5XX"),
155
+ )(response, req);
156
+ if (!result.ok) {
157
+ return [result, { status: "complete", request: req, response }];
158
+ }
159
+
160
+ return [result, { status: "complete", request: req, response }];
161
+ }
@@ -24,12 +24,14 @@ import {
24
24
  import { ResponseValidationError } from "../models/errors/response-validation-error.js";
25
25
  import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
26
26
  import * as models from "../models/index.js";
27
- import * as operations from "../models/operations/index.js";
28
27
  import { APICall, APIPromise } from "../types/async.js";
29
28
  import { Result } from "../types/fp.js";
30
29
 
31
30
  /**
32
- * Create a post blueprint requesting batch upload slots
31
+ * Initiate a new post: reserve asset slots and receive presigned upload URLs
32
+ *
33
+ * @remarks
34
+ * Creates a post record in DRAFT status and reserves one upload slot per declared asset, returning a presigned PUT URL for each. The client uploads each file directly to SeaweedFS using the provided URL. After all uploads are complete the client calls PATCH /posts/{postId} to publish the post. The post is not visible in any feed until it reaches the PUBLISHED status.
33
35
  */
34
36
  export function postsCreatePost(
35
37
  client: FankareSDKCore,
@@ -37,7 +39,7 @@ export function postsCreatePost(
37
39
  options?: RequestOptions,
38
40
  ): APIPromise<
39
41
  Result<
40
- operations.CreatePostResponse,
42
+ models.CreatePostResponse,
41
43
  | FankareSDKError
42
44
  | ResponseValidationError
43
45
  | ConnectionError
@@ -62,7 +64,7 @@ async function $do(
62
64
  ): Promise<
63
65
  [
64
66
  Result<
65
- operations.CreatePostResponse,
67
+ models.CreatePostResponse,
66
68
  | FankareSDKError
67
69
  | ResponseValidationError
68
70
  | ConnectionError
@@ -140,7 +142,7 @@ async function $do(
140
142
  const response = doResult.value;
141
143
 
142
144
  const [result] = await M.match<
143
- operations.CreatePostResponse,
145
+ models.CreatePostResponse,
144
146
  | FankareSDKError
145
147
  | ResponseValidationError
146
148
  | ConnectionError
@@ -150,8 +152,8 @@ async function $do(
150
152
  | UnexpectedClientError
151
153
  | SDKValidationError
152
154
  >(
153
- M.json(202, operations.CreatePostResponse$inboundSchema),
154
- M.fail("4XX"),
155
+ M.json(202, models.CreatePostResponse$inboundSchema),
156
+ M.fail([400, 401, 403, "4XX"]),
155
157
  M.fail("5XX"),
156
158
  )(response, req);
157
159
  if (!result.ok) {
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 24764dad016e
4
+ */
5
+
6
+ import * as z from "zod/v4-mini";
7
+ import { FankareSDKCore } from "../core.js";
8
+ import { encodeSimple } from "../lib/encodings.js";
9
+ import { matchStatusCode } from "../lib/http.js";
10
+ import * as M from "../lib/matchers.js";
11
+ import { compactMap } from "../lib/primitives.js";
12
+ import { safeParse } from "../lib/schemas.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
15
+ import { pathToFunc } from "../lib/url.js";
16
+ import { FankareSDKError } from "../models/errors/fankare-sdk-error.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/http-client-errors.js";
24
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
25
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Delete a post and cascade-delete all associated assets from object storage
32
+ */
33
+ export function postsDeletePost(
34
+ client: FankareSDKCore,
35
+ postId: number,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ void,
40
+ | FankareSDKError
41
+ | ResponseValidationError
42
+ | ConnectionError
43
+ | RequestAbortedError
44
+ | RequestTimeoutError
45
+ | InvalidRequestError
46
+ | UnexpectedClientError
47
+ | SDKValidationError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ postId,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: FankareSDKCore,
59
+ postId: number,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ void,
65
+ | FankareSDKError
66
+ | ResponseValidationError
67
+ | ConnectionError
68
+ | RequestAbortedError
69
+ | RequestTimeoutError
70
+ | InvalidRequestError
71
+ | UnexpectedClientError
72
+ | SDKValidationError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const input: operations.DeletePostRequest = {
78
+ postId: postId,
79
+ };
80
+
81
+ const parsed = safeParse(
82
+ input,
83
+ (value) => z.parse(operations.DeletePostRequest$outboundSchema, value),
84
+ "Input validation failed",
85
+ );
86
+ if (!parsed.ok) {
87
+ return [parsed, { status: "invalid" }];
88
+ }
89
+ const payload = parsed.value;
90
+ const body = null;
91
+
92
+ const pathParams = {
93
+ postId: encodeSimple("postId", payload.postId, {
94
+ explode: false,
95
+ charEncoding: "percent",
96
+ }),
97
+ };
98
+ const path = pathToFunc("/posts/{postId}")(pathParams);
99
+
100
+ const headers = new Headers(compactMap({
101
+ Accept: "*/*",
102
+ }));
103
+
104
+ const secConfig = await extractSecurity(client._options.bearerAuth);
105
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
106
+ const requestSecurity = resolveGlobalSecurity(securityInput);
107
+
108
+ const context = {
109
+ options: client._options,
110
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
111
+ operationID: "deletePost",
112
+ oAuth2Scopes: null,
113
+
114
+ resolvedSecurity: requestSecurity,
115
+
116
+ securitySource: client._options.bearerAuth,
117
+ retryConfig: options?.retries
118
+ || client._options.retryConfig
119
+ || { strategy: "none" },
120
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
121
+ };
122
+
123
+ const requestRes = client._createRequest(context, {
124
+ security: requestSecurity,
125
+ method: "DELETE",
126
+ baseURL: options?.serverURL,
127
+ path: path,
128
+ headers: headers,
129
+ body: body,
130
+ userAgent: client._options.userAgent,
131
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
132
+ }, options);
133
+ if (!requestRes.ok) {
134
+ return [requestRes, { status: "invalid" }];
135
+ }
136
+ const req = requestRes.value;
137
+
138
+ const doResult = await client._do(req, {
139
+ context,
140
+ isErrorStatusCode: (statusCode: number) =>
141
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const [result] = await M.match<
151
+ void,
152
+ | FankareSDKError
153
+ | ResponseValidationError
154
+ | ConnectionError
155
+ | RequestAbortedError
156
+ | RequestTimeoutError
157
+ | InvalidRequestError
158
+ | UnexpectedClientError
159
+ | SDKValidationError
160
+ >(
161
+ M.nil(204, z.void()),
162
+ M.fail([401, 403, 404, "4XX"]),
163
+ M.fail("5XX"),
164
+ )(response, req);
165
+ if (!result.ok) {
166
+ return [result, { status: "complete", request: req, response }];
167
+ }
168
+
169
+ return [result, { status: "complete", request: req, response }];
170
+ }