@aurora-interactive/fankare-api-sdk 0.1.0 → 0.1.2

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 (233) hide show
  1. package/README.md +37 -1
  2. package/esm/funcs/creators-discovery-get-featured-creators.d.ts +14 -0
  3. package/esm/funcs/creators-discovery-get-featured-creators.d.ts.map +1 -0
  4. package/esm/funcs/creators-discovery-get-featured-creators.js +85 -0
  5. package/esm/funcs/creators-discovery-get-featured-creators.js.map +1 -0
  6. package/esm/funcs/creators-discovery-get-trending-creators.d.ts +14 -0
  7. package/esm/funcs/creators-discovery-get-trending-creators.d.ts.map +1 -0
  8. package/esm/funcs/creators-discovery-get-trending-creators.js +85 -0
  9. package/esm/funcs/creators-discovery-get-trending-creators.js.map +1 -0
  10. package/esm/funcs/notifications-get-notifications.d.ts +14 -0
  11. package/esm/funcs/notifications-get-notifications.d.ts.map +1 -0
  12. package/esm/funcs/notifications-get-notifications.js +87 -0
  13. package/esm/funcs/notifications-get-notifications.js.map +1 -0
  14. package/esm/funcs/notifications-get-unread-notification-count.d.ts +14 -0
  15. package/esm/funcs/notifications-get-unread-notification-count.d.ts.map +1 -0
  16. package/esm/funcs/notifications-get-unread-notification-count.js +67 -0
  17. package/esm/funcs/notifications-get-unread-notification-count.js.map +1 -0
  18. package/esm/funcs/notifications-mark-notifications-as-read.d.ts +14 -0
  19. package/esm/funcs/notifications-mark-notifications-as-read.d.ts.map +1 -0
  20. package/esm/funcs/notifications-mark-notifications-as-read.js +78 -0
  21. package/esm/funcs/notifications-mark-notifications-as-read.js.map +1 -0
  22. package/esm/funcs/posts-create-comment.d.ts +14 -0
  23. package/esm/funcs/posts-create-comment.d.ts.map +1 -0
  24. package/esm/funcs/posts-create-comment.js +89 -0
  25. package/esm/funcs/posts-create-comment.js.map +1 -0
  26. package/esm/funcs/posts-delete-comment.d.ts +13 -0
  27. package/esm/funcs/posts-delete-comment.d.ts.map +1 -0
  28. package/esm/funcs/posts-delete-comment.js +91 -0
  29. package/esm/funcs/posts-delete-comment.js.map +1 -0
  30. package/esm/funcs/posts-get-post-comments.d.ts +14 -0
  31. package/esm/funcs/posts-get-post-comments.d.ts.map +1 -0
  32. package/esm/funcs/posts-get-post-comments.js +94 -0
  33. package/esm/funcs/posts-get-post-comments.js.map +1 -0
  34. package/esm/funcs/posts-get-post-likes.d.ts +14 -0
  35. package/esm/funcs/posts-get-post-likes.d.ts.map +1 -0
  36. package/esm/funcs/posts-get-post-likes.js +94 -0
  37. package/esm/funcs/posts-get-post-likes.js.map +1 -0
  38. package/esm/funcs/posts-like-post.d.ts +13 -0
  39. package/esm/funcs/posts-like-post.d.ts.map +1 -0
  40. package/esm/funcs/posts-like-post.js +86 -0
  41. package/esm/funcs/posts-like-post.js.map +1 -0
  42. package/esm/funcs/posts-unlike-post.d.ts +13 -0
  43. package/esm/funcs/posts-unlike-post.d.ts.map +1 -0
  44. package/esm/funcs/posts-unlike-post.js +86 -0
  45. package/esm/funcs/posts-unlike-post.js.map +1 -0
  46. package/esm/funcs/user-discovery-get-follower-count.d.ts +14 -0
  47. package/esm/funcs/user-discovery-get-follower-count.d.ts.map +1 -0
  48. package/esm/funcs/user-discovery-get-follower-count.js +67 -0
  49. package/esm/funcs/user-discovery-get-follower-count.js.map +1 -0
  50. package/esm/funcs/user-discovery-get-followers.d.ts +14 -0
  51. package/esm/funcs/user-discovery-get-followers.d.ts.map +1 -0
  52. package/esm/funcs/user-discovery-get-followers.js +87 -0
  53. package/esm/funcs/user-discovery-get-followers.js.map +1 -0
  54. package/esm/funcs/user-discovery-get-user-follower-count.d.ts +14 -0
  55. package/esm/funcs/user-discovery-get-user-follower-count.d.ts.map +1 -0
  56. package/esm/funcs/user-discovery-get-user-follower-count.js +87 -0
  57. package/esm/funcs/user-discovery-get-user-follower-count.js.map +1 -0
  58. package/esm/funcs/user-discovery-get-user-followers.d.ts +14 -0
  59. package/esm/funcs/user-discovery-get-user-followers.d.ts.map +1 -0
  60. package/esm/funcs/user-discovery-get-user-followers.js +94 -0
  61. package/esm/funcs/user-discovery-get-user-followers.js.map +1 -0
  62. package/esm/lib/config.d.ts +3 -3
  63. package/esm/lib/config.d.ts.map +1 -1
  64. package/esm/lib/config.js +3 -3
  65. package/esm/lib/config.js.map +1 -1
  66. package/esm/models/comment.d.ts +15 -0
  67. package/esm/models/comment.d.ts.map +1 -0
  68. package/esm/models/comment.js +20 -0
  69. package/esm/models/comment.js.map +1 -0
  70. package/esm/models/create-comment-request.d.ts +15 -0
  71. package/esm/models/create-comment-request.d.ts.map +1 -0
  72. package/esm/models/create-comment-request.js +13 -0
  73. package/esm/models/create-comment-request.js.map +1 -0
  74. package/esm/models/follower-count-response.d.ts +10 -0
  75. package/esm/models/follower-count-response.d.ts.map +1 -0
  76. package/esm/models/follower-count-response.js +15 -0
  77. package/esm/models/follower-count-response.js.map +1 -0
  78. package/esm/models/index.d.ts +10 -0
  79. package/esm/models/index.d.ts.map +1 -1
  80. package/esm/models/index.js +10 -0
  81. package/esm/models/index.js.map +1 -1
  82. package/esm/models/mark-notifications-read-request.d.ts +20 -0
  83. package/esm/models/mark-notifications-read-request.d.ts.map +1 -0
  84. package/esm/models/mark-notifications-read-request.js +14 -0
  85. package/esm/models/mark-notifications-read-request.js.map +1 -0
  86. package/esm/models/notification.d.ts +30 -0
  87. package/esm/models/notification.d.ts.map +1 -0
  88. package/esm/models/notification.js +31 -0
  89. package/esm/models/notification.js.map +1 -0
  90. package/esm/models/operations/create-comment.d.ts +15 -0
  91. package/esm/models/operations/create-comment.d.ts.map +1 -0
  92. package/esm/models/operations/create-comment.js +15 -0
  93. package/esm/models/operations/create-comment.js.map +1 -0
  94. package/esm/models/operations/delete-comment.d.ts +14 -0
  95. package/esm/models/operations/delete-comment.d.ts.map +1 -0
  96. package/esm/models/operations/delete-comment.js +14 -0
  97. package/esm/models/operations/delete-comment.js.map +1 -0
  98. package/esm/models/operations/get-featured-creators.d.ts +12 -0
  99. package/esm/models/operations/get-featured-creators.d.ts.map +1 -0
  100. package/esm/models/operations/get-featured-creators.js +13 -0
  101. package/esm/models/operations/get-featured-creators.js.map +1 -0
  102. package/esm/models/operations/get-followers.d.ts +17 -0
  103. package/esm/models/operations/get-followers.d.ts.map +1 -0
  104. package/esm/models/operations/get-followers.js +14 -0
  105. package/esm/models/operations/get-followers.js.map +1 -0
  106. package/esm/models/operations/get-notifications.d.ts +17 -0
  107. package/esm/models/operations/get-notifications.d.ts.map +1 -0
  108. package/esm/models/operations/get-notifications.js +14 -0
  109. package/esm/models/operations/get-notifications.js.map +1 -0
  110. package/esm/models/operations/get-post-comments.d.ts +19 -0
  111. package/esm/models/operations/get-post-comments.d.ts.map +1 -0
  112. package/esm/models/operations/get-post-comments.js +15 -0
  113. package/esm/models/operations/get-post-comments.js.map +1 -0
  114. package/esm/models/operations/get-post-likes.d.ts +19 -0
  115. package/esm/models/operations/get-post-likes.d.ts.map +1 -0
  116. package/esm/models/operations/get-post-likes.js +15 -0
  117. package/esm/models/operations/get-post-likes.js.map +1 -0
  118. package/esm/models/operations/get-trending-creators.d.ts +12 -0
  119. package/esm/models/operations/get-trending-creators.d.ts.map +1 -0
  120. package/esm/models/operations/get-trending-creators.js +13 -0
  121. package/esm/models/operations/get-trending-creators.js.map +1 -0
  122. package/esm/models/operations/get-user-follower-count.d.ts +12 -0
  123. package/esm/models/operations/get-user-follower-count.d.ts.map +1 -0
  124. package/esm/models/operations/get-user-follower-count.js +13 -0
  125. package/esm/models/operations/get-user-follower-count.js.map +1 -0
  126. package/esm/models/operations/get-user-followers.d.ts +19 -0
  127. package/esm/models/operations/get-user-followers.d.ts.map +1 -0
  128. package/esm/models/operations/get-user-followers.js +15 -0
  129. package/esm/models/operations/get-user-followers.js.map +1 -0
  130. package/esm/models/operations/index.d.ts +12 -0
  131. package/esm/models/operations/index.d.ts.map +1 -1
  132. package/esm/models/operations/index.js +12 -0
  133. package/esm/models/operations/index.js.map +1 -1
  134. package/esm/models/operations/like-post.d.ts +12 -0
  135. package/esm/models/operations/like-post.d.ts.map +1 -0
  136. package/esm/models/operations/like-post.js +13 -0
  137. package/esm/models/operations/like-post.js.map +1 -0
  138. package/esm/models/operations/unlike-post.d.ts +12 -0
  139. package/esm/models/operations/unlike-post.d.ts.map +1 -0
  140. package/esm/models/operations/unlike-post.js +13 -0
  141. package/esm/models/operations/unlike-post.js.map +1 -0
  142. package/esm/models/paginated-comments-response.d.ts +15 -0
  143. package/esm/models/paginated-comments-response.d.ts.map +1 -0
  144. package/esm/models/paginated-comments-response.js +17 -0
  145. package/esm/models/paginated-comments-response.js.map +1 -0
  146. package/esm/models/paginated-followers-response.d.ts +15 -0
  147. package/esm/models/paginated-followers-response.d.ts.map +1 -0
  148. package/esm/models/paginated-followers-response.js +17 -0
  149. package/esm/models/paginated-followers-response.js.map +1 -0
  150. package/esm/models/paginated-likes-response.d.ts +15 -0
  151. package/esm/models/paginated-likes-response.d.ts.map +1 -0
  152. package/esm/models/paginated-likes-response.js +17 -0
  153. package/esm/models/paginated-likes-response.js.map +1 -0
  154. package/esm/models/paginated-notifications-response.d.ts +15 -0
  155. package/esm/models/paginated-notifications-response.d.ts.map +1 -0
  156. package/esm/models/paginated-notifications-response.js +17 -0
  157. package/esm/models/paginated-notifications-response.js.map +1 -0
  158. package/esm/models/unread-count-response.d.ts +10 -0
  159. package/esm/models/unread-count-response.d.ts.map +1 -0
  160. package/esm/models/unread-count-response.js +15 -0
  161. package/esm/models/unread-count-response.js.map +1 -0
  162. package/esm/models/user.d.ts +4 -0
  163. package/esm/models/user.d.ts.map +1 -1
  164. package/esm/models/user.js +1 -0
  165. package/esm/models/user.js.map +1 -1
  166. package/esm/sdk/creators-discovery.d.ts +13 -0
  167. package/esm/sdk/creators-discovery.d.ts.map +1 -0
  168. package/esm/sdk/creators-discovery.js +23 -0
  169. package/esm/sdk/creators-discovery.js.map +1 -0
  170. package/esm/sdk/notifications.d.ts +17 -0
  171. package/esm/sdk/notifications.d.ts.map +1 -0
  172. package/esm/sdk/notifications.js +30 -0
  173. package/esm/sdk/notifications.js.map +1 -0
  174. package/esm/sdk/posts.d.ts +24 -0
  175. package/esm/sdk/posts.d.ts.map +1 -1
  176. package/esm/sdk/posts.js +42 -0
  177. package/esm/sdk/posts.js.map +1 -1
  178. package/esm/sdk/sdk.d.ts +6 -0
  179. package/esm/sdk/sdk.d.ts.map +1 -1
  180. package/esm/sdk/sdk.js +10 -0
  181. package/esm/sdk/sdk.js.map +1 -1
  182. package/esm/sdk/user-discovery.d.ts +16 -0
  183. package/esm/sdk/user-discovery.d.ts.map +1 -1
  184. package/esm/sdk/user-discovery.js +28 -0
  185. package/esm/sdk/user-discovery.js.map +1 -1
  186. package/jsr.json +1 -1
  187. package/package.json +1 -1
  188. package/src/funcs/creators-discovery-get-featured-creators.ts +174 -0
  189. package/src/funcs/creators-discovery-get-trending-creators.ts +174 -0
  190. package/src/funcs/notifications-get-notifications.ts +179 -0
  191. package/src/funcs/notifications-get-unread-notification-count.ts +142 -0
  192. package/src/funcs/notifications-mark-notifications-as-read.ts +162 -0
  193. package/src/funcs/posts-create-comment.ts +176 -0
  194. package/src/funcs/posts-delete-comment.ts +178 -0
  195. package/src/funcs/posts-get-post-comments.ts +185 -0
  196. package/src/funcs/posts-get-post-likes.ts +185 -0
  197. package/src/funcs/posts-like-post.ts +170 -0
  198. package/src/funcs/posts-unlike-post.ts +170 -0
  199. package/src/funcs/user-discovery-get-follower-count.ts +142 -0
  200. package/src/funcs/user-discovery-get-followers.ts +176 -0
  201. package/src/funcs/user-discovery-get-user-follower-count.ts +172 -0
  202. package/src/funcs/user-discovery-get-user-followers.ts +186 -0
  203. package/src/lib/config.ts +3 -3
  204. package/src/models/comment.ts +38 -0
  205. package/src/models/create-comment-request.ts +34 -0
  206. package/src/models/follower-count-response.ts +32 -0
  207. package/src/models/index.ts +10 -0
  208. package/src/models/mark-notifications-read-request.ts +42 -0
  209. package/src/models/notification.ts +60 -0
  210. package/src/models/operations/create-comment.ts +35 -0
  211. package/src/models/operations/delete-comment.ts +34 -0
  212. package/src/models/operations/get-featured-creators.ts +31 -0
  213. package/src/models/operations/get-followers.ts +37 -0
  214. package/src/models/operations/get-notifications.ts +37 -0
  215. package/src/models/operations/get-post-comments.ts +40 -0
  216. package/src/models/operations/get-post-likes.ts +40 -0
  217. package/src/models/operations/get-trending-creators.ts +31 -0
  218. package/src/models/operations/get-user-follower-count.ts +33 -0
  219. package/src/models/operations/get-user-followers.ts +40 -0
  220. package/src/models/operations/index.ts +12 -0
  221. package/src/models/operations/like-post.ts +29 -0
  222. package/src/models/operations/unlike-post.ts +31 -0
  223. package/src/models/paginated-comments-response.ts +38 -0
  224. package/src/models/paginated-followers-response.ts +38 -0
  225. package/src/models/paginated-likes-response.ts +38 -0
  226. package/src/models/paginated-notifications-response.ts +38 -0
  227. package/src/models/unread-count-response.ts +32 -0
  228. package/src/models/user.ts +5 -0
  229. package/src/sdk/creators-discovery.ts +40 -0
  230. package/src/sdk/notifications.ts +55 -0
  231. package/src/sdk/posts.ts +102 -0
  232. package/src/sdk/sdk.ts +12 -0
  233. package/src/sdk/user-discovery.ts +64 -0
