@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.
- package/FUNCTIONS.md +0 -1
- package/README.md +28 -8
- package/esm/funcs/internal-asset-processing-callback.d.ts +17 -0
- package/esm/funcs/internal-asset-processing-callback.d.ts.map +1 -0
- package/esm/funcs/internal-asset-processing-callback.js +96 -0
- package/esm/funcs/internal-asset-processing-callback.js.map +1 -0
- package/esm/funcs/me-confirm-avatar-upload.d.ts +14 -0
- package/esm/funcs/me-confirm-avatar-upload.d.ts.map +1 -0
- package/esm/funcs/me-confirm-avatar-upload.js +78 -0
- package/esm/funcs/me-confirm-avatar-upload.js.map +1 -0
- package/esm/funcs/me-confirm-banner-upload.d.ts +14 -0
- package/esm/funcs/me-confirm-banner-upload.d.ts.map +1 -0
- package/esm/funcs/me-confirm-banner-upload.js +78 -0
- package/esm/funcs/me-confirm-banner-upload.js.map +1 -0
- package/esm/funcs/me-get-me.d.ts +14 -0
- package/esm/funcs/me-get-me.d.ts.map +1 -0
- package/esm/funcs/me-get-me.js +67 -0
- package/esm/funcs/me-get-me.js.map +1 -0
- package/esm/funcs/me-request-avatar-upload-url.d.ts +14 -0
- package/esm/funcs/me-request-avatar-upload-url.d.ts.map +1 -0
- package/esm/funcs/me-request-avatar-upload-url.js +78 -0
- package/esm/funcs/me-request-avatar-upload-url.js.map +1 -0
- package/esm/funcs/me-request-banner-upload-url.d.ts +14 -0
- package/esm/funcs/me-request-banner-upload-url.d.ts.map +1 -0
- package/esm/funcs/me-request-banner-upload-url.js +78 -0
- package/esm/funcs/me-request-banner-upload-url.js.map +1 -0
- package/esm/funcs/me-update-me.d.ts +14 -0
- package/esm/funcs/me-update-me.d.ts.map +1 -0
- package/esm/funcs/me-update-me.js +78 -0
- package/esm/funcs/me-update-me.js.map +1 -0
- package/esm/funcs/posts-create-post.d.ts +5 -3
- package/esm/funcs/posts-create-post.d.ts.map +1 -1
- package/esm/funcs/posts-create-post.js +5 -3
- package/esm/funcs/posts-create-post.js.map +1 -1
- package/esm/funcs/posts-delete-post.d.ts +13 -0
- package/esm/funcs/posts-delete-post.d.ts.map +1 -0
- package/esm/funcs/posts-delete-post.js +86 -0
- package/esm/funcs/posts-delete-post.js.map +1 -0
- package/esm/funcs/posts-get-post.d.ts +14 -0
- package/esm/funcs/posts-get-post.d.ts.map +1 -0
- package/esm/funcs/posts-get-post.js +87 -0
- package/esm/funcs/posts-get-post.js.map +1 -0
- package/esm/funcs/posts-update-post.d.ts +17 -0
- package/esm/funcs/posts-update-post.d.ts.map +1 -0
- package/esm/funcs/posts-update-post.js +92 -0
- package/esm/funcs/posts-update-post.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/models/asset-declaration.d.ts +52 -0
- package/esm/models/asset-declaration.d.ts.map +1 -0
- package/esm/models/asset-declaration.js +37 -0
- package/esm/models/asset-declaration.js.map +1 -0
- package/esm/models/asset-processing-callback-request.d.ts +39 -0
- package/esm/models/asset-processing-callback-request.d.ts.map +1 -0
- package/esm/models/asset-processing-callback-request.js +24 -0
- package/esm/models/asset-processing-callback-request.js.map +1 -0
- package/esm/models/create-post-request.d.ts +11 -22
- package/esm/models/create-post-request.d.ts.map +1 -1
- package/esm/models/create-post-request.js +3 -16
- package/esm/models/create-post-request.js.map +1 -1
- package/esm/models/create-post-response.d.ts +18 -0
- package/esm/models/create-post-response.d.ts.map +1 -0
- package/esm/models/create-post-response.js +17 -0
- package/esm/models/create-post-response.js.map +1 -0
- package/esm/models/index.d.ts +9 -0
- package/esm/models/index.d.ts.map +1 -1
- package/esm/models/index.js +9 -0
- package/esm/models/index.js.map +1 -1
- package/esm/models/media-asset.d.ts +11 -5
- package/esm/models/media-asset.d.ts.map +1 -1
- package/esm/models/media-asset.js +4 -5
- package/esm/models/media-asset.js.map +1 -1
- package/esm/models/operations/asset-processing-callback.d.ts +17 -0
- package/esm/models/operations/asset-processing-callback.d.ts.map +1 -0
- package/esm/models/operations/asset-processing-callback.js +16 -0
- package/esm/models/operations/asset-processing-callback.js.map +1 -0
- package/esm/models/operations/delete-post.d.ts +12 -0
- package/esm/models/operations/delete-post.d.ts.map +1 -0
- package/esm/models/operations/delete-post.js +13 -0
- package/esm/models/operations/delete-post.js.map +1 -0
- package/esm/models/operations/get-post.d.ts +12 -0
- package/esm/models/operations/get-post.d.ts.map +1 -0
- package/esm/models/operations/get-post.js +13 -0
- package/esm/models/operations/get-post.js.map +1 -0
- package/esm/models/operations/index.d.ts +4 -1
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +4 -1
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/update-post.d.ts +15 -0
- package/esm/models/operations/update-post.d.ts.map +1 -0
- package/esm/models/operations/update-post.js +15 -0
- package/esm/models/operations/update-post.js.map +1 -0
- package/esm/models/post.d.ts +20 -1
- package/esm/models/post.d.ts.map +1 -1
- package/esm/models/post.js +13 -1
- package/esm/models/post.js.map +1 -1
- package/esm/models/profile-media-confirm-request.d.ts +15 -0
- package/esm/models/profile-media-confirm-request.d.ts.map +1 -0
- package/esm/models/profile-media-confirm-request.js +13 -0
- package/esm/models/profile-media-confirm-request.js.map +1 -0
- package/esm/models/profile-media-upload-request.d.ts +30 -0
- package/esm/models/profile-media-upload-request.d.ts.map +1 -0
- package/esm/models/profile-media-upload-request.js +23 -0
- package/esm/models/profile-media-upload-request.js.map +1 -0
- package/esm/models/profile-media-upload-response.d.ts +21 -0
- package/esm/models/profile-media-upload-response.d.ts.map +1 -0
- package/esm/models/profile-media-upload-response.js +17 -0
- package/esm/models/profile-media-upload-response.js.map +1 -0
- package/esm/models/register-request.d.ts +2 -2
- package/esm/models/register-request.d.ts.map +1 -1
- package/esm/models/register-request.js +1 -1
- package/esm/models/register-request.js.map +1 -1
- package/esm/models/update-post-request.d.ts +30 -0
- package/esm/models/update-post-request.d.ts.map +1 -0
- package/esm/models/update-post-request.js +22 -0
- package/esm/models/update-post-request.js.map +1 -0
- package/esm/models/update-profile-request.d.ts +17 -0
- package/esm/models/update-profile-request.d.ts.map +1 -0
- package/esm/models/update-profile-request.js +14 -0
- package/esm/models/update-profile-request.js.map +1 -0
- package/esm/models/upload-slot.d.ts +29 -0
- package/esm/models/upload-slot.d.ts.map +1 -0
- package/esm/models/upload-slot.js +20 -0
- package/esm/models/upload-slot.js.map +1 -0
- package/esm/sdk/internal.d.ts +12 -0
- package/esm/sdk/internal.d.ts.map +1 -0
- package/esm/sdk/internal.js +19 -0
- package/esm/sdk/internal.js.map +1 -0
- package/esm/sdk/me.d.ts +29 -0
- package/esm/sdk/me.d.ts.map +1 -0
- package/esm/sdk/me.js +51 -0
- package/esm/sdk/me.js.map +1 -0
- package/esm/sdk/posts.d.ts +20 -3
- package/esm/sdk/posts.d.ts.map +1 -1
- package/esm/sdk/posts.js +28 -1
- package/esm/sdk/posts.js.map +1 -1
- package/esm/sdk/sdk.d.ts +6 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +10 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/examples/authenticationRegisterUser.example.ts +0 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/internal-asset-processing-callback.ts +190 -0
- package/src/funcs/me-confirm-avatar-upload.ts +161 -0
- package/src/funcs/me-confirm-banner-upload.ts +161 -0
- package/src/funcs/me-get-me.ts +142 -0
- package/src/funcs/me-request-avatar-upload-url.ts +161 -0
- package/src/funcs/me-request-banner-upload-url.ts +161 -0
- package/src/funcs/me-update-me.ts +161 -0
- package/src/funcs/posts-create-post.ts +9 -7
- package/src/funcs/posts-delete-post.ts +170 -0
- package/src/funcs/posts-get-post.ts +171 -0
- package/src/funcs/posts-update-post.ts +179 -0
- package/src/lib/config.ts +3 -3
- package/src/models/asset-declaration.ts +84 -0
- package/src/models/asset-processing-callback-request.ts +68 -0
- package/src/models/create-post-request.ts +17 -39
- package/src/models/create-post-response.ts +41 -0
- package/src/models/index.ts +9 -0
- package/src/models/media-asset.ts +16 -8
- package/src/models/operations/asset-processing-callback.ts +40 -0
- package/src/models/operations/delete-post.ts +31 -0
- package/src/models/operations/get-post.ts +27 -0
- package/src/models/operations/index.ts +4 -1
- package/src/models/operations/update-post.ts +35 -0
- package/src/models/post.ts +27 -2
- package/src/models/profile-media-confirm-request.ts +34 -0
- package/src/models/profile-media-upload-request.ts +55 -0
- package/src/models/profile-media-upload-response.ts +45 -0
- package/src/models/register-request.ts +3 -3
- package/src/models/update-post-request.ts +56 -0
- package/src/models/update-profile-request.ts +37 -0
- package/src/models/upload-slot.ts +53 -0
- package/src/sdk/internal.ts +32 -0
- package/src/sdk/me.ts +98 -0
- package/src/sdk/posts.ts +55 -3
- package/src/sdk/sdk.ts +12 -0
- package/src/models/operations/create-post.ts +0 -62
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 023637cf7ecc
|
|
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 models from "../models/index.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Fetch a single post by ID, including all asset statuses
|
|
33
|
+
*/
|
|
34
|
+
export function postsGetPost(
|
|
35
|
+
client: FankareSDKCore,
|
|
36
|
+
postId: number,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
models.Post,
|
|
41
|
+
| FankareSDKError
|
|
42
|
+
| ResponseValidationError
|
|
43
|
+
| ConnectionError
|
|
44
|
+
| RequestAbortedError
|
|
45
|
+
| RequestTimeoutError
|
|
46
|
+
| InvalidRequestError
|
|
47
|
+
| UnexpectedClientError
|
|
48
|
+
| SDKValidationError
|
|
49
|
+
>
|
|
50
|
+
> {
|
|
51
|
+
return new APIPromise($do(
|
|
52
|
+
client,
|
|
53
|
+
postId,
|
|
54
|
+
options,
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function $do(
|
|
59
|
+
client: FankareSDKCore,
|
|
60
|
+
postId: number,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
models.Post,
|
|
66
|
+
| FankareSDKError
|
|
67
|
+
| ResponseValidationError
|
|
68
|
+
| ConnectionError
|
|
69
|
+
| RequestAbortedError
|
|
70
|
+
| RequestTimeoutError
|
|
71
|
+
| InvalidRequestError
|
|
72
|
+
| UnexpectedClientError
|
|
73
|
+
| SDKValidationError
|
|
74
|
+
>,
|
|
75
|
+
APICall,
|
|
76
|
+
]
|
|
77
|
+
> {
|
|
78
|
+
const input: operations.GetPostRequest = {
|
|
79
|
+
postId: postId,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
input,
|
|
84
|
+
(value) => z.parse(operations.GetPostRequest$outboundSchema, value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
93
|
+
const pathParams = {
|
|
94
|
+
postId: encodeSimple("postId", payload.postId, {
|
|
95
|
+
explode: false,
|
|
96
|
+
charEncoding: "percent",
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
const path = pathToFunc("/posts/{postId}")(pathParams);
|
|
100
|
+
|
|
101
|
+
const headers = new Headers(compactMap({
|
|
102
|
+
Accept: "application/json",
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
106
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
107
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
108
|
+
|
|
109
|
+
const context = {
|
|
110
|
+
options: client._options,
|
|
111
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
112
|
+
operationID: "getPost",
|
|
113
|
+
oAuth2Scopes: null,
|
|
114
|
+
|
|
115
|
+
resolvedSecurity: requestSecurity,
|
|
116
|
+
|
|
117
|
+
securitySource: client._options.bearerAuth,
|
|
118
|
+
retryConfig: options?.retries
|
|
119
|
+
|| client._options.retryConfig
|
|
120
|
+
|| { strategy: "none" },
|
|
121
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const requestRes = client._createRequest(context, {
|
|
125
|
+
security: requestSecurity,
|
|
126
|
+
method: "GET",
|
|
127
|
+
baseURL: options?.serverURL,
|
|
128
|
+
path: path,
|
|
129
|
+
headers: headers,
|
|
130
|
+
body: body,
|
|
131
|
+
userAgent: client._options.userAgent,
|
|
132
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
133
|
+
}, options);
|
|
134
|
+
if (!requestRes.ok) {
|
|
135
|
+
return [requestRes, { status: "invalid" }];
|
|
136
|
+
}
|
|
137
|
+
const req = requestRes.value;
|
|
138
|
+
|
|
139
|
+
const doResult = await client._do(req, {
|
|
140
|
+
context,
|
|
141
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
142
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
143
|
+
retryConfig: context.retryConfig,
|
|
144
|
+
retryCodes: context.retryCodes,
|
|
145
|
+
});
|
|
146
|
+
if (!doResult.ok) {
|
|
147
|
+
return [doResult, { status: "request-error", request: req }];
|
|
148
|
+
}
|
|
149
|
+
const response = doResult.value;
|
|
150
|
+
|
|
151
|
+
const [result] = await M.match<
|
|
152
|
+
models.Post,
|
|
153
|
+
| FankareSDKError
|
|
154
|
+
| ResponseValidationError
|
|
155
|
+
| ConnectionError
|
|
156
|
+
| RequestAbortedError
|
|
157
|
+
| RequestTimeoutError
|
|
158
|
+
| InvalidRequestError
|
|
159
|
+
| UnexpectedClientError
|
|
160
|
+
| SDKValidationError
|
|
161
|
+
>(
|
|
162
|
+
M.json(200, models.Post$inboundSchema),
|
|
163
|
+
M.fail([401, 404, "4XX"]),
|
|
164
|
+
M.fail("5XX"),
|
|
165
|
+
)(response, req);
|
|
166
|
+
if (!result.ok) {
|
|
167
|
+
return [result, { status: "complete", request: req, response }];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return [result, { status: "complete", request: req, response }];
|
|
171
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: c35894cf389e
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v4-mini";
|
|
7
|
+
import { FankareSDKCore } from "../core.js";
|
|
8
|
+
import { encodeJSON, 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 models from "../models/index.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Publish or update a post
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Used to publish a DRAFT post once all asset uploads are complete, or to update the caption of an already-published post. Setting status to PUBLISHED triggers a server-side check that all required assets have been received by the object store before making the post visible in feeds. A post with assets still in PROCESSING state cannot be published.
|
|
36
|
+
*/
|
|
37
|
+
export function postsUpdatePost(
|
|
38
|
+
client: FankareSDKCore,
|
|
39
|
+
postId: number,
|
|
40
|
+
body: models.UpdatePostRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): APIPromise<
|
|
43
|
+
Result<
|
|
44
|
+
models.Post,
|
|
45
|
+
| FankareSDKError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
postId,
|
|
58
|
+
body,
|
|
59
|
+
options,
|
|
60
|
+
));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function $do(
|
|
64
|
+
client: FankareSDKCore,
|
|
65
|
+
postId: number,
|
|
66
|
+
body: models.UpdatePostRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
models.Post,
|
|
72
|
+
| FankareSDKError
|
|
73
|
+
| ResponseValidationError
|
|
74
|
+
| ConnectionError
|
|
75
|
+
| RequestAbortedError
|
|
76
|
+
| RequestTimeoutError
|
|
77
|
+
| InvalidRequestError
|
|
78
|
+
| UnexpectedClientError
|
|
79
|
+
| SDKValidationError
|
|
80
|
+
>,
|
|
81
|
+
APICall,
|
|
82
|
+
]
|
|
83
|
+
> {
|
|
84
|
+
const input: operations.UpdatePostRequest = {
|
|
85
|
+
postId: postId,
|
|
86
|
+
body: body,
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const parsed = safeParse(
|
|
90
|
+
input,
|
|
91
|
+
(value) => z.parse(operations.UpdatePostRequest$outboundSchema, value),
|
|
92
|
+
"Input validation failed",
|
|
93
|
+
);
|
|
94
|
+
if (!parsed.ok) {
|
|
95
|
+
return [parsed, { status: "invalid" }];
|
|
96
|
+
}
|
|
97
|
+
const payload = parsed.value;
|
|
98
|
+
const body$ = encodeJSON("body", payload.body, { explode: true });
|
|
99
|
+
|
|
100
|
+
const pathParams = {
|
|
101
|
+
postId: encodeSimple("postId", payload.postId, {
|
|
102
|
+
explode: false,
|
|
103
|
+
charEncoding: "percent",
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
const path = pathToFunc("/posts/{postId}")(pathParams);
|
|
107
|
+
|
|
108
|
+
const headers = new Headers(compactMap({
|
|
109
|
+
"Content-Type": "application/json",
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
114
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
options: client._options,
|
|
119
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
120
|
+
operationID: "updatePost",
|
|
121
|
+
oAuth2Scopes: null,
|
|
122
|
+
|
|
123
|
+
resolvedSecurity: requestSecurity,
|
|
124
|
+
|
|
125
|
+
securitySource: client._options.bearerAuth,
|
|
126
|
+
retryConfig: options?.retries
|
|
127
|
+
|| client._options.retryConfig
|
|
128
|
+
|| { strategy: "none" },
|
|
129
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const requestRes = client._createRequest(context, {
|
|
133
|
+
security: requestSecurity,
|
|
134
|
+
method: "PATCH",
|
|
135
|
+
baseURL: options?.serverURL,
|
|
136
|
+
path: path,
|
|
137
|
+
headers: headers,
|
|
138
|
+
body: body$,
|
|
139
|
+
userAgent: client._options.userAgent,
|
|
140
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
141
|
+
}, options);
|
|
142
|
+
if (!requestRes.ok) {
|
|
143
|
+
return [requestRes, { status: "invalid" }];
|
|
144
|
+
}
|
|
145
|
+
const req = requestRes.value;
|
|
146
|
+
|
|
147
|
+
const doResult = await client._do(req, {
|
|
148
|
+
context,
|
|
149
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
150
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
151
|
+
retryConfig: context.retryConfig,
|
|
152
|
+
retryCodes: context.retryCodes,
|
|
153
|
+
});
|
|
154
|
+
if (!doResult.ok) {
|
|
155
|
+
return [doResult, { status: "request-error", request: req }];
|
|
156
|
+
}
|
|
157
|
+
const response = doResult.value;
|
|
158
|
+
|
|
159
|
+
const [result] = await M.match<
|
|
160
|
+
models.Post,
|
|
161
|
+
| FankareSDKError
|
|
162
|
+
| ResponseValidationError
|
|
163
|
+
| ConnectionError
|
|
164
|
+
| RequestAbortedError
|
|
165
|
+
| RequestTimeoutError
|
|
166
|
+
| InvalidRequestError
|
|
167
|
+
| UnexpectedClientError
|
|
168
|
+
| SDKValidationError
|
|
169
|
+
>(
|
|
170
|
+
M.json(200, models.Post$inboundSchema),
|
|
171
|
+
M.fail([400, 401, 403, 404, "4XX"]),
|
|
172
|
+
M.fail("5XX"),
|
|
173
|
+
)(response, req);
|
|
174
|
+
if (!result.ok) {
|
|
175
|
+
return [result, { status: "complete", request: req, response }];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -61,8 +61,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
61
61
|
|
|
62
62
|
export const SDK_METADATA = {
|
|
63
63
|
language: "typescript",
|
|
64
|
-
openapiDocVersion: "1.
|
|
65
|
-
sdkVersion: "0.0
|
|
64
|
+
openapiDocVersion: "1.1.0",
|
|
65
|
+
sdkVersion: "0.1.0",
|
|
66
66
|
genVersion: "2.911.0",
|
|
67
|
-
userAgent: "speakeasy-sdk/typescript 0.0
|
|
67
|
+
userAgent: "speakeasy-sdk/typescript 0.1.0 2.911.0 1.1.0 openapi",
|
|
68
68
|
} as const;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 382ff0659e0a
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v4-mini";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Logical media category used to route the Celery processing task.
|
|
11
|
+
*/
|
|
12
|
+
export const AssetDeclarationMediaType = {
|
|
13
|
+
Image: "IMAGE",
|
|
14
|
+
Video: "VIDEO",
|
|
15
|
+
} as const;
|
|
16
|
+
/**
|
|
17
|
+
* Logical media category used to route the Celery processing task.
|
|
18
|
+
*/
|
|
19
|
+
export type AssetDeclarationMediaType = ClosedEnum<
|
|
20
|
+
typeof AssetDeclarationMediaType
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* MIME type of the file to be uploaded. Must match the mediaType category.
|
|
25
|
+
*/
|
|
26
|
+
export const AssetDeclarationContentType = {
|
|
27
|
+
ImageJpeg: "image/jpeg",
|
|
28
|
+
ImagePng: "image/png",
|
|
29
|
+
ImageWebp: "image/webp",
|
|
30
|
+
ImageGif: "image/gif",
|
|
31
|
+
VideoMp4: "video/mp4",
|
|
32
|
+
VideoQuicktime: "video/quicktime",
|
|
33
|
+
VideoXMatroska: "video/x-matroska",
|
|
34
|
+
} as const;
|
|
35
|
+
/**
|
|
36
|
+
* MIME type of the file to be uploaded. Must match the mediaType category.
|
|
37
|
+
*/
|
|
38
|
+
export type AssetDeclarationContentType = ClosedEnum<
|
|
39
|
+
typeof AssetDeclarationContentType
|
|
40
|
+
>;
|
|
41
|
+
|
|
42
|
+
export type AssetDeclaration = {
|
|
43
|
+
/**
|
|
44
|
+
* Logical media category used to route the Celery processing task.
|
|
45
|
+
*/
|
|
46
|
+
mediaType: AssetDeclarationMediaType;
|
|
47
|
+
/**
|
|
48
|
+
* MIME type of the file to be uploaded. Must match the mediaType category.
|
|
49
|
+
*/
|
|
50
|
+
contentType: AssetDeclarationContentType;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
export const AssetDeclarationMediaType$outboundSchema: z.ZodMiniEnum<
|
|
55
|
+
typeof AssetDeclarationMediaType
|
|
56
|
+
> = z.enum(AssetDeclarationMediaType);
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export const AssetDeclarationContentType$outboundSchema: z.ZodMiniEnum<
|
|
60
|
+
typeof AssetDeclarationContentType
|
|
61
|
+
> = z.enum(AssetDeclarationContentType);
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type AssetDeclaration$Outbound = {
|
|
65
|
+
mediaType: string;
|
|
66
|
+
contentType: string;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/** @internal */
|
|
70
|
+
export const AssetDeclaration$outboundSchema: z.ZodMiniType<
|
|
71
|
+
AssetDeclaration$Outbound,
|
|
72
|
+
AssetDeclaration
|
|
73
|
+
> = z.object({
|
|
74
|
+
mediaType: AssetDeclarationMediaType$outboundSchema,
|
|
75
|
+
contentType: AssetDeclarationContentType$outboundSchema,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export function assetDeclarationToJSON(
|
|
79
|
+
assetDeclaration: AssetDeclaration,
|
|
80
|
+
): string {
|
|
81
|
+
return JSON.stringify(
|
|
82
|
+
AssetDeclaration$outboundSchema.parse(assetDeclaration),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: b75d6ac67429
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v4-mini";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The terminal processing outcome reported by the Celery worker.
|
|
11
|
+
*/
|
|
12
|
+
export const AssetProcessingCallbackRequestStatus = {
|
|
13
|
+
Ready: "READY",
|
|
14
|
+
Failed: "FAILED",
|
|
15
|
+
} as const;
|
|
16
|
+
/**
|
|
17
|
+
* The terminal processing outcome reported by the Celery worker.
|
|
18
|
+
*/
|
|
19
|
+
export type AssetProcessingCallbackRequestStatus = ClosedEnum<
|
|
20
|
+
typeof AssetProcessingCallbackRequestStatus
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export type AssetProcessingCallbackRequest = {
|
|
24
|
+
/**
|
|
25
|
+
* The terminal processing outcome reported by the Celery worker.
|
|
26
|
+
*/
|
|
27
|
+
status: AssetProcessingCallbackRequestStatus;
|
|
28
|
+
/**
|
|
29
|
+
* The canonical SeaweedFS path of the transcoded/optimised output file. Required when status is READY. The gateway overwrites post_assets.media_key with this value so that mediaUrl is derived from the processed file, not the raw upload.
|
|
30
|
+
*/
|
|
31
|
+
finalMediaKey?: string | null | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Human-readable failure reason for logging and observability. Only meaningful when status is FAILED.
|
|
34
|
+
*/
|
|
35
|
+
errorReason?: string | null | undefined;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const AssetProcessingCallbackRequestStatus$outboundSchema: z.ZodMiniEnum<
|
|
40
|
+
typeof AssetProcessingCallbackRequestStatus
|
|
41
|
+
> = z.enum(AssetProcessingCallbackRequestStatus);
|
|
42
|
+
|
|
43
|
+
/** @internal */
|
|
44
|
+
export type AssetProcessingCallbackRequest$Outbound = {
|
|
45
|
+
status: string;
|
|
46
|
+
finalMediaKey?: string | null | undefined;
|
|
47
|
+
errorReason?: string | null | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const AssetProcessingCallbackRequest$outboundSchema: z.ZodMiniType<
|
|
52
|
+
AssetProcessingCallbackRequest$Outbound,
|
|
53
|
+
AssetProcessingCallbackRequest
|
|
54
|
+
> = z.object({
|
|
55
|
+
status: AssetProcessingCallbackRequestStatus$outboundSchema,
|
|
56
|
+
finalMediaKey: z.optional(z.nullable(z.string())),
|
|
57
|
+
errorReason: z.optional(z.nullable(z.string())),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export function assetProcessingCallbackRequestToJSON(
|
|
61
|
+
assetProcessingCallbackRequest: AssetProcessingCallbackRequest,
|
|
62
|
+
): string {
|
|
63
|
+
return JSON.stringify(
|
|
64
|
+
AssetProcessingCallbackRequest$outboundSchema.parse(
|
|
65
|
+
assetProcessingCallbackRequest,
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -4,49 +4,27 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import * as z from "zod/v4-mini";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} as const;
|
|
13
|
-
export type CreatePostRequestMediaType = ClosedEnum<
|
|
14
|
-
typeof CreatePostRequestMediaType
|
|
15
|
-
>;
|
|
16
|
-
|
|
17
|
-
export type Asset = {
|
|
18
|
-
mediaType: CreatePostRequestMediaType;
|
|
19
|
-
};
|
|
7
|
+
import {
|
|
8
|
+
AssetDeclaration,
|
|
9
|
+
AssetDeclaration$Outbound,
|
|
10
|
+
AssetDeclaration$outboundSchema,
|
|
11
|
+
} from "./asset-declaration.js";
|
|
20
12
|
|
|
21
13
|
export type CreatePostRequest = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/** @internal */
|
|
32
|
-
export type Asset$Outbound = {
|
|
33
|
-
mediaType: string;
|
|
14
|
+
/**
|
|
15
|
+
* Optional caption for the post. May be set now or supplied later via PATCH.
|
|
16
|
+
*/
|
|
17
|
+
caption?: string | null | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Ordered list of media assets to attach to this post. The array index determines sort_order.
|
|
20
|
+
*/
|
|
21
|
+
assets: Array<AssetDeclaration>;
|
|
34
22
|
};
|
|
35
23
|
|
|
36
|
-
/** @internal */
|
|
37
|
-
export const Asset$outboundSchema: z.ZodMiniType<Asset$Outbound, Asset> = z
|
|
38
|
-
.object({
|
|
39
|
-
mediaType: CreatePostRequestMediaType$outboundSchema,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export function assetToJSON(asset: Asset): string {
|
|
43
|
-
return JSON.stringify(Asset$outboundSchema.parse(asset));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
24
|
/** @internal */
|
|
47
25
|
export type CreatePostRequest$Outbound = {
|
|
48
|
-
caption
|
|
49
|
-
assets: Array<
|
|
26
|
+
caption?: string | null | undefined;
|
|
27
|
+
assets: Array<AssetDeclaration$Outbound>;
|
|
50
28
|
};
|
|
51
29
|
|
|
52
30
|
/** @internal */
|
|
@@ -54,8 +32,8 @@ export const CreatePostRequest$outboundSchema: z.ZodMiniType<
|
|
|
54
32
|
CreatePostRequest$Outbound,
|
|
55
33
|
CreatePostRequest
|
|
56
34
|
> = z.object({
|
|
57
|
-
caption: z.string(),
|
|
58
|
-
assets: z.array(
|
|
35
|
+
caption: z.optional(z.nullable(z.string())),
|
|
36
|
+
assets: z.array(AssetDeclaration$outboundSchema),
|
|
59
37
|
});
|
|
60
38
|
|
|
61
39
|
export function createPostRequestToJSON(
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: dd751a66d133
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v4-mini";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import * as types from "../types/primitives.js";
|
|
10
|
+
import { SDKValidationError } from "./errors/sdk-validation-error.js";
|
|
11
|
+
import { UploadSlot, UploadSlot$inboundSchema } from "./upload-slot.js";
|
|
12
|
+
|
|
13
|
+
export type CreatePostResponse = {
|
|
14
|
+
/**
|
|
15
|
+
* ID of the newly created DRAFT post.
|
|
16
|
+
*/
|
|
17
|
+
postId?: number | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* One entry per declared asset, in the same order as the request.
|
|
20
|
+
*/
|
|
21
|
+
uploadSlots?: Array<UploadSlot> | undefined;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** @internal */
|
|
25
|
+
export const CreatePostResponse$inboundSchema: z.ZodMiniType<
|
|
26
|
+
CreatePostResponse,
|
|
27
|
+
unknown
|
|
28
|
+
> = z.object({
|
|
29
|
+
postId: types.optional(types.number()),
|
|
30
|
+
uploadSlots: types.optional(z.array(UploadSlot$inboundSchema)),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export function createPostResponseFromJSON(
|
|
34
|
+
jsonString: string,
|
|
35
|
+
): SafeParseResult<CreatePostResponse, SDKValidationError> {
|
|
36
|
+
return safeParse(
|
|
37
|
+
jsonString,
|
|
38
|
+
(x) => CreatePostResponse$inboundSchema.parse(JSON.parse(x)),
|
|
39
|
+
`Failed to parse 'CreatePostResponse' from JSON`,
|
|
40
|
+
);
|
|
41
|
+
}
|
package/src/models/index.ts
CHANGED
|
@@ -3,16 +3,25 @@
|
|
|
3
3
|
* @generated-id: f93644b0f37e
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
export * from "./asset-declaration.js";
|
|
7
|
+
export * from "./asset-processing-callback-request.js";
|
|
6
8
|
export * from "./collection.js";
|
|
7
9
|
export * from "./conversation.js";
|
|
8
10
|
export * from "./create-post-request.js";
|
|
11
|
+
export * from "./create-post-response.js";
|
|
9
12
|
export * from "./login-request.js";
|
|
10
13
|
export * from "./media-asset.js";
|
|
11
14
|
export * from "./message.js";
|
|
12
15
|
export * from "./paginated-posts-response.js";
|
|
13
16
|
export * from "./post.js";
|
|
17
|
+
export * from "./profile-media-confirm-request.js";
|
|
18
|
+
export * from "./profile-media-upload-request.js";
|
|
19
|
+
export * from "./profile-media-upload-response.js";
|
|
14
20
|
export * from "./register-request.js";
|
|
15
21
|
export * from "./security.js";
|
|
16
22
|
export * from "./send-message-request.js";
|
|
23
|
+
export * from "./update-post-request.js";
|
|
24
|
+
export * from "./update-profile-request.js";
|
|
25
|
+
export * from "./upload-slot.js";
|
|
17
26
|
export * from "./user-profile.js";
|
|
18
27
|
export * from "./user.js";
|