@openpeepshq/client 0.2.0 → 0.3.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.
- package/dist/endpoints/admin.d.ts +11 -1
- package/dist/endpoints/admin.js +6 -0
- package/dist/endpoints/conversations.d.ts +18 -39941
- package/dist/endpoints/conversations.js +1 -0
- package/dist/endpoints/helpers.d.ts +1 -1
- package/dist/endpoints/helpers.js +4 -4
- package/dist/endpoints/jams.d.ts +1124 -49
- package/dist/endpoints/posts.d.ts +4 -0
- package/dist/endpoints/posts.js +10 -0
- package/dist/endpoints/profiles.d.ts +3334 -108
- package/dist/endpoints/search.d.ts +3337 -112
- package/dist/endpoints/search.js +1 -1
- package/dist/endpoints/server.d.ts +1 -0
- package/dist/endpoints/streaming.js +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +3 -3
- package/package.json +11 -9
- package/src/endpoints/admin.ts +29 -0
- package/src/endpoints/auth.ts +37 -37
- package/src/endpoints/conversations.ts +37 -5
- package/src/endpoints/groups.ts +60 -63
- package/src/endpoints/helpers.ts +78 -78
- package/src/endpoints/i18n.ts +6 -9
- package/src/endpoints/location.ts +6 -5
- package/src/endpoints/media.ts +42 -45
- package/src/endpoints/posts.ts +13 -0
- package/src/endpoints/previewLink.ts +4 -5
- package/src/endpoints/reports.ts +23 -26
- package/src/endpoints/search.ts +43 -30
- package/src/endpoints/server.ts +23 -30
- package/src/endpoints/sso.ts +18 -30
- package/src/endpoints/streaming.ts +19 -25
- package/src/webhooks/index.ts +4 -10
package/dist/endpoints/search.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { allpeepNoPayloadEndpoint } from
|
|
1
|
+
import { allpeepNoPayloadEndpoint } from './helpers.js';
|
|
2
2
|
export const search = (rawClient) => ({
|
|
3
3
|
posts: allpeepNoPayloadEndpoint(rawClient, '/search/posts'),
|
|
4
4
|
profiles: allpeepNoPayloadEndpoint(rawClient, '/search/profiles'),
|
|
@@ -69,6 +69,7 @@ export declare const server: (rawClient: FetchClient) => {
|
|
|
69
69
|
defaultTimeZone?: string | undefined;
|
|
70
70
|
defaultFeedFormat?: "threaded" | "linear" | undefined;
|
|
71
71
|
indexProfiles?: boolean | undefined;
|
|
72
|
+
additionalForbiddenHandles?: string[] | undefined;
|
|
72
73
|
};
|
|
73
74
|
roles: {
|
|
74
75
|
onRegistration: {
|
package/dist/webhooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type WebhookData, type WebhookKeyResponse } from '@openpeepshq/common/types';
|
|
2
2
|
import type { OpenpeepsNoPayloadEndpoint } from '../types';
|
|
3
|
-
export type WebhookHandler = (
|
|
3
|
+
export type WebhookHandler = (input: string) => Promise<WebhookData>;
|
|
4
4
|
export declare const webhookHandler: (publicKeyEndpoint: OpenpeepsNoPayloadEndpoint<WebhookKeyResponse>) => WebhookHandler;
|
package/dist/webhooks/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { webhookDataSchema, } from '@openpeepshq/common/types';
|
|
2
2
|
import { parseJwtKeyId, verifyJwt } from '@openpeepshq/common/lib';
|
|
3
3
|
export const webhookHandler = (publicKeyEndpoint) => {
|
|
4
|
-
|
|
4
|
+
const publicKey = undefined;
|
|
5
5
|
const getPublicKey = async (kid) => {
|
|
6
6
|
if (!kid) {
|
|
7
7
|
throw new Error('Kid is required');
|
|
@@ -15,7 +15,7 @@ export const webhookHandler = (publicKeyEndpoint) => {
|
|
|
15
15
|
}
|
|
16
16
|
return result.data.publicKey;
|
|
17
17
|
};
|
|
18
|
-
return
|
|
18
|
+
return async (input) => {
|
|
19
19
|
const token = typeof input === 'string' ? input : input.token;
|
|
20
20
|
const tokenKeyId = parseJwtKeyId(token);
|
|
21
21
|
const verification = await verifyJwt(token, await getPublicKey(tokenKeyId));
|
|
@@ -23,5 +23,5 @@ export const webhookHandler = (publicKeyEndpoint) => {
|
|
|
23
23
|
throw new Error('Invalid webhook token');
|
|
24
24
|
}
|
|
25
25
|
return webhookDataSchema.parse(verification.payload);
|
|
26
|
-
}
|
|
26
|
+
};
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"validator": "^13.11.0",
|
|
9
|
-
"@openpeepshq/common": "^0.
|
|
10
|
-
"@openpeepshq/fetch-client": "^0.2.
|
|
9
|
+
"@openpeepshq/common": "^0.5.0",
|
|
10
|
+
"@openpeepshq/fetch-client": "^0.2.1"
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
@@ -40,19 +40,21 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^22.14.1",
|
|
42
42
|
"@types/validator": "^13.11.9",
|
|
43
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
44
|
-
"@typescript-eslint/parser": "^8.
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "^8.72.0",
|
|
44
|
+
"@typescript-eslint/parser": "^8.72.0",
|
|
45
45
|
"concurrently": "^9.1.2",
|
|
46
|
-
"eslint": "^
|
|
46
|
+
"eslint": "^10.1.0",
|
|
47
47
|
"i18next": "^24.2.3",
|
|
48
48
|
"livekit-client": "^2.19.2",
|
|
49
49
|
"prettier": "^3.4.2",
|
|
50
50
|
"tsc-alias": "^1.8.10",
|
|
51
|
-
"typescript": "^
|
|
51
|
+
"typescript": "^6.0.2",
|
|
52
|
+
"eslint-config-prettier": "^9.1.0",
|
|
53
|
+
"@eslint/js": "^9.17.0"
|
|
52
54
|
},
|
|
53
55
|
"scripts": {
|
|
54
|
-
"lint": "
|
|
55
|
-
"format": "prettier --write .",
|
|
56
|
+
"lint": "eslint .",
|
|
57
|
+
"format": "prettier --write --ignore-path ../../.prettierignore .",
|
|
56
58
|
"clean": "rm -rf tsconfig.tsbuildinfo dist",
|
|
57
59
|
"typecheck": "tsc --noEmit",
|
|
58
60
|
"build": "tsc && tsc-alias",
|
package/src/endpoints/admin.ts
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
AdminEmailTestInput,
|
|
30
30
|
AdminJobDetail,
|
|
31
31
|
AdminPerformanceStats,
|
|
32
|
+
LivekitDiagnosis,
|
|
32
33
|
ConfigData,
|
|
33
34
|
ConfigDataWithDefaults,
|
|
34
35
|
ExplorerRowsResponse,
|
|
@@ -43,6 +44,7 @@ import {
|
|
|
43
44
|
ProfileWithMeta,
|
|
44
45
|
PublicAccessToken,
|
|
45
46
|
Resource,
|
|
47
|
+
StoredMediaList,
|
|
46
48
|
SuccessResponse,
|
|
47
49
|
TokenResponse,
|
|
48
50
|
} from '@openpeepshq/common';
|
|
@@ -95,6 +97,10 @@ export type Admin = {
|
|
|
95
97
|
create: OpenpeepsNoPayloadEndpoint<SuccessResponse>;
|
|
96
98
|
restore: OpenpeepsPayloadEndpoint<SuccessResponse, File>;
|
|
97
99
|
};
|
|
100
|
+
media: {
|
|
101
|
+
list: OpenpeepsNoPayloadEndpoint<StoredMediaList>;
|
|
102
|
+
delete: OpenpeepsNoPayloadEndpoint<SuccessResponse, { storageId: string }>;
|
|
103
|
+
};
|
|
98
104
|
config: {
|
|
99
105
|
read: OpenpeepsNoPayloadEndpoint<
|
|
100
106
|
ConfigDataWithDefaults,
|
|
@@ -126,6 +132,7 @@ export type Admin = {
|
|
|
126
132
|
>;
|
|
127
133
|
};
|
|
128
134
|
performance: OpenpeepsNoPayloadEndpoint<AdminPerformanceStats>;
|
|
135
|
+
livekit: OpenpeepsNoPayloadEndpoint<LivekitDiagnosis>;
|
|
129
136
|
};
|
|
130
137
|
db: {
|
|
131
138
|
token: OpenpeepsNoPayloadEndpoint<TokenResponse>;
|
|
@@ -150,6 +157,11 @@ export type Admin = {
|
|
|
150
157
|
invites: {
|
|
151
158
|
create: OpenpeepsPayloadEndpoint<InviteLinkWithMeta, InviteLinkData>;
|
|
152
159
|
list: OpenpeepsNoPayloadEndpoint<InviteLinkWithMeta[]>;
|
|
160
|
+
update: OpenpeepsPayloadEndpoint<
|
|
161
|
+
InviteLinkWithMeta,
|
|
162
|
+
Partial<Pick<InviteLinkData, 'maxUses' | 'expiresAt'>>,
|
|
163
|
+
{ id: string }
|
|
164
|
+
>;
|
|
153
165
|
activate: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
|
|
154
166
|
deactivate: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
|
|
155
167
|
};
|
|
@@ -305,6 +317,14 @@ export const admin = (rawClient: FetchClient): Admin => ({
|
|
|
305
317
|
'post',
|
|
306
318
|
),
|
|
307
319
|
},
|
|
320
|
+
media: {
|
|
321
|
+
list: allpeepNoPayloadEndpoint<StoredMediaList>(rawClient, '/admin/media'),
|
|
322
|
+
delete: allpeepNoPayloadEndpoint<SuccessResponse, { storageId: string }>(
|
|
323
|
+
rawClient,
|
|
324
|
+
'/admin/media/:storageId',
|
|
325
|
+
'delete',
|
|
326
|
+
),
|
|
327
|
+
},
|
|
308
328
|
config: {
|
|
309
329
|
read: allpeepNoPayloadEndpoint<
|
|
310
330
|
ConfigDataWithDefaults,
|
|
@@ -346,6 +366,10 @@ export const admin = (rawClient: FetchClient): Admin => ({
|
|
|
346
366
|
rawClient,
|
|
347
367
|
'/admin/diagnostics/performance',
|
|
348
368
|
),
|
|
369
|
+
livekit: allpeepNoPayloadEndpoint<LivekitDiagnosis>(
|
|
370
|
+
rawClient,
|
|
371
|
+
'/admin/diagnostics/livekit',
|
|
372
|
+
),
|
|
349
373
|
},
|
|
350
374
|
db: {
|
|
351
375
|
token: allpeepNoPayloadEndpoint<TokenResponse>(
|
|
@@ -410,6 +434,11 @@ export const admin = (rawClient: FetchClient): Admin => ({
|
|
|
410
434
|
rawClient,
|
|
411
435
|
'/invite-links',
|
|
412
436
|
),
|
|
437
|
+
update: allpeepPayloadEndpoint<
|
|
438
|
+
InviteLinkWithMeta,
|
|
439
|
+
Partial<Pick<InviteLinkData, 'maxUses' | 'expiresAt'>>,
|
|
440
|
+
{ id: string }
|
|
441
|
+
>(rawClient, '/invite-links/:id', 'patch'),
|
|
413
442
|
activate: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
|
|
414
443
|
rawClient,
|
|
415
444
|
'/invite-links/:id/activate',
|
package/src/endpoints/auth.ts
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
GuestPassRequest,
|
|
4
|
+
LoginRequest,
|
|
5
|
+
RegisterRequest,
|
|
6
|
+
RequestResetPasswordRequest,
|
|
7
|
+
ResetPasswordRequest,
|
|
8
|
+
SuccessResponse,
|
|
9
|
+
TokenResponse,
|
|
10
10
|
} from '@openpeepshq/common';
|
|
11
11
|
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
12
12
|
|
|
13
13
|
export const auth = (rawClient: FetchClient) => ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
14
|
+
login: allpeepPayloadEndpoint<TokenResponse, LoginRequest>(
|
|
15
|
+
rawClient,
|
|
16
|
+
'/auth/login',
|
|
17
|
+
),
|
|
18
|
+
register: allpeepPayloadEndpoint<TokenResponse, RegisterRequest>(
|
|
19
|
+
rawClient,
|
|
20
|
+
'/auth/register',
|
|
21
|
+
),
|
|
22
|
+
requestResetPassword: allpeepPayloadEndpoint<
|
|
23
|
+
SuccessResponse,
|
|
24
|
+
RequestResetPasswordRequest
|
|
25
|
+
>(rawClient, '/auth/request-reset-password'),
|
|
26
|
+
resetPassword: allpeepPayloadEndpoint<SuccessResponse, ResetPasswordRequest>(
|
|
27
|
+
rawClient,
|
|
28
|
+
'/auth/reset-password',
|
|
29
|
+
),
|
|
30
|
+
guestPass: allpeepPayloadEndpoint<TokenResponse, GuestPassRequest>(
|
|
31
|
+
rawClient,
|
|
32
|
+
'/auth/guest-pass',
|
|
33
|
+
),
|
|
34
|
+
refresh: allpeepPayloadEndpoint<TokenResponse, Record<string, never>>(
|
|
35
|
+
rawClient,
|
|
36
|
+
'/auth/refresh',
|
|
37
|
+
),
|
|
38
|
+
validateEmail: allpeepNoPayloadEndpoint<
|
|
39
|
+
SuccessResponse,
|
|
40
|
+
undefined,
|
|
41
|
+
{ token: string }
|
|
42
|
+
>(rawClient, '/auth/validate-email'),
|
|
43
|
+
});
|
|
@@ -1,17 +1,49 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
2
|
import type {
|
|
3
|
+
DirectMessageSearchHit,
|
|
3
4
|
PublicPost,
|
|
4
5
|
PostCreationData,
|
|
5
6
|
SuccessResponse,
|
|
6
7
|
} from '@openpeepshq/common';
|
|
7
8
|
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
9
|
+
import type {
|
|
10
|
+
OpenpeepsNoPayloadEndpoint,
|
|
11
|
+
OpenpeepsPayloadEndpoint,
|
|
12
|
+
} from '../types';
|
|
13
|
+
|
|
14
|
+
type Conversations = {
|
|
15
|
+
list: OpenpeepsNoPayloadEndpoint<PublicPost[][]>;
|
|
16
|
+
findById: OpenpeepsNoPayloadEndpoint<
|
|
17
|
+
PublicPost[],
|
|
18
|
+
{ id: string },
|
|
19
|
+
{ message?: string }
|
|
20
|
+
>;
|
|
21
|
+
search: OpenpeepsNoPayloadEndpoint<
|
|
22
|
+
DirectMessageSearchHit[],
|
|
23
|
+
undefined,
|
|
24
|
+
{ q: string; conversationId?: string }
|
|
25
|
+
>;
|
|
26
|
+
newPost: OpenpeepsPayloadEndpoint<
|
|
27
|
+
PublicPost,
|
|
28
|
+
PostCreationData,
|
|
29
|
+
{ id: string }
|
|
30
|
+
>;
|
|
31
|
+
leave: OpenpeepsNoPayloadEndpoint<SuccessResponse, { id: string }>;
|
|
32
|
+
archived: OpenpeepsNoPayloadEndpoint<PublicPost[][]>;
|
|
33
|
+
};
|
|
8
34
|
|
|
9
|
-
export const conversations = (rawClient: FetchClient) => ({
|
|
35
|
+
export const conversations = (rawClient: FetchClient): Conversations => ({
|
|
10
36
|
list: allpeepNoPayloadEndpoint<PublicPost[][]>(rawClient, '/conversations'),
|
|
11
|
-
findById: allpeepNoPayloadEndpoint<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
37
|
+
findById: allpeepNoPayloadEndpoint<
|
|
38
|
+
PublicPost[],
|
|
39
|
+
{ id: string },
|
|
40
|
+
{ message?: string }
|
|
41
|
+
>(rawClient, '/conversations/:id'),
|
|
42
|
+
search: allpeepNoPayloadEndpoint<
|
|
43
|
+
DirectMessageSearchHit[],
|
|
44
|
+
undefined,
|
|
45
|
+
{ q: string; conversationId?: string }
|
|
46
|
+
>(rawClient, '/conversations/search'),
|
|
15
47
|
newPost: allpeepPayloadEndpoint<PublicPost, PostCreationData, { id: string }>(
|
|
16
48
|
rawClient,
|
|
17
49
|
'/conversations/:id/posts',
|
package/src/endpoints/groups.ts
CHANGED
|
@@ -1,69 +1,66 @@
|
|
|
1
1
|
import type { FetchClient } from '@openpeepshq/fetch-client';
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
CreateGroupRequest,
|
|
4
|
+
GroupData,
|
|
5
|
+
GroupMember,
|
|
6
|
+
GroupRoleData,
|
|
7
|
+
GroupWithMeta,
|
|
8
|
+
PublicProfile,
|
|
9
|
+
SuccessResponse,
|
|
10
10
|
} from '@openpeepshq/common';
|
|
11
11
|
import { allpeepNoPayloadEndpoint, allpeepPayloadEndpoint } from './helpers';
|
|
12
12
|
|
|
13
13
|
export const groups = (rawClient: FetchClient) => ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
'put',
|
|
68
|
-
),
|
|
69
|
-
});
|
|
14
|
+
create: allpeepPayloadEndpoint<GroupWithMeta, CreateGroupRequest>(
|
|
15
|
+
rawClient,
|
|
16
|
+
'/groups',
|
|
17
|
+
'post',
|
|
18
|
+
),
|
|
19
|
+
list: allpeepNoPayloadEndpoint<GroupWithMeta[]>(rawClient, '/groups'),
|
|
20
|
+
findById: allpeepNoPayloadEndpoint<GroupWithMeta, { id: string }>(
|
|
21
|
+
rawClient,
|
|
22
|
+
'/groups/:id',
|
|
23
|
+
),
|
|
24
|
+
findByHandle: allpeepNoPayloadEndpoint<GroupWithMeta, { handle: string }>(
|
|
25
|
+
rawClient,
|
|
26
|
+
'/groups/by-handle/:handle',
|
|
27
|
+
),
|
|
28
|
+
update: allpeepPayloadEndpoint<GroupWithMeta, GroupData, { id: string }>(
|
|
29
|
+
rawClient,
|
|
30
|
+
'/groups/:id',
|
|
31
|
+
'put',
|
|
32
|
+
),
|
|
33
|
+
delete: allpeepNoPayloadEndpoint<GroupWithMeta, { id: string }>(
|
|
34
|
+
rawClient,
|
|
35
|
+
'/groups/:id',
|
|
36
|
+
'delete',
|
|
37
|
+
),
|
|
38
|
+
members: allpeepNoPayloadEndpoint<GroupMember[], { id: string }>(
|
|
39
|
+
rawClient,
|
|
40
|
+
'/groups/:id/members',
|
|
41
|
+
),
|
|
42
|
+
join: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
|
|
43
|
+
rawClient,
|
|
44
|
+
'/groups/:id/join',
|
|
45
|
+
'post',
|
|
46
|
+
),
|
|
47
|
+
leave: allpeepNoPayloadEndpoint<SuccessResponse, { id: string }>(
|
|
48
|
+
rawClient,
|
|
49
|
+
'/groups/:id/leave',
|
|
50
|
+
'delete',
|
|
51
|
+
),
|
|
52
|
+
addMember: allpeepPayloadEndpoint<
|
|
53
|
+
SuccessResponse,
|
|
54
|
+
PublicProfile,
|
|
55
|
+
{ id: string }
|
|
56
|
+
>(rawClient, '/groups/:id/members'),
|
|
57
|
+
removeMember: allpeepNoPayloadEndpoint<
|
|
58
|
+
SuccessResponse,
|
|
59
|
+
{ id: string; memberId: string }
|
|
60
|
+
>(rawClient, '/groups/:id/members/:memberId', 'delete'),
|
|
61
|
+
setMemberRoles: allpeepPayloadEndpoint<
|
|
62
|
+
SuccessResponse,
|
|
63
|
+
GroupRoleData,
|
|
64
|
+
{ id: string; memberId: string }
|
|
65
|
+
>(rawClient, '/groups/:id/members/:memberId', 'put'),
|
|
66
|
+
});
|
package/src/endpoints/helpers.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import type { SuccessFailureResponse } from
|
|
1
|
+
import type { SuccessFailureResponse } from '@openpeepshq/common';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from
|
|
3
|
+
type BodyType,
|
|
4
|
+
type EndpointDefinition,
|
|
5
|
+
type FetchClient,
|
|
6
|
+
type FormDataEndpointDefinition,
|
|
7
|
+
type FormDataSource,
|
|
8
|
+
type ParametersType,
|
|
9
|
+
typedNoPayloadEndpoint,
|
|
10
|
+
typedPayloadEndpoint,
|
|
11
|
+
typedPayloadProgressObserverEndpoint,
|
|
12
|
+
type Verb,
|
|
13
|
+
} from '@openpeepshq/fetch-client';
|
|
14
14
|
|
|
15
15
|
export const allpeepPayloadEndpoint = <
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
Output,
|
|
17
|
+
Input extends BodyType,
|
|
18
|
+
PathParameters extends ParametersType = undefined,
|
|
19
|
+
QueryParameters extends ParametersType = undefined,
|
|
20
20
|
>(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
rawClient: FetchClient,
|
|
22
|
+
path: string,
|
|
23
|
+
method: Verb = 'post',
|
|
24
|
+
convertToFormData?: Input extends FormDataSource ? true : false | undefined,
|
|
25
25
|
) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
typedPayloadEndpoint<
|
|
27
|
+
Output,
|
|
28
|
+
Input,
|
|
29
|
+
SuccessFailureResponse,
|
|
30
|
+
PathParameters,
|
|
31
|
+
QueryParameters
|
|
32
|
+
>(
|
|
33
|
+
{
|
|
34
|
+
path,
|
|
35
|
+
method,
|
|
36
|
+
convertToFormData,
|
|
37
|
+
} as Input extends FormDataSource
|
|
38
|
+
? FormDataEndpointDefinition
|
|
39
|
+
: EndpointDefinition,
|
|
40
|
+
rawClient,
|
|
41
|
+
);
|
|
42
42
|
|
|
43
43
|
export const allpeepPayloadProgressObserverEndpoint = <
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
Output,
|
|
45
|
+
Input extends BodyType,
|
|
46
|
+
PathParameters extends ParametersType = undefined,
|
|
47
|
+
QueryParameters extends ParametersType = undefined,
|
|
48
48
|
>(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
rawClient: FetchClient,
|
|
50
|
+
path: string,
|
|
51
|
+
method: Verb = 'post',
|
|
52
|
+
convertToFormData?: Input extends FormDataSource ? true : false | undefined,
|
|
53
53
|
) =>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
typedPayloadProgressObserverEndpoint<
|
|
55
|
+
Output,
|
|
56
|
+
Input,
|
|
57
|
+
SuccessFailureResponse,
|
|
58
|
+
PathParameters,
|
|
59
|
+
QueryParameters
|
|
60
|
+
>(
|
|
61
|
+
{
|
|
62
|
+
path,
|
|
63
|
+
method,
|
|
64
|
+
convertToFormData,
|
|
65
|
+
} as Input extends FormDataSource
|
|
66
|
+
? FormDataEndpointDefinition
|
|
67
|
+
: EndpointDefinition,
|
|
68
|
+
rawClient,
|
|
69
|
+
);
|
|
70
70
|
|
|
71
71
|
export const allpeepNoPayloadEndpoint = <
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
Output,
|
|
73
|
+
PathParameters extends ParametersType = undefined,
|
|
74
|
+
QueryParameters extends ParametersType = undefined,
|
|
75
75
|
>(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
rawClient: FetchClient,
|
|
77
|
+
path: string,
|
|
78
|
+
method: Verb = 'get',
|
|
79
79
|
) =>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
80
|
+
typedNoPayloadEndpoint<
|
|
81
|
+
Output,
|
|
82
|
+
SuccessFailureResponse,
|
|
83
|
+
PathParameters,
|
|
84
|
+
QueryParameters
|
|
85
|
+
>(
|
|
86
|
+
{
|
|
87
|
+
path,
|
|
88
|
+
method,
|
|
89
|
+
},
|
|
90
|
+
rawClient,
|
|
91
|
+
);
|
package/src/endpoints/i18n.ts
CHANGED
|
@@ -3,12 +3,9 @@ import type { ResourceLanguage } from 'i18next';
|
|
|
3
3
|
import { allpeepNoPayloadEndpoint } from './helpers';
|
|
4
4
|
|
|
5
5
|
export const i18n = (rawClient: FetchClient) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
'/i18n/languages',
|
|
13
|
-
),
|
|
14
|
-
});
|
|
6
|
+
translations: allpeepNoPayloadEndpoint<ResourceLanguage, { lang: string }>(
|
|
7
|
+
rawClient,
|
|
8
|
+
'/i18n/:lang',
|
|
9
|
+
),
|
|
10
|
+
languages: allpeepNoPayloadEndpoint<string[]>(rawClient, '/i18n/languages'),
|
|
11
|
+
});
|
|
@@ -3,8 +3,9 @@ import type { GeocodingResult } from '@openpeepshq/common';
|
|
|
3
3
|
import { allpeepNoPayloadEndpoint } from './helpers';
|
|
4
4
|
|
|
5
5
|
export const location = (rawClient: FetchClient) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
geocode: allpeepNoPayloadEndpoint<
|
|
7
|
+
GeocodingResult[],
|
|
8
|
+
undefined,
|
|
9
|
+
{ query: string }
|
|
10
|
+
>(rawClient, '/location/geocode'),
|
|
11
|
+
});
|