@@ -0,0 +1,185 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: a69e1a1085db
4
+ */
5
+
6
+ import * as z from "zod/v4-mini";
7
+ import { FankareSDKCore } from "../core.js";
8
+ import { encodeFormQuery, 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 the list of users who liked a post
33
+ */
34
+ export function postsGetPostLikes(
35
+ client: FankareSDKCore,
36
+ postId: number,
37
+ limit?: number | undefined,
38
+ cursor?: string | undefined,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ models.PaginatedLikesResponse,
43
+ | FankareSDKError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError
51
+ >
52
+ > {
53
+ return new APIPromise($do(
54
+ client,
55
+ postId,
56
+ limit,
57
+ cursor,
58
+ options,
59
+ ));
60
+ }
61
+
62
+ async function $do(
63
+ client: FankareSDKCore,
64
+ postId: number,
65
+ limit?: number | undefined,
66
+ cursor?: string | undefined,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ models.PaginatedLikesResponse,
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.GetPostLikesRequest = {
85
+ postId: postId,
86
+ limit: limit,
87
+ cursor: cursor,
88
+ };
89
+
90
+ const parsed = safeParse(
91
+ input,
92
+ (value) => z.parse(operations.GetPostLikesRequest$outboundSchema, value),
93
+ "Input validation failed",
94
+ );
95
+ if (!parsed.ok) {
96
+ return [parsed, { status: "invalid" }];
97
+ }
98
+ const payload = parsed.value;
99
+ const body = null;
100
+
101
+ const pathParams = {
102
+ postId: encodeSimple("postId", payload.postId, {
103
+ explode: false,
104
+ charEncoding: "percent",
105
+ }),
106
+ };
107
+ const path = pathToFunc("/posts/{postId}/likes")(pathParams);
108
+
109
+ const query = encodeFormQuery({
110
+ "cursor": payload.cursor,
111
+ "limit": payload.limit,
112
+ });
113
+
114
+ const headers = new Headers(compactMap({
115
+ Accept: "application/json",
116
+ }));
117
+
118
+ const secConfig = await extractSecurity(client._options.bearerAuth);
119
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
120
+ const requestSecurity = resolveGlobalSecurity(securityInput);
121
+
122
+ const context = {
123
+ options: client._options,
124
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
125
+ operationID: "getPostLikes",
126
+ oAuth2Scopes: null,
127
+
128
+ resolvedSecurity: requestSecurity,
129
+
130
+ securitySource: client._options.bearerAuth,
131
+ retryConfig: options?.retries
132
+ || client._options.retryConfig
133
+ || { strategy: "none" },
134
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
135
+ };
136
+
137
+ const requestRes = client._createRequest(context, {
138
+ security: requestSecurity,
139
+ method: "GET",
140
+ baseURL: options?.serverURL,
141
+ path: path,
142
+ headers: headers,
143
+ query: query,
144
+ body: body,
145
+ userAgent: client._options.userAgent,
146
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
147
+ }, options);
148
+ if (!requestRes.ok) {
149
+ return [requestRes, { status: "invalid" }];
150
+ }
151
+ const req = requestRes.value;
152
+
153
+ const doResult = await client._do(req, {
154
+ context,
155
+ isErrorStatusCode: (statusCode: number) =>
156
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
157
+ retryConfig: context.retryConfig,
158
+ retryCodes: context.retryCodes,
159
+ });
160
+ if (!doResult.ok) {
161
+ return [doResult, { status: "request-error", request: req }];
162
+ }
163
+ const response = doResult.value;
164
+
165
+ const [result] = await M.match<
166
+ models.PaginatedLikesResponse,
167
+ | FankareSDKError
168
+ | ResponseValidationError
169
+ | ConnectionError
170
+ | RequestAbortedError
171
+ | RequestTimeoutError
172
+ | InvalidRequestError
173
+ | UnexpectedClientError
174
+ | SDKValidationError
175
+ >(
176
+ M.json(200, models.PaginatedLikesResponse$inboundSchema),
177
+ M.fail([401, 404, "4XX"]),
178
+ M.fail("5XX"),
179
+ )(response, req);
180
+ if (!result.ok) {
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
183
+
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: d2f4935a88b1
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
+ * Like a post
32
+ */
33
+ export function postsLikePost(
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.LikePostRequest = {
78
+ postId: postId,
79
+ };
80
+
81
+ const parsed = safeParse(
82
+ input,
83
+ (value) => z.parse(operations.LikePostRequest$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}/like")(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: "likePost",
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: "POST",
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, 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
+ }
@@ -0,0 +1,170 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 09cad3d0c016
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
+ * Unlike a post
32
+ */
33
+ export function postsUnlikePost(
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.UnlikePostRequest = {
78
+ postId: postId,
79
+ };
80
+
81
+ const parsed = safeParse(
82
+ input,
83
+ (value) => z.parse(operations.UnlikePostRequest$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}/like")(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: "unlikePost",
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, 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
+ }
@@ -0,0 +1,142 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 7662733f99e4
4
+ */
5
+
6
+ import { FankareSDKCore } from "../core.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { FankareSDKError } from "../models/errors/fankare-sdk-error.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/http-client-errors.js";
21
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
22
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
23
+ import * as models from "../models/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
26
+
27
+ /**
28
+ * Fetch the authenticated user's follower count
29
+ */
30
+ export function userDiscoveryGetFollowerCount(
31
+ client: FankareSDKCore,
32
+ options?: RequestOptions,
33
+ ): APIPromise<
34
+ Result<
35
+ models.FollowerCountResponse,
36
+ | FankareSDKError
37
+ | ResponseValidationError
38
+ | ConnectionError
39
+ | RequestAbortedError
40
+ | RequestTimeoutError
41
+ | InvalidRequestError
42
+ | UnexpectedClientError
43
+ | SDKValidationError
44
+ >
45
+ > {
46
+ return new APIPromise($do(
47
+ client,
48
+ options,
49
+ ));
50
+ }
51
+
52
+ async function $do(
53
+ client: FankareSDKCore,
54
+ options?: RequestOptions,
55
+ ): Promise<
56
+ [
57
+ Result<
58
+ models.FollowerCountResponse,
59
+ | FankareSDKError
60
+ | ResponseValidationError
61
+ | ConnectionError
62
+ | RequestAbortedError
63
+ | RequestTimeoutError
64
+ | InvalidRequestError
65
+ | UnexpectedClientError
66
+ | SDKValidationError
67
+ >,
68
+ APICall,
69
+ ]
70
+ > {
71
+ const path = pathToFunc("/users/followers/count")();
72
+
73
+ const headers = new Headers(compactMap({
74
+ Accept: "application/json",
75
+ }));
76
+
77
+ const secConfig = await extractSecurity(client._options.bearerAuth);
78
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
79
+ const requestSecurity = resolveGlobalSecurity(securityInput);
80
+
81
+ const context = {
82
+ options: client._options,
83
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
84
+ operationID: "getFollowerCount",
85
+ oAuth2Scopes: null,
86
+
87
+ resolvedSecurity: requestSecurity,
88
+
89
+ securitySource: client._options.bearerAuth,
90
+ retryConfig: options?.retries
91
+ || client._options.retryConfig
92
+ || { strategy: "none" },
93
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
94
+ };
95
+
96
+ const requestRes = client._createRequest(context, {
97
+ security: requestSecurity,
98
+ method: "GET",
99
+ baseURL: options?.serverURL,
100
+ path: path,
101
+ headers: headers,
102
+ userAgent: client._options.userAgent,
103
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
104
+ }, options);
105
+ if (!requestRes.ok) {
106
+ return [requestRes, { status: "invalid" }];
107
+ }
108
+ const req = requestRes.value;
109
+
110
+ const doResult = await client._do(req, {
111
+ context,
112
+ isErrorStatusCode: (statusCode: number) =>
113
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
114
+ retryConfig: context.retryConfig,
115
+ retryCodes: context.retryCodes,
116
+ });
117
+ if (!doResult.ok) {
118
+ return [doResult, { status: "request-error", request: req }];
119
+ }
120
+ const response = doResult.value;
121
+
122
+ const [result] = await M.match<
123
+ models.FollowerCountResponse,
124
+ | FankareSDKError
125
+ | ResponseValidationError
126
+ | ConnectionError
127
+ | RequestAbortedError
128
+ | RequestTimeoutError
129
+ | InvalidRequestError
130
+ | UnexpectedClientError
131
+ | SDKValidationError
132
+ >(
133
+ M.json(200, models.FollowerCountResponse$inboundSchema),
134
+ M.fail([401, "4XX"]),
135
+ M.fail("5XX"),
136
+ )(response, req);
137
+ if (!result.ok) {
138
+ return [result, { status: "complete", request: req, response }];
139
+ }
140
+
141
+ return [result, { status: "complete", request: req, response }];
142
+ }