graze-client 0.7.5 → 0.8.1
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/build/dts/GrazeClient.d.ts.map +1 -1
- package/build/dts/builder.d.ts +8 -8
- package/build/dts/builder.d.ts.map +1 -1
- package/build/dts/common.d.ts.map +1 -1
- package/build/dts/index.d.ts +9 -3
- package/build/dts/index.d.ts.map +1 -1
- package/build/dts/schema/Post.d.ts.map +1 -1
- package/build/dts/schema/StickyPosts.d.ts +1 -1
- package/build/dts/schema/StickyPosts.d.ts.map +1 -1
- package/build/dts/schema/UpdateAlgorithmPayload.d.ts +90 -66
- package/build/dts/schema/UpdateAlgorithmPayload.d.ts.map +1 -1
- package/build/dts/schema/index.d.ts.map +1 -1
- package/build/dts/schema/shared.d.ts +28 -28
- package/build/dts/schema/shared.d.ts.map +1 -1
- package/build/dts/stickyposts.d.ts +1 -1
- package/build/dts/stickyposts.d.ts.map +1 -1
- package/build/esm/GrazeClient.js +9 -9
- package/build/esm/GrazeClient.js.map +1 -1
- package/build/esm/builder.js +20 -20
- package/build/esm/builder.js.map +1 -1
- package/build/esm/common.js.map +1 -1
- package/build/esm/index.js +18 -3
- package/build/esm/index.js.map +1 -1
- package/build/esm/schema/Post.js +3 -3
- package/build/esm/schema/Post.js.map +1 -1
- package/build/esm/schema/StickyPosts.js +7 -7
- package/build/esm/schema/StickyPosts.js.map +1 -1
- package/build/esm/schema/UpdateAlgorithmPayload.js +26 -26
- package/build/esm/schema/UpdateAlgorithmPayload.js.map +1 -1
- package/build/esm/schema/index.js.map +1 -1
- package/build/esm/schema/shared.js +9 -9
- package/build/esm/schema/shared.js.map +1 -1
- package/build/esm/stickyposts.js +3 -3
- package/build/esm/stickyposts.js.map +1 -1
- package/package.json +14 -14
- package/src/GrazeClient.ts +46 -45
- package/src/builder.ts +76 -80
- package/src/common.ts +4 -4
- package/src/index.ts +66 -43
- package/src/schema/Post.ts +10 -10
- package/src/schema/StickyPosts.ts +22 -22
- package/src/schema/UpdateAlgorithmPayload.ts +107 -102
- package/src/schema/index.ts +2 -2
- package/src/schema/shared.ts +28 -28
- package/src/stickyposts.ts +7 -7
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
import { Schema as S } from "effect"
|
|
1
|
+
import { Schema as S } from "effect"
|
|
2
2
|
|
|
3
3
|
// ------------------- Primitives ---------------------------------
|
|
4
4
|
|
|
5
|
-
export const ListUri = S.String
|
|
6
|
-
export type ListUri = typeof ListUri.Type
|
|
5
|
+
export const ListUri = S.String
|
|
6
|
+
export type ListUri = typeof ListUri.Type
|
|
7
7
|
|
|
8
8
|
export const AttributeName = S.Union(
|
|
9
9
|
S.Literal("text"),
|
|
10
10
|
S.Literal("reply"),
|
|
11
11
|
S.Literal("embed.images[*].alt"),
|
|
12
|
+
S.Literal("embed.media.images[*].alt"),
|
|
12
13
|
S.Literal("embed.alt"),
|
|
13
14
|
S.Literal("embed"),
|
|
14
15
|
S.Literal("embed.external.uri"),
|
|
15
16
|
S.Literal("embed.external.title"),
|
|
16
17
|
S.Literal("embed.external.description"),
|
|
17
|
-
S.Literal("embed.images[*].alt"),
|
|
18
18
|
S.Literal("embed.media.external.uri"),
|
|
19
19
|
S.Literal("embed.media.external.title"),
|
|
20
20
|
S.Literal("embed.media.external.description"),
|
|
21
21
|
S.Literal("embed.record.uri"),
|
|
22
|
-
S.Literal("langs[*"),
|
|
22
|
+
S.Literal("langs[*]"),
|
|
23
23
|
S.Literal("labels.values[*].val"),
|
|
24
|
-
S.Literal("facets[*].features[*].uri")
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export type
|
|
24
|
+
S.Literal("facets[*].features[*].uri"),
|
|
25
|
+
S.Literal("hydrated_metadata.user.did"),
|
|
26
|
+
S.Literal("hydrated_metadata.user.handle"),
|
|
27
|
+
S.Literal("hydrated_metadata.user.description"),
|
|
28
|
+
S.Literal("hydrated_metadata.user.display_name"),
|
|
29
|
+
S.Literal("hydrated_metadata.user.labels"),
|
|
30
|
+
S.Literal("hydrated_metadata.mentions.display_name")
|
|
31
|
+
)
|
|
32
|
+
export type AttributeName = typeof AttributeName.Type
|
|
33
|
+
export const AttributeComparison = S.Literal("==", "!=", ">", "<", ">=", "<=")
|
|
34
|
+
export type AttributeComparison = typeof AttributeComparison.Type
|
|
35
|
+
export const AttributeValue = S.Null
|
|
36
|
+
export type AttributeValue = typeof AttributeValue.Type
|
|
37
|
+
export const PostType = S.Literal("reply", "quote")
|
|
38
|
+
export type PostType = typeof PostType.Type
|
|
33
39
|
|
|
34
40
|
// ------------------- Filters ------------------------------------
|
|
35
41
|
|
|
@@ -46,50 +52,50 @@ export type Filter =
|
|
|
46
52
|
| EntityExcludesLabels
|
|
47
53
|
| EmbedType
|
|
48
54
|
| SocialGraph
|
|
49
|
-
| PostTypeFilter
|
|
55
|
+
| PostTypeFilter
|
|
50
56
|
|
|
51
|
-
export type And = Readonly<{ and: ReadonlyArray<Filter> }
|
|
52
|
-
export type Or = Readonly<{ or: ReadonlyArray<Filter> }
|
|
57
|
+
export type And = Readonly<{ and: ReadonlyArray<Filter> }>
|
|
58
|
+
export type Or = Readonly<{ or: ReadonlyArray<Filter> }>
|
|
53
59
|
export type PostTypeFilter = Readonly<{
|
|
54
|
-
post_type: readonly ["in" | "not_in", ReadonlyArray<PostType>]
|
|
55
|
-
}
|
|
60
|
+
post_type: readonly ["in" | "not_in", ReadonlyArray<PostType>]
|
|
61
|
+
}>
|
|
56
62
|
export type ListMemberFilter = Readonly<{
|
|
57
|
-
list_member: readonly [ListUri, "in" | "not_in"]
|
|
58
|
-
}
|
|
63
|
+
list_member: readonly [ListUri, "in" | "not_in"]
|
|
64
|
+
}>
|
|
59
65
|
export type AttributeCompare = Readonly<{
|
|
60
66
|
attribute_compare: readonly [
|
|
61
67
|
AttributeName,
|
|
62
68
|
AttributeComparison,
|
|
63
69
|
AttributeValue
|
|
64
|
-
]
|
|
65
|
-
}
|
|
70
|
+
]
|
|
71
|
+
}>
|
|
66
72
|
export type RegexMatches = Readonly<{
|
|
67
|
-
regex_matches: readonly [AttributeName, string, boolean]
|
|
68
|
-
}
|
|
73
|
+
regex_matches: readonly [AttributeName, string, boolean]
|
|
74
|
+
}>
|
|
69
75
|
export type RegexNegationMatches = Readonly<{
|
|
70
|
-
regex_negation_matches: readonly [AttributeName, string, boolean]
|
|
71
|
-
}
|
|
76
|
+
regex_negation_matches: readonly [AttributeName, string, boolean]
|
|
77
|
+
}>
|
|
72
78
|
export type TextMatchesAny = Readonly<{
|
|
73
|
-
regex_any: readonly [AttributeName,
|
|
74
|
-
}
|
|
79
|
+
regex_any: readonly [AttributeName, ReadonlyArray<string>, boolean, boolean]
|
|
80
|
+
}>
|
|
75
81
|
export type TextMatchesNone = Readonly<{
|
|
76
|
-
regex_none: readonly [AttributeName,
|
|
77
|
-
}
|
|
82
|
+
regex_none: readonly [AttributeName, ReadonlyArray<string>, boolean, boolean]
|
|
83
|
+
}>
|
|
78
84
|
export type ContentModerationBlock = Readonly<{
|
|
79
|
-
content_moderation: readonly ["OK", ">=", number]
|
|
80
|
-
}
|
|
85
|
+
content_moderation: readonly ["OK", ">=", number]
|
|
86
|
+
}>
|
|
81
87
|
export type EntityExcludesLabels = Readonly<{
|
|
82
|
-
entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]]
|
|
83
|
-
}
|
|
88
|
+
entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]]
|
|
89
|
+
}>
|
|
84
90
|
export type EmbedType = Readonly<{
|
|
85
91
|
embed_type: readonly [
|
|
86
92
|
"==" | "!=",
|
|
87
93
|
"video" | "image" | "link" | "post" | "gif" | "image_group"
|
|
88
|
-
]
|
|
89
|
-
}
|
|
94
|
+
]
|
|
95
|
+
}>
|
|
90
96
|
export type SocialGraph = Readonly<{
|
|
91
|
-
social_graph: readonly [string, "in" | "not_in", "follows" | "followers"]
|
|
92
|
-
}
|
|
97
|
+
social_graph: readonly [string, "in" | "not_in", "follows" | "followers"]
|
|
98
|
+
}>
|
|
93
99
|
|
|
94
100
|
export const Filter = S.Union(
|
|
95
101
|
S.suspend((): S.Schema<And> => And),
|
|
@@ -105,91 +111,90 @@ export const Filter = S.Union(
|
|
|
105
111
|
S.suspend((): S.Schema<EmbedType> => EmbedType),
|
|
106
112
|
S.suspend((): S.Schema<SocialGraph> => SocialGraph),
|
|
107
113
|
S.suspend((): S.Schema<PostTypeFilter> => PostTypeFilter)
|
|
108
|
-
)
|
|
114
|
+
)
|
|
109
115
|
|
|
110
|
-
export const Or = S.Struct({ or: S.Array(Filter) })
|
|
111
|
-
export const And = S.Struct({ and: S.Array(Filter) })
|
|
116
|
+
export const Or = S.Struct({ or: S.Array(Filter) })
|
|
117
|
+
export const And = S.Struct({ and: S.Array(Filter) })
|
|
112
118
|
export const PostTypeFilter = S.Struct({
|
|
113
|
-
post_type: S.Tuple(S.Literal("in", "not_in"), S.Array(PostType))
|
|
114
|
-
})
|
|
119
|
+
post_type: S.Tuple(S.Literal("in", "not_in"), S.Array(PostType))
|
|
120
|
+
})
|
|
115
121
|
export const ListMemberFilter = S.Struct({
|
|
116
|
-
list_member: S.Tuple(ListUri, S.Literal("in", "not_in"))
|
|
117
|
-
})
|
|
122
|
+
list_member: S.Tuple(ListUri, S.Literal("in", "not_in"))
|
|
123
|
+
})
|
|
118
124
|
export const AttributeCompare = S.Struct({
|
|
119
125
|
attribute_compare: S.Tuple(
|
|
120
126
|
AttributeName,
|
|
121
127
|
AttributeComparison,
|
|
122
128
|
AttributeValue
|
|
123
|
-
)
|
|
124
|
-
})
|
|
129
|
+
)
|
|
130
|
+
})
|
|
125
131
|
const RegexMatchBase = S.Tuple(
|
|
126
132
|
AttributeName,
|
|
127
133
|
S.String.annotations({
|
|
128
134
|
title: "Regex Pattern",
|
|
129
|
-
description: "The source of the regex pattern to match against."
|
|
135
|
+
description: "The source of the regex pattern to match against."
|
|
130
136
|
}),
|
|
131
137
|
S.Boolean.annotations({
|
|
132
138
|
title: "Case Insensitive?",
|
|
133
|
-
description: "True if the regex should be case insensitive."
|
|
139
|
+
description: "True if the regex should be case insensitive."
|
|
134
140
|
})
|
|
135
|
-
)
|
|
141
|
+
)
|
|
136
142
|
export const RegexMatches = S.Struct({
|
|
137
|
-
regex_matches: RegexMatchBase
|
|
138
|
-
})
|
|
143
|
+
regex_matches: RegexMatchBase
|
|
144
|
+
})
|
|
139
145
|
export const RegexNegationMatches = S.Struct({
|
|
140
|
-
regex_negation_matches: RegexMatchBase
|
|
141
|
-
})
|
|
146
|
+
regex_negation_matches: RegexMatchBase
|
|
147
|
+
})
|
|
142
148
|
const TextMatchBase = S.Tuple(
|
|
143
149
|
AttributeName,
|
|
144
150
|
S.Array(S.String).annotations({
|
|
145
151
|
title: "Text Patterns",
|
|
146
|
-
description: "List of possible text patterns to match against."
|
|
152
|
+
description: "List of possible text patterns to match against."
|
|
147
153
|
}),
|
|
148
154
|
S.Boolean.annotations({
|
|
149
155
|
title: "Case Insensitive?",
|
|
150
|
-
description: "True if the matching should be case insensitive."
|
|
156
|
+
description: "True if the matching should be case insensitive."
|
|
151
157
|
}),
|
|
152
158
|
S.Boolean.annotations({
|
|
153
159
|
title: "Use Regex?",
|
|
154
|
-
description:
|
|
155
|
-
"True if the values should be treated as regex patterns, false for literal strings.",
|
|
160
|
+
description: "True if the values should be treated as regex patterns, false for literal strings."
|
|
156
161
|
})
|
|
157
|
-
)
|
|
162
|
+
)
|
|
158
163
|
export const TextMatchesAny = S.Struct({
|
|
159
|
-
regex_any: TextMatchBase
|
|
160
|
-
})
|
|
164
|
+
regex_any: TextMatchBase
|
|
165
|
+
})
|
|
161
166
|
export const TextMatchesNone = S.Struct({
|
|
162
|
-
regex_none: TextMatchBase
|
|
163
|
-
})
|
|
167
|
+
regex_none: TextMatchBase
|
|
168
|
+
})
|
|
164
169
|
export const ContentModerationBlock = S.Struct({
|
|
165
170
|
content_moderation: S.Tuple(
|
|
166
171
|
S.Literal("OK"),
|
|
167
172
|
S.Literal(">="),
|
|
168
173
|
S.Number.annotations({
|
|
169
174
|
title: "Threshold",
|
|
170
|
-
description: "The threshold for content moderation."
|
|
175
|
+
description: "The threshold for content moderation."
|
|
171
176
|
})
|
|
172
|
-
)
|
|
173
|
-
})
|
|
177
|
+
)
|
|
178
|
+
})
|
|
174
179
|
export const EntityExcludesLabels = S.Struct({
|
|
175
180
|
entity_excludes: S.Tuple(
|
|
176
181
|
S.Literal("labels"),
|
|
177
182
|
S.Tuple(S.Literal("porn"), S.Literal("sexual"), S.Literal("nudity"))
|
|
178
|
-
)
|
|
179
|
-
})
|
|
183
|
+
)
|
|
184
|
+
})
|
|
180
185
|
export const EmbedType = S.Struct({
|
|
181
186
|
embed_type: S.Tuple(
|
|
182
187
|
S.Literal("==", "!="),
|
|
183
188
|
S.Literal("video", "image", "link", "post", "gif", "image_group")
|
|
184
|
-
)
|
|
185
|
-
})
|
|
189
|
+
)
|
|
190
|
+
})
|
|
186
191
|
export const SocialGraph = S.Struct({
|
|
187
192
|
social_graph: S.Tuple(
|
|
188
193
|
S.String,
|
|
189
194
|
S.Literal("in", "not_in"),
|
|
190
195
|
S.Literal("follows", "followers")
|
|
191
|
-
)
|
|
192
|
-
})
|
|
196
|
+
)
|
|
197
|
+
})
|
|
193
198
|
|
|
194
199
|
// ---------------------- Sort Settings -----------------------------
|
|
195
200
|
|
|
@@ -201,26 +206,26 @@ export const SortSettings = S.Struct({
|
|
|
201
206
|
repost_count_multiplier: S.Number,
|
|
202
207
|
reader_like_count_multiplier: S.Number,
|
|
203
208
|
reader_reply_count_multiplier: S.Number,
|
|
204
|
-
reader_repost_count_multiplier: S.Number
|
|
205
|
-
})
|
|
206
|
-
export type SortSettings = typeof SortSettings.Type
|
|
209
|
+
reader_repost_count_multiplier: S.Number
|
|
210
|
+
})
|
|
211
|
+
export type SortSettings = typeof SortSettings.Type
|
|
207
212
|
|
|
208
213
|
// ---------------------- Form Data ---------------------------------
|
|
209
214
|
|
|
210
215
|
export const DisplayName = S.String.annotations({
|
|
211
|
-
description: "The public name of the feed."
|
|
212
|
-
})
|
|
213
|
-
export type DisplayName = typeof DisplayName.Type
|
|
216
|
+
description: "The public name of the feed."
|
|
217
|
+
})
|
|
218
|
+
export type DisplayName = typeof DisplayName.Type
|
|
214
219
|
|
|
215
220
|
export const RecordName = S.String.annotations({
|
|
216
|
-
description: "The slug of the feed url."
|
|
217
|
-
})
|
|
218
|
-
export type RecordName = typeof RecordName.Type
|
|
221
|
+
description: "The slug of the feed url."
|
|
222
|
+
})
|
|
223
|
+
export type RecordName = typeof RecordName.Type
|
|
219
224
|
|
|
220
225
|
export const Description = S.String.annotations({
|
|
221
|
-
description: "The description to be shown to users of the feed."
|
|
222
|
-
})
|
|
223
|
-
export type Description = typeof Description.Type
|
|
226
|
+
description: "The description to be shown to users of the feed."
|
|
227
|
+
})
|
|
228
|
+
export type Description = typeof Description.Type
|
|
224
229
|
|
|
225
230
|
export const Order = S.Union(
|
|
226
231
|
S.Literal("new"),
|
|
@@ -228,32 +233,32 @@ export const Order = S.Union(
|
|
|
228
233
|
S.Literal("blend"),
|
|
229
234
|
S.Literal("hackernews"),
|
|
230
235
|
S.Literal("old")
|
|
231
|
-
)
|
|
232
|
-
export type Order = typeof Order.Type
|
|
236
|
+
)
|
|
237
|
+
export type Order = typeof Order.Type
|
|
233
238
|
|
|
234
|
-
export const FeedId = S.NumberFromString
|
|
235
|
-
export type FeedId = typeof FeedId.Type
|
|
239
|
+
export const FeedId = S.NumberFromString
|
|
240
|
+
export type FeedId = typeof FeedId.Type
|
|
236
241
|
|
|
237
|
-
export const UserId = S.NumberFromString
|
|
238
|
-
export type UserId = typeof UserId.Type
|
|
242
|
+
export const UserId = S.NumberFromString
|
|
243
|
+
export type UserId = typeof UserId.Type
|
|
239
244
|
|
|
240
245
|
export const AlgorithmManifest = S.Struct({
|
|
241
246
|
filter: Filter,
|
|
242
|
-
sort_settings: S.optional(SortSettings)
|
|
243
|
-
})
|
|
244
|
-
export type AlgorithmManifest = typeof AlgorithmManifest.Type
|
|
247
|
+
sort_settings: S.optional(SortSettings)
|
|
248
|
+
})
|
|
249
|
+
export type AlgorithmManifest = typeof AlgorithmManifest.Type
|
|
245
250
|
|
|
246
251
|
export const Metadata = S.Struct({
|
|
247
252
|
document: S.optional(S.Unknown),
|
|
248
253
|
schema: S.optional(
|
|
249
254
|
S.Struct({
|
|
250
255
|
schemaVersion: S.Literal(2),
|
|
251
|
-
sequences: S.Record({ key: S.String, value: S.Number })
|
|
256
|
+
sequences: S.Record({ key: S.String, value: S.Number })
|
|
252
257
|
})
|
|
253
258
|
),
|
|
254
|
-
session: S.optional(S.Unknown)
|
|
255
|
-
})
|
|
256
|
-
export type Metadata = typeof Metadata.Type
|
|
259
|
+
session: S.optional(S.Unknown)
|
|
260
|
+
})
|
|
261
|
+
export type Metadata = typeof Metadata.Type
|
|
257
262
|
|
|
258
263
|
export const FullForm = S.Struct({
|
|
259
264
|
id: FeedId,
|
|
@@ -264,10 +269,10 @@ export const FullForm = S.Struct({
|
|
|
264
269
|
description: S.optional(Description),
|
|
265
270
|
order: Order,
|
|
266
271
|
algorithm_manifest: S.parseJson(AlgorithmManifest),
|
|
267
|
-
metadata: S.optional(S.parseJson(Metadata))
|
|
268
|
-
})
|
|
269
|
-
export type FullForm = typeof FullForm.Type
|
|
270
|
-
export type EncodedFullForm = typeof FullForm.Encoded
|
|
272
|
+
metadata: S.optional(S.parseJson(Metadata))
|
|
273
|
+
})
|
|
274
|
+
export type FullForm = typeof FullForm.Type
|
|
275
|
+
export type EncodedFullForm = typeof FullForm.Encoded
|
|
271
276
|
|
|
272
277
|
/**
|
|
273
278
|
* Actual structure of FormData
|
package/src/schema/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./shared.js"
|
|
2
|
-
export * from "./UpdateAlgorithmPayload.js"
|
|
1
|
+
export * from "./shared.js"
|
|
2
|
+
export * from "./UpdateAlgorithmPayload.js"
|
package/src/schema/shared.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Schema as S } from "effect"
|
|
1
|
+
import { Schema as S } from "effect"
|
|
2
2
|
|
|
3
3
|
export const PartialAlgorithm = S.Struct({
|
|
4
4
|
algorithm_uri: S.String,
|
|
@@ -20,46 +20,46 @@ export const PartialAlgorithm = S.Struct({
|
|
|
20
20
|
id: S.Number,
|
|
21
21
|
created_at: S.DateFromString,
|
|
22
22
|
updated_at: S.DateFromString,
|
|
23
|
-
deleted_at: S.Union(S.DateFromString, S.Null)
|
|
24
|
-
})
|
|
25
|
-
export type PartialAlgorithm = typeof PartialAlgorithm.Type
|
|
23
|
+
deleted_at: S.Union(S.DateFromString, S.Null)
|
|
24
|
+
})
|
|
25
|
+
export type PartialAlgorithm = typeof PartialAlgorithm.Type
|
|
26
26
|
|
|
27
|
-
const Stats = S.Unknown
|
|
28
|
-
const LatestError = S.Unknown
|
|
27
|
+
const Stats = S.Unknown
|
|
28
|
+
const LatestError = S.Unknown
|
|
29
29
|
|
|
30
30
|
const FullAlgorithm = S.Struct({
|
|
31
31
|
...PartialAlgorithm.fields,
|
|
32
32
|
stats: Stats,
|
|
33
33
|
latest_error: LatestError,
|
|
34
34
|
latest_compute_cycle: S.Unknown,
|
|
35
|
-
subscriber_lists: S.Unknown
|
|
36
|
-
})
|
|
35
|
+
subscriber_lists: S.Unknown
|
|
36
|
+
})
|
|
37
37
|
const FullAlgorithmWithManifest = S.Struct({
|
|
38
38
|
...FullAlgorithm.fields,
|
|
39
39
|
draft_algorithm_manifest: S.Unknown,
|
|
40
|
-
algorithm_manifest: S.Unknown
|
|
41
|
-
})
|
|
40
|
+
algorithm_manifest: S.Unknown
|
|
41
|
+
})
|
|
42
42
|
|
|
43
43
|
export const AlgoUpdateResponse = S.Struct({
|
|
44
44
|
message: S.String,
|
|
45
|
-
algorithm: PartialAlgorithm
|
|
46
|
-
})
|
|
47
|
-
export type AlgoUpdateResponse = typeof AlgoUpdateResponse.Type
|
|
45
|
+
algorithm: PartialAlgorithm
|
|
46
|
+
})
|
|
47
|
+
export type AlgoUpdateResponse = typeof AlgoUpdateResponse.Type
|
|
48
48
|
|
|
49
|
-
export const GetAlgoResponse = S.parseJson(FullAlgorithmWithManifest)
|
|
50
|
-
export type GetAlgoResponse = typeof GetAlgoResponse.Type
|
|
49
|
+
export const GetAlgoResponse = S.parseJson(FullAlgorithmWithManifest)
|
|
50
|
+
export type GetAlgoResponse = typeof GetAlgoResponse.Type
|
|
51
51
|
|
|
52
52
|
export const HidePostBody = S.Struct({
|
|
53
53
|
algo_id: S.Number,
|
|
54
|
-
at_uri: S.String
|
|
55
|
-
})
|
|
56
|
-
export type HidePostBody = typeof HidePostBody.Type
|
|
54
|
+
at_uri: S.String
|
|
55
|
+
})
|
|
56
|
+
export type HidePostBody = typeof HidePostBody.Type
|
|
57
57
|
|
|
58
58
|
export const UnhidePostBody = S.Struct({
|
|
59
59
|
algo_id: S.Number,
|
|
60
|
-
at_uri: S.String
|
|
61
|
-
})
|
|
62
|
-
export type UnhidePostBody = typeof UnhidePostBody.Type
|
|
60
|
+
at_uri: S.String
|
|
61
|
+
})
|
|
62
|
+
export type UnhidePostBody = typeof UnhidePostBody.Type
|
|
63
63
|
|
|
64
64
|
// ----------------------- Get Algorithms Response -----------------------
|
|
65
65
|
|
|
@@ -68,15 +68,15 @@ export const AlgorithWithStats = S.Struct({
|
|
|
68
68
|
stats: S.Struct({
|
|
69
69
|
page_renders: S.Number,
|
|
70
70
|
unique_users: S.Number,
|
|
71
|
-
post_renders: S.Number
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
export type AlgorithmWithStats = typeof AlgorithWithStats.Type
|
|
71
|
+
post_renders: S.Number
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
export type AlgorithmWithStats = typeof AlgorithWithStats.Type
|
|
75
75
|
export const GetAlgorithmsResponse = S.Struct({
|
|
76
76
|
page: S.Number,
|
|
77
77
|
page_size: S.Number,
|
|
78
78
|
total_items: S.Number,
|
|
79
79
|
total_pages: S.Number,
|
|
80
|
-
user_algos: S.Array(AlgorithWithStats)
|
|
81
|
-
})
|
|
82
|
-
export type GetAlgorithmsResponse = typeof GetAlgorithmsResponse.Type
|
|
80
|
+
user_algos: S.Array(AlgorithWithStats)
|
|
81
|
+
})
|
|
82
|
+
export type GetAlgorithmsResponse = typeof GetAlgorithmsResponse.Type
|
package/src/stickyposts.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Schema } from "effect"
|
|
1
|
+
import { HttpApiEndpoint, HttpApiGroup } from "@effect/platform"
|
|
2
|
+
import { Schema } from "effect"
|
|
3
|
+
import { FeedIdParam } from "./common.js"
|
|
3
4
|
import {
|
|
4
5
|
CreateStickyPostBody,
|
|
5
6
|
GetStickyPostsBody,
|
|
6
7
|
StickyPostIdParam,
|
|
7
8
|
StickyPostSuccess,
|
|
8
|
-
StickyType
|
|
9
|
-
} from "./schema/StickyPosts.js"
|
|
10
|
-
import { FeedIdParam } from "./common.js";
|
|
9
|
+
StickyType
|
|
10
|
+
} from "./schema/StickyPosts.js"
|
|
11
11
|
|
|
12
12
|
export const StickyPostsApiGroup = HttpApiGroup.make("stickyposts")
|
|
13
13
|
.add(
|
|
@@ -29,7 +29,7 @@ export const StickyPostsApiGroup = HttpApiGroup.make("stickyposts")
|
|
|
29
29
|
.setUrlParams(
|
|
30
30
|
Schema.Struct({
|
|
31
31
|
is_active: Schema.BooleanFromString,
|
|
32
|
-
sticky_type: StickyType
|
|
32
|
+
sticky_type: StickyType
|
|
33
33
|
})
|
|
34
34
|
)
|
|
35
35
|
.addSuccess(StickyPostSuccess)
|
|
@@ -40,4 +40,4 @@ export const StickyPostsApiGroup = HttpApiGroup.make("stickyposts")
|
|
|
40
40
|
)`/app/api/v1/feed-management/sticky-posts/${FeedIdParam}/${StickyPostIdParam}`.addSuccess(
|
|
41
41
|
StickyPostSuccess
|
|
42
42
|
)
|
|
43
|
-
)
|
|
43
|
+
)
|