graze-client 0.6.6 → 0.7.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.
@@ -141,6 +141,156 @@ declare const GrazeClient_base: Effect.Service.Class<GrazeClient, "GrazeClient",
141
141
  };
142
142
  readonly withResponse?: WithResponse;
143
143
  }) => Effect.Effect<WithResponse extends true ? [unknown, import("@effect/platform/HttpClientResponse").HttpClientResponse] : unknown, unknown, never>;
144
+ createStickyPost: <WithResponse extends boolean = false>(request: {
145
+ readonly payload: {
146
+ readonly algo_id: number;
147
+ readonly is_active: boolean;
148
+ readonly sticky_type: "pinned" | "rotating";
149
+ readonly post_url: string;
150
+ readonly stopping_criteria: {
151
+ readonly expiration_time: number;
152
+ };
153
+ };
154
+ readonly withResponse?: WithResponse;
155
+ }) => Effect.Effect<WithResponse extends true ? [{
156
+ readonly message: string;
157
+ }, import("@effect/platform/HttpClientResponse").HttpClientResponse] : {
158
+ readonly message: string;
159
+ }, unknown, never>;
160
+ getStickyPosts: <WithResponse extends boolean = false>(request: {
161
+ readonly path: {
162
+ readonly feedId: number;
163
+ };
164
+ readonly withResponse?: WithResponse;
165
+ }) => Effect.Effect<WithResponse extends true ? [{
166
+ readonly sticky_posts: readonly {
167
+ readonly id: number;
168
+ readonly created_at: string;
169
+ readonly updated_at: string;
170
+ readonly post: {
171
+ readonly embed: any;
172
+ readonly labels: any;
173
+ readonly $type: string;
174
+ readonly viewer: any;
175
+ readonly cid: string;
176
+ readonly uri: string;
177
+ readonly author: {
178
+ readonly labels: readonly any[];
179
+ readonly did: string;
180
+ readonly $type: string;
181
+ readonly avatar: string;
182
+ readonly handle: string;
183
+ readonly viewer: any;
184
+ readonly createdAt: string;
185
+ readonly associated: any;
186
+ readonly displayName: string;
187
+ };
188
+ readonly record: {
189
+ readonly text: string;
190
+ readonly reply: any;
191
+ readonly embed: any;
192
+ readonly labels: any;
193
+ readonly $type: string;
194
+ readonly createdAt: string;
195
+ readonly tags: any;
196
+ readonly langs: readonly string[];
197
+ readonly facets: readonly any[];
198
+ readonly entities: any;
199
+ };
200
+ readonly indexedAt: string;
201
+ readonly likeCount: number;
202
+ readonly quoteCount: number;
203
+ readonly replyCount: number;
204
+ readonly threadgate: unknown;
205
+ readonly repostCount: number;
206
+ };
207
+ readonly uri: string;
208
+ readonly author: string;
209
+ readonly is_active: boolean;
210
+ readonly sticky_type: "pinned" | "rotating";
211
+ readonly stopping_criteria: {
212
+ readonly expiration_time: number;
213
+ };
214
+ readonly hidden: boolean;
215
+ }[];
216
+ }, import("@effect/platform/HttpClientResponse").HttpClientResponse] : {
217
+ readonly sticky_posts: readonly {
218
+ readonly id: number;
219
+ readonly created_at: string;
220
+ readonly updated_at: string;
221
+ readonly post: {
222
+ readonly embed: any;
223
+ readonly labels: any;
224
+ readonly $type: string;
225
+ readonly viewer: any;
226
+ readonly cid: string;
227
+ readonly uri: string;
228
+ readonly author: {
229
+ readonly labels: readonly any[];
230
+ readonly did: string;
231
+ readonly $type: string;
232
+ readonly avatar: string;
233
+ readonly handle: string;
234
+ readonly viewer: any;
235
+ readonly createdAt: string;
236
+ readonly associated: any;
237
+ readonly displayName: string;
238
+ };
239
+ readonly record: {
240
+ readonly text: string;
241
+ readonly reply: any;
242
+ readonly embed: any;
243
+ readonly labels: any;
244
+ readonly $type: string;
245
+ readonly createdAt: string;
246
+ readonly tags: any;
247
+ readonly langs: readonly string[];
248
+ readonly facets: readonly any[];
249
+ readonly entities: any;
250
+ };
251
+ readonly indexedAt: string;
252
+ readonly likeCount: number;
253
+ readonly quoteCount: number;
254
+ readonly replyCount: number;
255
+ readonly threadgate: unknown;
256
+ readonly repostCount: number;
257
+ };
258
+ readonly uri: string;
259
+ readonly author: string;
260
+ readonly is_active: boolean;
261
+ readonly sticky_type: "pinned" | "rotating";
262
+ readonly stopping_criteria: {
263
+ readonly expiration_time: number;
264
+ };
265
+ readonly hidden: boolean;
266
+ }[];
267
+ }, unknown, never>;
268
+ updateStickyPost: <WithResponse extends boolean = false>(request: {
269
+ readonly path: {
270
+ readonly feedId: number;
271
+ readonly stickyPostId: number;
272
+ };
273
+ readonly urlParams: {
274
+ readonly is_active: boolean;
275
+ readonly sticky_type: "pinned" | "rotating";
276
+ };
277
+ readonly withResponse?: WithResponse;
278
+ }) => Effect.Effect<WithResponse extends true ? [{
279
+ readonly message: string;
280
+ }, import("@effect/platform/HttpClientResponse").HttpClientResponse] : {
281
+ readonly message: string;
282
+ }, unknown, never>;
283
+ deleteStickyPost: <WithResponse extends boolean = false>(request: {
284
+ readonly path: {
285
+ readonly feedId: number;
286
+ readonly stickyPostId: number;
287
+ };
288
+ readonly withResponse?: WithResponse;
289
+ }) => Effect.Effect<WithResponse extends true ? [{
290
+ readonly message: string;
291
+ }, import("@effect/platform/HttpClientResponse").HttpClientResponse] : {
292
+ readonly message: string;
293
+ }, unknown, never>;
144
294
  }, import("effect/ConfigError").ConfigError, HttpClient.HttpClient>;
