@openpeepshq/client 0.1.38 → 0.2.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.
Files changed (38) hide show
  1. package/dist/common/authenticated.js +2 -2
  2. package/dist/endpoints/admin.js +2 -2
  3. package/dist/endpoints/conversations.d.ts +13 -39942
  4. package/dist/endpoints/jams.d.ts +1064 -38
  5. package/dist/endpoints/jams.js +1 -1
  6. package/dist/endpoints/posts.js +10 -2
  7. package/dist/endpoints/profiles.d.ts +3153 -75
  8. package/dist/endpoints/search.d.ts +3155 -77
  9. package/dist/endpoints/server.d.ts +1 -0
  10. package/dist/index.js +8 -11
  11. package/package.json +30 -9
  12. package/src/common/authenticated.ts +28 -0
  13. package/src/common/base.ts +11 -0
  14. package/src/endpoints/accounts.ts +52 -0
  15. package/src/endpoints/admin.ts +616 -0
  16. package/src/endpoints/analytics.ts +13 -0
  17. package/src/endpoints/auth.ts +43 -0
  18. package/src/endpoints/conversations.ts +44 -0
  19. package/src/endpoints/groups.ts +69 -0
  20. package/src/endpoints/helpers.ts +91 -0
  21. package/src/endpoints/i18n.ts +14 -0
  22. package/src/endpoints/jams.ts +126 -0
  23. package/src/endpoints/location.ts +10 -0
  24. package/src/endpoints/media.ts +56 -0
  25. package/src/endpoints/payments.ts +34 -0
  26. package/src/endpoints/plugins.ts +25 -0
  27. package/src/endpoints/posts.ts +377 -0
  28. package/src/endpoints/previewLink.ts +10 -0
  29. package/src/endpoints/profiles.ts +167 -0
  30. package/src/endpoints/reports.ts +32 -0
  31. package/src/endpoints/search.ts +34 -0
  32. package/src/endpoints/server.ts +38 -0
  33. package/src/endpoints/sso.ts +35 -0
  34. package/src/endpoints/streaming.ts +29 -0
  35. package/src/endpoints/types.ts +66 -0
  36. package/src/index.ts +88 -0
  37. package/src/types/index.ts +20 -0
  38. package/src/webhooks/index.ts +50 -0
