graze-client 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/build/dts/GrazeClient.d.ts +368 -242
  2. package/build/dts/GrazeClient.d.ts.map +1 -1
  3. package/build/dts/builder.d.ts +2 -2
  4. package/build/dts/builder.d.ts.map +1 -1
  5. package/build/dts/common.d.ts +2 -3
  6. package/build/dts/common.d.ts.map +1 -1
  7. package/build/dts/index.d.ts +12 -12
  8. package/build/dts/index.d.ts.map +1 -1
  9. package/build/dts/schema/Post.d.ts +52 -52
  10. package/build/dts/schema/Post.d.ts.map +1 -1
  11. package/build/dts/schema/StickyPosts.d.ts +55 -56
  12. package/build/dts/schema/StickyPosts.d.ts.map +1 -1
  13. package/build/dts/schema/UpdateAlgorithmPayload.d.ts +137 -137
  14. package/build/dts/schema/UpdateAlgorithmPayload.d.ts.map +1 -1
  15. package/build/dts/schema/index.d.ts.map +1 -1
  16. package/build/dts/schema/shared.d.ts +126 -126
  17. package/build/dts/schema/shared.d.ts.map +1 -1
  18. package/build/dts/stickyposts.d.ts +80 -78
  19. package/build/dts/stickyposts.d.ts.map +1 -1
  20. package/build/esm/GrazeClient.js +47 -31
  21. package/build/esm/GrazeClient.js.map +1 -1
  22. package/build/esm/builder.js +20 -20
  23. package/build/esm/builder.js.map +1 -1
  24. package/build/esm/common.js +4 -3
  25. package/build/esm/common.js.map +1 -1
  26. package/build/esm/index.js +11 -8
  27. package/build/esm/index.js.map +1 -1
  28. package/build/esm/schema/Post.js +9 -9
  29. package/build/esm/schema/Post.js.map +1 -1
  30. package/build/esm/schema/StickyPosts.js +8 -9
  31. package/build/esm/schema/StickyPosts.js.map +1 -1
  32. package/build/esm/schema/UpdateAlgorithmPayload.js +130 -53
  33. package/build/esm/schema/UpdateAlgorithmPayload.js.map +1 -1
  34. package/build/esm/schema/index.js.map +1 -1
  35. package/build/esm/schema/shared.js +14 -14
  36. package/build/esm/schema/shared.js.map +1 -1
  37. package/build/esm/stickyposts.js +28 -13
  38. package/build/esm/stickyposts.js.map +1 -1
  39. package/package.json +21 -23
  40. package/src/GrazeClient.ts +83 -76
  41. package/src/builder.ts +78 -74
  42. package/src/common.ts +5 -10
  43. package/src/index.ts +61 -52
  44. package/src/schema/Post.ts +16 -16
  45. package/src/schema/StickyPosts.ts +22 -26
  46. package/src/schema/UpdateAlgorithmPayload.ts +153 -145
  47. package/src/schema/index.ts +2 -2
  48. package/src/schema/shared.ts +32 -32
  49. package/src/stickyposts.ts +48 -27
@@ -1,43 +1,64 @@
1
- import { HttpApiEndpoint, HttpApiGroup } from "@effect/platform"
2
- import { Schema } from "effect"
3
- import { FeedIdParam } from "./common.js"
1
+ import { Schema, SchemaTransformation } from "effect";
2
+ import { FeedIdParam } from "./common.js";
4
3
  import {
5
4
  CreateStickyPostBody,
6
5
  GetStickyPostsBody,
7
6
  StickyPostIdParam,
8
7
  StickyPostSuccess,
9
- StickyType
10
- } from "./schema/StickyPosts.js"
8
+ StickyType,
9
+ } from "./schema/StickyPosts.js";
10
+ import * as HttpApiEndpoint from "effect/unstable/httpapi/HttpApiEndpoint";
11
+ import * as HttpApiGroup from "effect/unstable/httpapi/HttpApiGroup";
12
+
13
+ // v4 dropped `Schema.BooleanFromString`; decode the query strings "true"/"false".
14
+ const BooleanFromString = Schema.Literals(["true", "false"]).pipe(
15
+ Schema.decodeTo(
16
+ Schema.Boolean,
17
+ SchemaTransformation.transform({
18
+ decode: (s) => s === "true",
19
+ encode: (b) => (b ? "true" : "false"),
20
+ }),
21
+ ),
22
+ );
11
23
 
12
24
  export const StickyPostsApiGroup = HttpApiGroup.make("stickyposts")
13
25
  .add(
14
- HttpApiEndpoint.post("create")`/app/api/v1/feed-management/sticky-posts`
15
- .setPayload(CreateStickyPostBody)
16
- .addSuccess(StickyPostSuccess)
26
+ HttpApiEndpoint.post("create", "/app/api/v1/feed-management/sticky-posts", {
27
+ payload: CreateStickyPostBody,
28
+ success: StickyPostSuccess,
29
+ }),
17
30
  )
18
31
  .add(
19
32
  HttpApiEndpoint.get(
20
- "get"
21
- )`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}`.addSuccess(
22
- GetStickyPostsBody
23
- )
33
+ "get",
34
+ "/app/api/v1/feed-management/sticky-posts/:feedId",
35
+ {
36
+ params: { feedId: FeedIdParam },
37
+ success: GetStickyPostsBody,
38
+ },
39
+ ),
24
40
  )
25
41
  .add(
26
42
  HttpApiEndpoint.put(
27
- "update"
28
- )`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`
29
- .setUrlParams(
30
- Schema.Struct({
31
- is_active: Schema.BooleanFromString,
32
- sticky_type: StickyType
33
- })
34
- )
35
- .addSuccess(StickyPostSuccess)
43
+ "update",
44
+ "/app/api/v1/feed-management/sticky-posts/:feedId/:stickyPostId",
45
+ {
46
+ params: { feedId: FeedIdParam, stickyPostId: StickyPostIdParam },
47
+ query: Schema.Struct({
48
+ is_active: BooleanFromString,
49
+ sticky_type: StickyType,
50
+ }),
51
+ success: StickyPostSuccess,
52
+ },
53
+ ),
36
54
  )
37
55
  .add(
38
- HttpApiEndpoint.del(
39
- "delete"
40
- )`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`.addSuccess(
41
- StickyPostSuccess
42
- )
43
- )
56
+ HttpApiEndpoint.make("DELETE")(
57
+ "delete",
58
+ "/app/api/v1/feed-management/sticky-posts/:feedId/:stickyPostId",
59
+ {
60
+ params: { feedId: FeedIdParam, stickyPostId: StickyPostIdParam },
61
+ success: StickyPostSuccess,
62
+ },
63
+ ),
64
+ );