145
295
  readonly dependencies: readonly [import("effect/Layer").Layer<HttpClient.HttpClient, never, never>];
146
296
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"GrazeClient.d.ts","sourceRoot":"","sources":["../../src/GrazeClient.ts"],"names":[],"mappings":"AAOA,OAAO,EAOL,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgB,MAAM,EAAoB,MAAM,QAAQ,CAAC;AAEhE,OAAO,KAAK,IAAI,MAAM,oCAAoC,CAAC;;;gCA+E1B,IAAI,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgB9C,qBAAa,WAAY,SAAQ,gBAG/B;CAED;;;;AAED,qBAAa,UAAW,SAAQ,gBAA+B;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;CAAI"}
1
+ {"version":3,"file":"GrazeClient.d.ts","sourceRoot":"","sources":["../../src/GrazeClient.ts"],"names":[],"mappings":"AAOA,OAAO,EAOL,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgB,MAAM,EAAoB,MAAM,QAAQ,CAAC;AAEhE,OAAO,KAAK,IAAI,MAAM,oCAAoC,CAAC;;;gCAyH1B,IAAI,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgB9C,qBAAa,WAAY,SAAQ,gBAG/B;CAED;;;;AAED,qBAAa,UAAW,SAAQ,gBAA+B;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;CAAG"}
@@ -0,0 +1,68 @@
1
+ import { Schema as S } from "effect";
2
+ /**
3
+ * Schema for Bluesky objects
4
+ */
5
+ export declare const Author: S.Struct<{
6
+ did: typeof S.String;
7
+ $type: typeof S.String;
8
+ avatar: typeof S.String;
9
+ handle: typeof S.String;
10
+ labels: S.Array$<typeof S.Any>;
11
+ viewer: typeof S.Any;
12
+ createdAt: typeof S.String;
13
+ associated: S.Union<[typeof S.Null, typeof S.Any]>;
14
+ displayName: typeof S.String;
15
+ }>;
16
+ export type Author = typeof Author.Type;
17
+ export declare const Record: S.Struct<{
18
+ tags: S.Union<[typeof S.Null, typeof S.Any]>;
19
+ text: typeof S.String;
20
+ $type: typeof S.String;
21
+ embed: typeof S.Any;
22
+ langs: S.Array$<typeof S.String>;
23
+ reply: S.Union<[typeof S.Null, typeof S.Any]>;
24
+ facets: S.Array$<typeof S.Any>;
25
+ labels: S.Union<[typeof S.Null, typeof S.Any]>;
26
+ entities: S.Union<[typeof S.Null, typeof S.Any]>;
27
+ createdAt: typeof S.String;
28
+ }>;
29
+ export type Record = typeof Record.Type;
30
+ export declare const Post: S.Struct<{
31
+ cid: typeof S.String;
32
+ uri: typeof S.String;
33
+ $type: typeof S.String;
34
+ embed: typeof S.Any;
35
+ author: S.Struct<{
36
+ did: typeof S.String;
37
+ $type: typeof S.String;
38
+ avatar: typeof S.String;
39
+ handle: typeof S.String;
40
+ labels: S.Array$<typeof S.Any>;
41
+ viewer: typeof S.Any;
42
+ createdAt: typeof S.String;
43
+ associated: S.Union<[typeof S.Null, typeof S.Any]>;
44
+ displayName: typeof S.String;
45
+ }>;
46
+ labels: typeof S.Any;
47
+ record: S.Struct<{
48
+ tags: S.Union<[typeof S.Null, typeof S.Any]>;
49
+ text: typeof S.String;
50
+ $type: typeof S.String;
51
+ embed: typeof S.Any;
52
+ langs: S.Array$<typeof S.String>;
53
+ reply: S.Union<[typeof S.Null, typeof S.Any]>;
54
+ facets: S.Array$<typeof S.Any>;
55
+ labels: S.Union<[typeof S.Null, typeof S.Any]>;
56
+ entities: S.Union<[typeof S.Null, typeof S.Any]>;
57
+ createdAt: typeof S.String;
58
+ }>;
59
+ viewer: typeof S.Any;
60
+ indexedAt: typeof S.String;
61
+ likeCount: typeof S.Number;
62
+ quoteCount: typeof S.Number;
63
+ replyCount: typeof S.Number;
64
+ threadgate: S.Union<[typeof S.Null, typeof S.Unknown]>;
65
+ repostCount: typeof S.Number;
66
+ }>;
67
+ export type Post = typeof Post.Type;
68
+ //# sourceMappingURL=Post.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Post.d.ts","sourceRoot":"","sources":["../../../src/schema/Post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC;;GAEG;AAEH,eAAO,MAAM,MAAM;;;;;;;;;;EAUjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,eAAO,MAAM,MAAM;;;;;;;;;;;EAWjB,CAAC;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAC;AAExC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAef,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { Schema as S } from "effect";
2
+ import { HttpApiSchema } from "@effect/platform";
3
+ export declare const StickyPostIdParam: HttpApiSchema.Param<"stickyPostId", typeof S.NumberFromString>;
4
+ export type StickyPostIdParam = typeof StickyPostIdParam.Type;
5
+ export declare const StoppingCriteria: S.Struct<{
6
+ expiration_time: typeof S.Number;
7
+ }>;
8
+ export type StoppingCriteria = typeof StoppingCriteria.Type;
9
+ export declare const StickyType: S.Literal<["pinned", "rotating"]>;
10
+ export type StickyType = typeof StickyType.Type;
11
+ export declare const CreateStickyPostBody: S.Struct<{
12
+ is_active: typeof S.Boolean;
13
+ sticky_type: S.Literal<["pinned", "rotating"]>;
14
+ algo_id: typeof S.Number;
15
+ post_url: typeof S.String;
16
+ stopping_criteria: S.Struct<{
17
+ expiration_time: typeof S.Number;
18
+ }>;
19
+ }>;
20
+ export type CreateStickyPostBody = typeof CreateStickyPostBody.Type;
21
+ export declare const GetStickyPostsBody: S.Struct<{
22
+ sticky_posts: S.Array$<S.Struct<{
23
+ stopping_criteria: S.Struct<{
24
+ expiration_time: typeof S.Number;
25
+ }>;
26
+ hidden: typeof S.Boolean;
27
+ uri: typeof S.String;
28
+ post: S.Struct<{
29
+ cid: typeof S.String;
30
+ uri: typeof S.String;
31
+ $type: typeof S.String;
32
+ embed: typeof S.Any;
33
+ author: S.Struct<{
34
+ did: typeof S.String;
35
+ $type: typeof S.String;
36
+ avatar: typeof S.String;
37
+ handle: typeof S.String;
38
+ labels: S.Array$<typeof S.Any>;
39
+ viewer: typeof S.Any;
40
+ createdAt: typeof S.String;
41
+ associated: S.Union<[typeof S.Null, typeof S.Any]>;
42
+ displayName: typeof S.String;
43
+ }>;
44
+ labels: typeof S.Any;
45
+ record: S.Struct<{
46
+ tags: S.Union<[typeof S.Null, typeof S.Any]>;
47
+ text: typeof S.String;
48
+ $type: typeof S.String;
49
+ embed: typeof S.Any;
50
+ langs: S.Array$<typeof S.String>;
51
+ reply: S.Union<[typeof S.Null, typeof S.Any]>;
52
+ facets: S.Array$<typeof S.Any>;
53
+ labels: S.Union<[typeof S.Null, typeof S.Any]>;
54
+ entities: S.Union<[typeof S.Null, typeof S.Any]>;
55
+ createdAt: typeof S.String;
56
+ }>;
57
+ viewer: typeof S.Any;
58
+ indexedAt: typeof S.String;
59
+ likeCount: typeof S.Number;
60
+ quoteCount: typeof S.Number;
61
+ replyCount: typeof S.Number;
62
+ threadgate: S.Union<[typeof S.Null, typeof S.Unknown]>;
63
+ repostCount: typeof S.Number;
64
+ }>;
65
+ author: typeof S.String;
66
+ created_at: typeof S.String;
67
+ updated_at: typeof S.String;
68
+ is_active: typeof S.Boolean;
69
+ sticky_type: S.Literal<["pinned", "rotating"]>;
70
+ id: typeof S.Number;
71
+ }>>;
72
+ }>;
73
+ export type GetStickyPostsBody = typeof GetStickyPostsBody.Type;
74
+ export declare const StickyPostSuccess: S.Struct<{
75
+ message: typeof S.String;
76
+ }>;
77
+ export type StickyPostSuccess = typeof StickyPostSuccess.Type;
78
+ //# sourceMappingURL=StickyPosts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyPosts.d.ts","sourceRoot":"","sources":["../../../src/schema/StickyPosts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,eAAO,MAAM,iBAAiB,gEAG7B,CAAC;AACF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;EAE3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC;AAE5D,eAAO,MAAM,UAAU,mCAAkC,CAAC;AAC1D,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;AAOhD,eAAO,MAAM,oBAAoB;;;;;;;;EAK/B,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAC;AAEpE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAc7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAC;AAEhE,eAAO,MAAM,iBAAiB;;EAE5B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC"}
@@ -2,6 +2,7 @@ import { AlgoUpdateResponse, GetAlgoResponse, GetAlgorithmsResponse, HidePostBod
2
2
  import { FetchHttpClient, HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema, HttpClient, HttpClientRequest, } from "@effect/platform";
3
3
  import { Config, Data, Effect, Redacted, Schema } from "effect";
4
4
  import * as Form from "./schema/UpdateAlgorithmPayload.js";
5
+ import { CreateStickyPostBody, GetStickyPostsBody, StickyPostIdParam, StickyPostSuccess, StickyType, } from "src/schema/StickyPosts.js";
5
6
  function isStringOrBlob(val) {
6
7
  return typeof val === "string" || val instanceof Blob;
7
8
  }
@@ -36,8 +37,21 @@ const GrazeApiGroup = HttpApiGroup.make("graze", { topLevel: true })
36
37
  .addSuccess(Schema.Unknown))