@@ -0,0 +1,377 @@
1
+ import type { FetchClient } from '@openpeepshq/fetch-client';
2
+ import {
3
+ type JamRecording,
4
+ type RsvpRequest,
5
+ type ChronologicalInfiniteQueryParams,
6
+ type PostContext,
7
+ type PostCreationData,
8
+ type PostDataUnion,
9
+ type PostType,
10
+ type ReactionData,
11
+ type SuccessResponse,
12
+ type OffsetInfiniteQueryParams,
13
+ type PublicPost,
14
+ type UnseenPostCounts,
15
+ } from '@openpeepshq/common';
16
+ import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
17
+ import type {
18
+ OpenpeepsNoPayloadEndpoint,
19
+ OpenpeepsPayloadEndpoint,
20
+ } from '../types';
21
+
22
+ type PostsSeenRequest = {
23
+ postIds: string[];
24
+ };
25
+
26
+ type ChronologicalPosts = OpenpeepsNoPayloadEndpoint<
27
+ PublicPost[],
28
+ undefined,
29
+ ChronologicalInfiniteQueryParams
30
+ >;
31
+
32
+ type OffsetPosts = OpenpeepsNoPayloadEndpoint<
33
+ PublicPost[],
34
+ undefined,
35
+ OffsetInfiniteQueryParams
36
+ >;
37
+
38
+ type GroupOffsetPosts = OpenpeepsNoPayloadEndpoint<
39
+ PublicPost[],
40
+ { groupId: string },
41
+ OffsetInfiniteQueryParams
42
+ >;
43
+
44
+ type Finders = {
45
+ list: ChronologicalPosts;
46
+ listByType: OpenpeepsNoPayloadEndpoint<
47
+ PublicPost[],
48
+ { type: PostType },
49
+ ChronologicalInfiniteQueryParams
50
+ >;
51
+ listByHashtag: OpenpeepsNoPayloadEndpoint<
52
+ PublicPost[],
53
+ { hashtag: string },
54
+ ChronologicalInfiniteQueryParams
55
+ >;
56
+ listByGroup: OpenpeepsNoPayloadEndpoint<
57
+ PublicPost[],
58
+ { id: string },
59
+ ChronologicalInfiniteQueryParams
60
+ >;
61
+ listByProfile: OpenpeepsNoPayloadEndpoint<
62
+ PublicPost[],
63
+ { id: string },
64
+ ChronologicalInfiniteQueryParams
65
+ >;
66
+ listBookmarks: ChronologicalPosts;
67
+ findById: OpenpeepsNoPayloadEndpoint<PublicPost, { id: string }>;
68
+ context: OpenpeepsNoPayloadEndpoint<PostContext, { id: string }>;
69
+ reposts: OpenpeepsNoPayloadEndpoint<PublicPost[], { id: string }>;
70
+ recordings: OpenpeepsNoPayloadEndpoint<JamRecording[], { id: string }>;
71
+ publishRecordingReply: OpenpeepsNoPayloadEndpoint<
72
+ JamRecording,
73
+ { id: string; recordingId: string }
74
+ >;
75
+ deleteRecording: OpenpeepsNoPayloadEndpoint<
76
+ SuccessResponse,
77
+ { id: string; recordingId: string }
78
+ >;
79
+ unseenCounts: OpenpeepsNoPayloadEndpoint<UnseenPostCounts>;
80
+ };
81
+
82
+ // Explicit return types keep `tsc` from serializing the expanded PublicPost
83
+ // endpoint shape into `.d.ts` (TS7056 otherwise).
84
+ const finders = (rawClient: FetchClient): Finders => ({
85
+ list: allpeepNoPayloadEndpoint<
86
+ PublicPost[],
87
+ undefined,
88
+ ChronologicalInfiniteQueryParams
89
+ >(rawClient, '/posts'),
90
+ listByType: allpeepNoPayloadEndpoint<
91
+ PublicPost[],
92
+ { type: PostType },
93
+ ChronologicalInfiniteQueryParams
94
+ >(rawClient, '/posts/by-type/:type'),
95
+ listByHashtag: allpeepNoPayloadEndpoint<
96
+ PublicPost[],
97
+ { hashtag: string },
98
+ ChronologicalInfiniteQueryParams
99
+ >(rawClient, '/posts/by-hashtag/:hashtag'),
100
+ listByGroup: allpeepNoPayloadEndpoint<
101
+ PublicPost[],
102
+ { id: string },
103
+ ChronologicalInfiniteQueryParams
104
+ >(rawClient, '/posts/by-group/:id'),
105
+ listByProfile: allpeepNoPayloadEndpoint<
106
+ PublicPost[],
107
+ { id: string },
108
+ ChronologicalInfiniteQueryParams
109
+ >(rawClient, '/posts/by-profile/:id'),
110
+ listBookmarks: allpeepNoPayloadEndpoint<
111
+ PublicPost[],
112
+ undefined,
113
+ ChronologicalInfiniteQueryParams
114
+ >(rawClient, '/posts/bookmarks'),
115
+ findById: allpeepNoPayloadEndpoint<PublicPost, { id: string }>(
116
+ rawClient,
117
+ '/posts/:id',
118
+ ),
119
+ context: allpeepNoPayloadEndpoint<PostContext, { id: string }>(
120
+ rawClient,
121
+ '/posts/:id/context',
122
+ ),
123
+ reposts: allpeepNoPayloadEndpoint<PublicPost[], { id: string }>(
124
+ rawClient,
125
+ '/posts/:id/reposts',
126
+ ),
127
+ recordings: allpeepNoPayloadEndpoint<JamRecording[], { id: string }>(
128
+ rawClient,
129
+ '/posts/:id/recordings',
130
+ ),
131
+ publishRecordingReply: allpeepNoPayloadEndpoint<
132
+ JamRecording,
133
+ { id: string; recordingId: string }
134
+ >(rawClient, '/posts/:id/recordings/:recordingId/reply', 'post'),
135
+ deleteRecording: allpeepNoPayloadEndpoint<
136
+ SuccessResponse,
137
+ { id: string; recordingId: string }
138
+ >(rawClient, '/posts/:id/recordings/:recordingId', 'delete'),
139
+ unseenCounts: allpeepNoPayloadEndpoint<UnseenPostCounts>(
140
+ rawClient,
141
+ '/posts/unseen/counts',
142
+ ),
143
+ });
144
+
145
+ const eventFeeds = (rawClient: FetchClient): EventFeeds => ({
146
+ events: {
147
+ my: {
148
+ upcoming: allpeepNoPayloadEndpoint<
149
+ PublicPost[],
150
+ undefined,
151
+ OffsetInfiniteQueryParams
152
+ >(rawClient, '/posts/feeds/events/my/upcoming'),
153
+ current: allpeepNoPayloadEndpoint<
154
+ PublicPost[],
155
+ undefined,
156
+ OffsetInfiniteQueryParams
157
+ >(rawClient, '/posts/feeds/events/my/current'),
158
+ past: allpeepNoPayloadEndpoint<
159
+ PublicPost[],
160
+ undefined,
161
+ OffsetInfiniteQueryParams
162
+ >(rawClient, '/posts/feeds/events/my/past'),
163
+ },
164
+ upcoming: allpeepNoPayloadEndpoint<
165
+ PublicPost[],
166
+ undefined,
167
+ OffsetInfiniteQueryParams
168
+ >(rawClient, '/posts/feeds/events/upcoming'),
169
+ current: allpeepNoPayloadEndpoint<
170
+ PublicPost[],
171
+ undefined,
172
+ OffsetInfiniteQueryParams
173
+ >(rawClient, '/posts/feeds/events/current'),
174
+ past: allpeepNoPayloadEndpoint<
175
+ PublicPost[],
176
+ undefined,
177
+ OffsetInfiniteQueryParams
178
+ >(rawClient, '/posts/feeds/events/past'),
179
+ group: {
180
+ upcoming: allpeepNoPayloadEndpoint<
181
+ PublicPost[],
182
+ { groupId: string },
183
+ OffsetInfiniteQueryParams
184
+ >(rawClient, '/posts/feeds/events/by-group/:groupId/upcoming'),
185
+ past: allpeepNoPayloadEndpoint<
186
+ PublicPost[],
187
+ { groupId: string },
188
+ OffsetInfiniteQueryParams
189
+ >(rawClient, '/posts/feeds/events/by-group/:groupId/past'),
190
+ },
191
+ },
192
+ });
193
+
194
+ type EventFeeds = {
195
+ events: {
196
+ my: {
197
+ upcoming: OffsetPosts;
198
+ current: OffsetPosts;
199
+ past: OffsetPosts;
200
+ };
201
+ upcoming: OffsetPosts;
202
+ current: OffsetPosts;
203
+ past: OffsetPosts;
204
+ group: {
205
+ upcoming: GroupOffsetPosts;
206
+ past: GroupOffsetPosts;
207
+ };
208
+ };
209
+ };
210
+
211
+ const jamFeeds = (rawClient: FetchClient): JamFeeds => ({
212
+ jams: {
213
+ upcoming: allpeepNoPayloadEndpoint<
214
+ PublicPost[],
215
+ undefined,
216
+ OffsetInfiniteQueryParams
217
+ >(rawClient, '/posts/feeds/jams/upcoming'),
218
+ past: allpeepNoPayloadEndpoint<
219
+ PublicPost[],
220
+ undefined,
221
+ OffsetInfiniteQueryParams
222
+ >(rawClient, '/posts/feeds/jams/past'),
223
+ my: {
224
+ upcoming: allpeepNoPayloadEndpoint<
225
+ PublicPost[],
226
+ undefined,
227
+ OffsetInfiniteQueryParams
228
+ >(rawClient, '/posts/feeds/jams/my/upcoming'),
229
+ past: allpeepNoPayloadEndpoint<
230
+ PublicPost[],
231
+ undefined,
232
+ OffsetInfiniteQueryParams
233
+ >(rawClient, '/posts/feeds/jams/my/past'),
234
+ },
235
+ },
236
+ });
237
+
238
+ type JamFeeds = {
239
+ jams: {
240
+ upcoming: OffsetPosts;
241
+ past: OffsetPosts;
242
+ my: {
243
+ upcoming: OffsetPosts;
244
+ past: OffsetPosts;
245
+ };
246
+ };
247
+ };
248
+
249
+ const postFeeds = (rawClient: FetchClient): PostFeeds => ({
250
+ my: allpeepNoPayloadEndpoint<
251
+ PublicPost[],
252
+ undefined,
253
+ ChronologicalInfiniteQueryParams
254
+ >(rawClient, '/posts/feeds/my'),
255
+ local: allpeepNoPayloadEndpoint<
256
+ PublicPost[],
257
+ undefined,
258
+ ChronologicalInfiniteQueryParams
259
+ >(rawClient, '/posts/feeds/local'),
260
+ });
261
+
262
+ type PostFeeds = {
263
+ my: ChronologicalPosts;
264
+ local: ChronologicalPosts;
265
+ };
266
+
267
+ type Feeds = { feeds: PostFeeds & EventFeeds & JamFeeds };
268
+
269
+ const feeds = (rawClient: FetchClient): Feeds => ({
270
+ feeds: {
271
+ ...postFeeds(rawClient),
272
+ ...eventFeeds(rawClient),
273
+ ...jamFeeds(rawClient),
274
+ },
275
+ });
276
+
277
+ type Mutators = {
278
+ create: OpenpeepsPayloadEndpoint<PublicPost, PostCreationData>;
279
+ update: OpenpeepsPayloadEndpoint<PublicPost, PostDataUnion, { id: string }>;
280
+ delete: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
281
+ react: OpenpeepsPayloadEndpoint<
282
+ SuccessResponse,
283
+ ReactionData,
284
+ { id: string }
285
+ >;
286
+ retractReaction: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
287
+ bookmark: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
288
+ unbookmark: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
289
+ seen: OpenpeepsPayloadEndpoint<SuccessResponse, PostsSeenRequest>;
290
+ seenByGroup: OpenpeepsNoPayloadEndpoint<SuccessResponse, { groupId: string }>;
291
+ repost: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
292
+ vote: OpenpeepsPayloadEndpoint<
293
+ SuccessResponse,
294
+ { selection: number[] },
295
+ { id: string }
296
+ >;
297
+ rsvp: OpenpeepsPayloadEndpoint<SuccessResponse, RsvpRequest, { id: string }>;
298
+ rsvpManage: OpenpeepsPayloadEndpoint<
299
+ SuccessResponse,
300
+ { response: 'removed' | 'yes'; recurrenceId?: string },
301
+ { id: string; profileId: string }
302
+ >;
303
+ };
304
+
305
+ const mutators = (rawClient: FetchClient): Mutators => ({
306
+ create: allpeepPayloadEndpoint<PublicPost, PostCreationData>(
307
+ rawClient,
308
+ '/posts',
309
+ ),
310
+ update: allpeepPayloadEndpoint<PublicPost, PostDataUnion, { id: string }>(
311
+ rawClient,
312
+ '/posts/:id',
313
+ 'put',
314
+ ),
315
+ delete: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
316
+ rawClient,
317
+ '/posts/:id',
318
+ 'delete',
319
+ ),
320
+ react: allpeepPayloadEndpoint<SuccessResponse, ReactionData, { id: string }>(
321
+ rawClient,
322
+ '/posts/:id/react',
323
+ ),
324
+ retractReaction: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
325
+ rawClient,
326
+ '/posts/:id/react',
327
+ 'delete',
328
+ ),
329
+ bookmark: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
330
+ rawClient,
331
+ '/posts/:id/bookmark',
332
+ 'post',
333
+ ),
334
+ unbookmark: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
335
+ rawClient,
336
+ '/posts/:id/bookmark',
337
+ 'delete',
338
+ ),
339
+ seen: allpeepPayloadEndpoint<SuccessResponse, PostsSeenRequest>(
340
+ rawClient,
341
+ '/posts/seen',
342
+ 'post',
343
+ ),
344
+ seenByGroup: allpeepNoPayloadEndpoint<SuccessResponse, { groupId: string }>(
345
+ rawClient,
346
+ '/posts/seen/by-group/:groupId',
347
+ 'post',
348
+ ),
349
+ repost: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
350
+ rawClient,
351
+ '/posts/:id/reposts',
352
+ 'post',
353
+ ),
354
+ vote: allpeepPayloadEndpoint<
355
+ SuccessResponse,
356
+ { selection: number[] },
357
+ { id: string }
358
+ >(rawClient, '/posts/:id/vote'),
359
+ rsvp: allpeepPayloadEndpoint<SuccessResponse, RsvpRequest, { id: string }>(
360
+ rawClient,
361
+ '/posts/:id/rsvp',
362
+ 'post',
363
+ ),
364
+ rsvpManage: allpeepPayloadEndpoint<
365
+ SuccessResponse,
366
+ { response: 'removed' | 'yes'; recurrenceId?: string },
367
+ { id: string; profileId: string }
368
+ >(rawClient, '/posts/:id/rsvp/:profileId', 'post'),
369
+ });
370
+
371
+ type PostsEndpoints = Finders & Mutators & Feeds;
372
+
373
+ export const posts = (rawClient: FetchClient): PostsEndpoints => ({
374
+ ...finders(rawClient),
375
+ ...mutators(rawClient),
376
+ ...feeds(rawClient),
377
+ });
@@ -0,0 +1,10 @@
1
+ import type { FetchClient } from '@openpeepshq/fetch-client';
2
+ import type {
3
+ FetchUrlResponse,
4
+ } from '@openpeepshq/common';
5
+ import { allpeepNoPayloadEndpoint } from './helpers';
6
+
7
+ export const previewLink = (rawClient: FetchClient) => allpeepNoPayloadEndpoint<FetchUrlResponse, { url: string }>(
8
+ rawClient,
9
+ '/fetch-url/:url',
10
+ );
@@ -0,0 +1,167 @@
1
+ import type {
2
+ FetchClient,
3
+ noPayloadEventSource,
4
+ } from '@openpeepshq/fetch-client';
5
+ import type {
6
+ AccessTokenCreationData,
7
+ AccessTokenWithMeta,
8
+ FollowData,
9
+ GroupWithMeta,
10
+ ChronologicalInfiniteQueryParams,
11
+ PublicPost,
12
+ NotificationStats,
13
+ ProfileData,
14
+ ProfileWithMeta,
15
+ PublicProfile,
16
+ SuccessFailureResponse,
17
+ SuccessResponse,
18
+ NotificationType,
19
+ PublicNotification,
20
+ ProfileActivitySummary,
21
+ ProfileSettings,
22
+ ProfileSettingsData,
23
+ PublicAccessToken,
24
+ SessionEvent,
25
+ SessionPlatform,
26
+ Hashtag,
27
+ } from '@openpeepshq/common';
28
+ import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
29
+
30
+ export const profiles = (
31
+ rawClient: FetchClient,
32
+ eventSource: ReturnType<typeof noPayloadEventSource>,
33
+ ) => ({
34
+ current: {
35
+ read: allpeepNoPayloadEndpoint<ProfileWithMeta>(
36
+ rawClient,
37
+ '/profiles/current',
38
+ ),
39
+ update: allpeepPayloadEndpoint<SuccessFailureResponse, ProfileData>(
40
+ rawClient,
41
+ '/profiles/current',
42
+ 'patch',
43
+ ),
44
+ pinPost: allpeepPayloadEndpoint<SuccessResponse, { postId: string }>(
45
+ rawClient,
46
+ '/profiles/current/pinned-post',
47
+ 'patch',
48
+ ),
49
+ notifications: allpeepNoPayloadEndpoint<
50
+ PublicNotification[],
51
+ undefined,
52
+ ChronologicalInfiniteQueryParams
53
+ >(rawClient, '/profiles/current/notifications'),
54
+ notificationStats: allpeepNoPayloadEndpoint<NotificationStats>(
55
+ rawClient,
56
+ '/profiles/current/notifications/stats',
57
+ ),
58
+ notificationTypes: allpeepNoPayloadEndpoint<NotificationType[]>(
59
+ rawClient,
60
+ '/profiles/current/notifications/types',
61
+ ),
62
+ reposts: allpeepNoPayloadEndpoint<PublicPost[]>(
63
+ rawClient,
64
+ '/profiles/current/reposts',
65
+ ),
66
+ bookmarkedIds: allpeepNoPayloadEndpoint<string[]>(
67
+ rawClient,
68
+ '/profiles/current/bookmarkedIds',
69
+ ),
70
+ markAllNotificationsAsSeen: allpeepNoPayloadEndpoint<SuccessResponse>(
71
+ rawClient,
72
+ '/profiles/current/notifications/mark-all-seen',
73
+ 'put',
74
+ ),
75
+ readSettings: allpeepNoPayloadEndpoint<ProfileSettings>(
76
+ rawClient,
77
+ '/profiles/current/settings',
78
+ ),
79
+ updateSettings: allpeepPayloadEndpoint<
80
+ ProfileSettings,
81
+ ProfileSettingsData
82
+ >(rawClient, '/profiles/current/settings', 'put'),
83
+ accessTokens: allpeepNoPayloadEndpoint<PublicAccessToken[]>(
84
+ rawClient,
85
+ '/profiles/current/access-tokens',
86
+ ),
87
+ createAccessToken: allpeepPayloadEndpoint<
88
+ AccessTokenWithMeta,
89
+ AccessTokenCreationData
90
+ >(rawClient, '/profiles/current/access-tokens', 'post'),
91
+ revokeAccessToken: allpeepNoPayloadEndpoint<
92
+ SuccessResponse,
93
+ { accessTokenId: string }
94
+ >(rawClient, '/profiles/current/access-tokens/:accessTokenId', 'delete'),
95
+ sessionEvents: {
96
+ listen: eventSource<
97
+ SessionEvent,
98
+ undefined,
99
+ { platform: SessionPlatform; connectionId: string }
100
+ >('/profiles/current/session/events'),
101
+ },
102
+ blocked: allpeepNoPayloadEndpoint<PublicProfile[]>(
103
+ rawClient,
104
+ '/profiles/current/blocked',
105
+ ),
106
+ followedHashtags: allpeepNoPayloadEndpoint<Hashtag[]>(
107
+ rawClient,
108
+ '/profiles/current/hashtags',
109
+ ),
110
+ followHashtag: allpeepNoPayloadEndpoint<SuccessResponse, { tag: string }>(
111
+ rawClient,
112
+ '/profiles/current/hashtags/:tag/follow',
113
+ 'post',
114
+ ),
115
+ unfollowHashtag: allpeepNoPayloadEndpoint<SuccessResponse, { tag: string }>(
116
+ rawClient,
117
+ '/profiles/current/hashtags/:tag/follow',
118
+ 'delete',
119
+ ),
120
+ },
121
+
122
+ list: allpeepNoPayloadEndpoint<PublicProfile[]>(rawClient, '/profiles'),
123
+ findById: allpeepNoPayloadEndpoint<PublicProfile, { id: string }>(
124
+ rawClient,
125
+ '/profiles/:id',
126
+ ),
127
+ findByHandle: allpeepNoPayloadEndpoint<PublicProfile, { handle: string }>(
128
+ rawClient,
129
+ '/profiles/by-handle/:handle',
130
+ ),
131
+ follow: allpeepPayloadEndpoint<SuccessResponse, FollowData, { id: string }>(
132
+ rawClient,
133
+ '/profiles/:id/follow',
134
+ 'post',
135
+ ),
136
+ unfollow: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
137
+ rawClient,
138
+ '/profiles/:id/follow',
139
+ 'delete',
140
+ ),
141
+ block: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
142
+ rawClient,
143
+ '/profiles/:id/block',
144
+ 'post',
145
+ ),
146
+ unblock: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
147
+ rawClient,
148
+ '/profiles/:id/block',
149
+ 'delete',
150
+ ),
151
+ followers: allpeepNoPayloadEndpoint<PublicProfile[], { id: string }>(
152
+ rawClient,
153
+ '/profiles/:id/followers',
154
+ ),
155
+ following: allpeepNoPayloadEndpoint<PublicProfile[], { id: string }>(
156
+ rawClient,
157
+ '/profiles/:id/following',
158
+ ),
159
+ commonGroups: allpeepNoPayloadEndpoint<
160
+ GroupWithMeta[],
161
+ { profileId: string }
162
+ >(rawClient, '/profiles/:profileId/common-groups'),
163
+ activitySummary: allpeepNoPayloadEndpoint<
164
+ ProfileActivitySummary,
165
+ { profileId: string }
166
+ >(rawClient, '/profiles/:profileId/activity-summary'),
167
+ });
@@ -0,0 +1,32 @@
1
+ import type { FetchClient } from '@openpeepshq/fetch-client';
2
+ import type {
3
+ ReportCreationData,
4
+ PublicReport,
5
+ SuccessResponse,
6
+ } from '@openpeepshq/common';
7
+ import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
8
+
9
+ export const reports = (rawClient: FetchClient) => ({
10
+ list: allpeepNoPayloadEndpoint<PublicReport[]>(
11
+ rawClient,
12
+ '/reports',
13
+ ),
14
+ findById: allpeepNoPayloadEndpoint<PublicReport, { reportId: string }>(
15
+ rawClient,
16
+ '/reports/:reportId',
17
+ ),
18
+ create: allpeepPayloadEndpoint<PublicReport, ReportCreationData>(
19
+ rawClient,
20
+ '/reports',
21
+ ),
22
+ update: allpeepPayloadEndpoint<PublicReport, Partial<ReportCreationData>, { id: string }>(
23
+ rawClient,
24
+ '/reports/:id',
25
+ 'patch',
26
+ ),
27
+ delete: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
28
+ rawClient,
29
+ '/reports/:id',
30
+ 'delete',
31
+ ),
32
+ });
@@ -0,0 +1,34 @@
1
+ import { FetchClient } from "@openpeepshq/fetch-client";
2
+ import { allpeepNoPayloadEndpoint } from "./helpers";
3
+ import { GroupWithMeta, PublicPost, OffsetInfiniteQueryParams, PublicProfile, SearchResult, SearchResultCounts } from "@openpeepshq/common";
4
+
5
+ type SearchQueryParams = OffsetInfiniteQueryParams & {
6
+ q: string;
7
+ }
8
+
9
+ export const search = (rawClient: FetchClient) => ({
10
+ posts: allpeepNoPayloadEndpoint<SearchResult<PublicPost>, undefined, SearchQueryParams>(
11
+ rawClient,
12
+ '/search/posts',
13
+ ),
14
+ profiles: allpeepNoPayloadEndpoint<SearchResult<PublicProfile>, undefined, SearchQueryParams>(
15
+ rawClient,
16
+ '/search/profiles',
17
+ ),
18
+ events: allpeepNoPayloadEndpoint<SearchResult<PublicPost>, undefined, SearchQueryParams>(
19
+ rawClient,
20
+ '/search/events',
21
+ ),
22
+ jams: allpeepNoPayloadEndpoint<SearchResult<PublicPost>, undefined, SearchQueryParams>(
23
+ rawClient,
24
+ '/search/jams',
25
+ ),
26
+ groups: allpeepNoPayloadEndpoint<SearchResult<GroupWithMeta>, undefined, SearchQueryParams>(
27
+ rawClient,
28
+ '/search/groups',
29
+ ),
30
+ counts: allpeepNoPayloadEndpoint<SearchResultCounts, undefined, SearchQueryParams>(
31
+ rawClient,
32
+ '/search/counts',
33
+ ),
34
+ })
@@ -0,0 +1,38 @@
1
+ import type { FetchClient } from '@openpeepshq/fetch-client';
2
+ import type {
3
+ CapabilitiesConfig,
4
+ ServerInfo,
5
+ WebhookKeyResponse,
6
+ WebhookVerifyRequest,
7
+ WebhookVerifyResponse,
8
+ } from '@openpeepshq/common';
9
+ import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
10
+
11
+ export const server = (rawClient: FetchClient) => ({
12
+ info: allpeepNoPayloadEndpoint<ServerInfo>(
13
+ rawClient,
14
+ '/server/info',
15
+ ),
16
+ config: {
17
+ capabilities: allpeepNoPayloadEndpoint<CapabilitiesConfig>(
18
+ rawClient,
19
+ '/server/config/capabilities',
20
+ ),
21
+ },
22
+ keys: {
23
+ webhooks: {
24
+ public: allpeepNoPayloadEndpoint<WebhookKeyResponse>(
25
+ rawClient,
26
+ '/server/keys/webhooks',
27
+ ),
28
+ verify: allpeepPayloadEndpoint<
29
+ WebhookVerifyResponse,
30
+ WebhookVerifyRequest
31
+ >(
32
+ rawClient,
33
+ '/server/keys/webhooks/verify',
34
+ 'post',
35
+ ),
36
+ },
37
+ },
38
+ });
@@ -0,0 +1,35 @@
1
+ import type { FetchClient } from '@openpeepshq/fetch-client';
2
+ import type { TokenResponse } from '@openpeepshq/common';
3
+ import { allpeepPayloadEndpoint, allpeepNoPayloadEndpoint } from './helpers';
4
+
5
+ export const sso = (rawClient: FetchClient) => ({
6
+ generic: {
7
+ authenticate: allpeepPayloadEndpoint<
8
+ TokenResponse,
9
+ { data: Record<string, string> }
10
+ >(
11
+ rawClient,
12
+ '/sso/generic',
13
+ ),
14
+ },
15
+ oidc: {
16
+ authorize: allpeepNoPayloadEndpoint<
17
+ { data: { redirectUrl: string } },
18
+ { id: string }
19
+ >(
20
+ rawClient,
21
+ '/sso/oidc/{id}/authorize',
22
+ 'get',
23
+ ),
24
+ callback: allpeepNoPayloadEndpoint<
25
+ TokenResponse,
26
+ { id: string },
27
+ Record<string, string>
28
+ >(
29
+ rawClient,
30
+ '/sso/oidc/{id}/callback',
31
+ 'get',
32
+ ),
33
+ },
34
+ }
35
+ );