37
38
  .add(HttpApiEndpoint.post("unhidePost") `/app/unhide_post`
38
39
  .setPayload(UnhidePostBody)
39
- .addSuccess(Schema.Unknown));
40
- class GrazeApiDef extends HttpApi.make("grazeApi").add(GrazeApiGroup).addError(Schema.Unknown) {
40
+ .addSuccess(Schema.Unknown))
41
+ .add(HttpApiEndpoint.post("createStickyPost") `/app/api/v1/feed-management/sticky-posts`
42
+ .setPayload(CreateStickyPostBody)
43
+ .addSuccess(StickyPostSuccess))
44
+ .add(HttpApiEndpoint.get("getStickyPosts") `/app/api/v1/feed-management/sticky-posts/${FeedIdParam}`.addSuccess(GetStickyPostsBody))
45
+ .add(HttpApiEndpoint.put("updateStickyPost") `/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`
46
+ .setUrlParams(Schema.Struct({
47
+ is_active: Schema.BooleanFromString,
48
+ sticky_type: StickyType,
49
+ }))
50
+ .addSuccess(StickyPostSuccess))
51
+ .add(HttpApiEndpoint.del("deleteStickyPost") `/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`.addSuccess(StickyPostSuccess));
52
+ class GrazeApiDef extends HttpApi.make("grazeApi")
53
+ .add(GrazeApiGroup)
54
+ .addError(Schema.Unknown) {
41
55
  }
42
56
  const grazeLive = Effect.gen(function* () {
43
57
  const baseUrl = yield* Config.url("GRAZE_API_URL");
@@ -1 +1 @@
1
- {"version":3,"file":"GrazeClient.js","sourceRoot":"","sources":["../../src/GrazeClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,OAAO,EACP,aAAa,EACb,eAAe,EACf,YAAY,EACZ,aAAa,EAC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,UAAU,CAAC,cAAc,EACzB,UAAU,CAAC,UAAU,CACnB,iBAAiB,CAAC,UAAU,CAAC;YAC3B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;SAC/B,CAAC,CACH,CACF;KACJ,CAAC,CAAC;IAEH,MAAM,eAAe,GAAG,CAAC,IAAmB,EAAE,EAAE,CAC9C,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEL,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAEzE,OAAO;QACL,GAAG,MAAM;QACT,eAAe;QACf,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,OAAO,WAAY,SAAQ,MAAM,CAAC,OAAO,EAAe,CAAC,aAAa,EAAE;IAC5E,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;CACtC,CAAC;CAED;AAED,MAAM,OAAO,UAAW,SAAQ,IAAI,CAAC,WAAW,CAAC,YAAY,CAK3D;CAAG"}
@@ -0,0 +1,44 @@
1
+ import { Schema as S } from "effect";
2
+ /**
3
+ * Schema for Bluesky objects
4
+ */
5
+ export const Author = S.Struct({
6
+ did: S.String,
7
+ $type: S.String,
8
+ avatar: S.String,
9
+ handle: S.String,
10
+ labels: S.Array(S.Any),
11
+ viewer: S.Any,
12
+ createdAt: S.String,
13
+ associated: S.Union(S.Null, S.Any),
14
+ displayName: S.String,
15
+ });
16
+ export const Record = S.Struct({
17
+ tags: S.Union(S.Null, S.Any),
18
+ text: S.String,
19
+ $type: S.String,
20
+ embed: S.Any,
21
+ langs: S.Array(S.String),
22
+ reply: S.Union(S.Null, S.Any),
23
+ facets: S.Array(S.Any),
24
+ labels: S.Union(S.Null, S.Any),
25
+ entities: S.Union(S.Null, S.Any),
26
+ createdAt: S.String,
27
+ });
28
+ export const Post = S.Struct({
29
+ cid: S.String,
30
+ uri: S.String,
31
+ $type: S.String,
32
+ embed: S.Any,
33
+ author: Author,
34
+ labels: S.Any,
35
+ record: Record,
36
+ viewer: S.Any,
37
+ indexedAt: S.String,
38
+ likeCount: S.Number,
39
+ quoteCount: S.Number,
40
+ replyCount: S.Number,
41
+ threadgate: S.Union(S.Null, S.Unknown),
42
+ repostCount: S.Number,
43
+ });
44
+ //# sourceMappingURL=Post.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Post.js","sourceRoot":"","sources":["../../../src/schema/Post.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC;;GAEG;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM;IACb,KAAK,EAAE,CAAC,CAAC,MAAM;IACf,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACtB,MAAM,EAAE,CAAC,CAAC,GAAG;IACb,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC;IAClC,WAAW,EAAE,CAAC,CAAC,MAAM;CACtB,CAAC,CAAC;AAGH,MAAM,CAAC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AAC,CAAC,OAAO,CAAC;IACtC,WAAW,EAAE,CAAC,CAAC,MAAM;CACtB,CAAC,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { Schema as S } from "effect";
2
+ import { Post } from "./Post.js";
3
+ import { HttpApiSchema } from "@effect/platform";
4
+ export const StickyPostIdParam = HttpApiSchema.param("stickyPostId", S.NumberFromString);
5
+ export const StoppingCriteria = S.Struct({
6
+ expiration_time: S.Number,
7
+ });
8
+ export const StickyType = S.Literal("pinned", "rotating");
9
+ const StickyPostBase = S.Struct({
10
+ is_active: S.Boolean,
11
+ sticky_type: StickyType,
12
+ });
13
+ export const CreateStickyPostBody = S.Struct({
14
+ algo_id: S.Number,
15
+ post_url: S.String,
16
+ stopping_criteria: StoppingCriteria,
17
+ ...StickyPostBase.fields,
18
+ });
19
+ export const GetStickyPostsBody = S.Struct({
20
+ sticky_posts: S.Array(S.Struct({
21
+ id: S.Number,
22
+ ...StickyPostBase.fields,
23
+ stopping_criteria: StoppingCriteria,
24
+ hidden: S.Boolean,
25
+ uri: S.String,
26
+ post: Post,
27
+ author: S.String,
28
+ created_at: S.String,
29
+ updated_at: S.String,
30
+ })),
31
+ });
32
+ export const StickyPostSuccess = S.Struct({
33
+ message: S.String,
34
+ });
35
+ //# sourceMappingURL=StickyPosts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StickyPosts.js","sourceRoot":"","sources":["../../../src/schema/StickyPosts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAClD,cAAc,EACd,CAAC,CAAC,gBAAgB,CACnB,CAAC;AAGF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,eAAe,EAAE,CAAC,CAAC,MAAM;CAC1B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAG1D,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,SAAS,EAAE,CAAC,CAAC,OAAO;IACpB,WAAW,EAAE,UAAU;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,QAAQ,EAAE,CAAC,CAAC,MAAM;IAClB,iBAAiB,EAAE,gBAAgB;IACnC,GAAG,cAAc,CAAC,MAAM;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,YAAY,EAAE,CAAC,CAAC,KAAK,CACnB,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM;QACZ,GAAG,cAAc,CAAC,MAAM;QACxB,iBAAiB,EAAE,gBAAgB;QACnC,MAAM,EAAE,CAAC,CAAC,OAAO;QACjB,GAAG,EAAE,CAAC,CAAC,MAAM;QACb,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,UAAU,EAAE,CAAC,CAAC,MAAM;QACpB,UAAU,EAAE,CAAC,CAAC,MAAM;KACrB,CAAC,CACH;CACF,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,OAAO,EAAE,CAAC,CAAC,MAAM;CAClB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graze-client",
3
- "version": "0.6.6",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A Typescript Graze API client.",
@@ -18,13 +18,20 @@ import {
18
18
  import { Config, Data, Effect, Redacted, Schema } from "effect";
19
19
 
20
20
  import * as Form from "./schema/UpdateAlgorithmPayload.js";
21
+ import {
22
+ CreateStickyPostBody,
23
+ GetStickyPostsBody,
24
+ StickyPostIdParam,
25
+ StickyPostSuccess,
26
+ StickyType,
27
+ } from "src/schema/StickyPosts.js";
21
28
 
22
29
  function isStringOrBlob(val: unknown): val is string | Blob {
23
30
  return typeof val === "string" || val instanceof Blob;
24
31
  }
25
32
 
26
33
  const encodeForm = (obj: Form.FullForm) =>
27
- Effect.gen(function*() {
34
+ Effect.gen(function* () {
28
35
  const encoded = yield* Schema.encode(Form.FullForm)(obj);
29
36
  const formData = new FormData();
30
37
  for (const key in encoded) {
@@ -75,11 +82,46 @@ const GrazeApiGroup = HttpApiGroup.make("graze", { topLevel: true })
75
82
  HttpApiEndpoint.post("unhidePost")`/app/unhide_post`
76
83
  .setPayload(UnhidePostBody)
77
84
  .addSuccess(Schema.Unknown)
85
+ )
86
+ .add(
87
+ HttpApiEndpoint.post(
88
+ "createStickyPost"
89
+ )`/app/api/v1/feed-management/sticky-posts`
90
+ .setPayload(CreateStickyPostBody)
91
+ .addSuccess(StickyPostSuccess)
92
+ )
93
+ .add(
94
+ HttpApiEndpoint.get(
95
+ "getStickyPosts"
96
+ )`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}`.addSuccess(
97
+ GetStickyPostsBody
98
+ )
99
+ )
100
+ .add(
101
+ HttpApiEndpoint.put(
102
+ "updateStickyPost"
103
+ )`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`
104
+ .setUrlParams(
105
+ Schema.Struct({
106
+ is_active: Schema.BooleanFromString,
107
+ sticky_type: StickyType,
108
+ })
109
+ )
110
+ .addSuccess(StickyPostSuccess)
111
+ )
112
+ .add(
113
+ HttpApiEndpoint.del(
114
+ "deleteStickyPost"
115
+ )`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`.addSuccess(
116
+ StickyPostSuccess
117
+ )
78
118
  );
79
119
 
80
- class GrazeApiDef extends HttpApi.make("grazeApi").add(GrazeApiGroup).addError(Schema.Unknown) { }
120
+ class GrazeApiDef extends HttpApi.make("grazeApi")
121
+ .add(GrazeApiGroup)
122
+ .addError(Schema.Unknown) {}
81
123
 
82
- const grazeLive = Effect.gen(function*() {
124
+ const grazeLive = Effect.gen(function* () {
83
125
  const baseUrl = yield* Config.url("GRAZE_API_URL");
84
126
  const cookie = yield* Config.redacted("GRAZE_COOKIE");
85
127
 
@@ -97,7 +139,7 @@ const grazeLive = Effect.gen(function*() {
97
139
  });
98
140
 
99
141
  const updateAlgorithm = (data: Form.FullForm) =>
100
- Effect.gen(function*() {
142
+ Effect.gen(function* () {
101
143
  const formData = yield* encodeForm(data);
102
144
  return yield* client.updateAlgorithm({ payload: formData });
103
145
  });
@@ -124,4 +166,4 @@ export class GrazeError extends Data.TaggedError("GrazeError")<{
124
166
  status: number;
125
167
  statusText: string;
126
168
  json: unknown;
127
- }> { }
169
+ }> {}
@@ -0,0 +1,50 @@
1
+ import { Schema as S } from "effect";
2
+
3
+ /**
4
+ * Schema for Bluesky objects
5
+ */
6
+
7
+ export const Author = S.Struct({
8
+ did: S.String,
9
+ $type: S.String,
10
+ avatar: S.String,
11
+ handle: S.String,
12
+ labels: S.Array(S.Any),
13
+ viewer: S.Any,
14
+ createdAt: S.String,
15
+ associated: S.Union(S.Null, S.Any),
16
+ displayName: S.String,
17
+ });
18
+ export type Author = typeof Author.Type;
19
+
20
+ export const Record = S.Struct({
21
+ tags: S.Union(S.Null, S.Any),
22
+ text: S.String,
23
+ $type: S.String,
24
+ embed: S.Any,
25
+ langs: S.Array(S.String),
26
+ reply: S.Union(S.Null, S.Any),
27
+ facets: S.Array(S.Any),
28
+ labels: S.Union(S.Null, S.Any),
29
+ entities: S.Union(S.Null, S.Any),
30
+ createdAt: S.String,
31
+ });
32
+ export type Record = typeof Record.Type;
33
+
34
+ export const Post = S.Struct({
35
+ cid: S.String,
36
+ uri: S.String,
37
+ $type: S.String,
38
+ embed: S.Any,
39
+ author: Author,
40
+ labels: S.Any,
41
+ record: Record,
42
+ viewer: S.Any,
43
+ indexedAt: S.String,
44
+ likeCount: S.Number,
45
+ quoteCount: S.Number,
46
+ replyCount: S.Number,
47
+ threadgate: S.Union(S.Null, S.Unknown),
48
+ repostCount: S.Number,
49
+ });
50
+ export type Post = typeof Post.Type;
@@ -0,0 +1,52 @@
1
+ import { Schema as S } from "effect";
2
+ import { Post } from "./Post.js";
3
+ import { HttpApiSchema } from "@effect/platform";
4
+
5
+ export const StickyPostIdParam = HttpApiSchema.param(
6
+ "stickyPostId",
7
+ S.NumberFromString
8
+ );
9
+ export type StickyPostIdParam = typeof StickyPostIdParam.Type;
10
+
11
+ export const StoppingCriteria = S.Struct({
12
+ expiration_time: S.Number,
13
+ });
14
+ export type StoppingCriteria = typeof StoppingCriteria.Type;
15
+
16
+ export const StickyType = S.Literal("pinned", "rotating");
17
+ export type StickyType = typeof StickyType.Type;
18
+
19
+ const StickyPostBase = S.Struct({
20
+ is_active: S.Boolean,
21
+ sticky_type: StickyType,
22
+ });
23
+
24
+ export const CreateStickyPostBody = S.Struct({
25
+ algo_id: S.Number,
26
+ post_url: S.String,
27
+ stopping_criteria: StoppingCriteria,
28
+ ...StickyPostBase.fields,
29
+ });
30
+ export type CreateStickyPostBody = typeof CreateStickyPostBody.Type;
31
+
32
+ export const GetStickyPostsBody = S.Struct({
33
+ sticky_posts: S.Array(
34
+ S.Struct({
35
+ id: S.Number,
36
+ ...StickyPostBase.fields,
37
+ stopping_criteria: StoppingCriteria,
38
+ hidden: S.Boolean,
39
+ uri: S.String,
40
+ post: Post,
41
+ author: S.String,
42
+ created_at: S.String,
43
+ updated_at: S.String,
44
+ })
45
+ ),
46
+ });
47
+ export type GetStickyPostsBody = typeof GetStickyPostsBody.Type;
48
+
49
+ export const StickyPostSuccess = S.Struct({
50
+ message: S.String,
51
+ });
52
+ export type StickyPostSuccess = typeof StickyPostSuccess.Type;