@sublay/js 5.0.0 → 7.0.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/README.md +33 -4
- package/dist/core/client.d.ts +58 -2
- package/dist/core/multipart.d.ts +22 -0
- package/dist/index.d.mts +2508 -42
- package/dist/index.d.ts +29 -2
- package/dist/index.js +1746 -37
- package/dist/index.mjs +1746 -37
- package/dist/interfaces/AppNotification.d.ts +258 -0
- package/dist/interfaces/ChatMessage.d.ts +32 -0
- package/dist/interfaces/Collection.d.ts +10 -0
- package/dist/interfaces/Comment.d.ts +42 -0
- package/dist/interfaces/Connection.d.ts +67 -0
- package/dist/interfaces/Conversation.d.ts +25 -0
- package/dist/interfaces/ConversationMember.d.ts +16 -0
- package/dist/interfaces/Entity.d.ts +53 -0
- package/dist/interfaces/File.d.ts +39 -0
- package/dist/interfaces/Follow.d.ts +19 -0
- package/dist/interfaces/HostedApp.d.ts +11 -0
- package/dist/interfaces/ImageProcessing.d.ts +62 -0
- package/dist/interfaces/Mention.d.ts +12 -0
- package/dist/interfaces/OAuthIdentity.d.ts +13 -0
- package/dist/interfaces/Project.d.ts +14 -0
- package/dist/interfaces/Reaction.d.ts +23 -0
- package/dist/interfaces/Report.d.ts +32 -0
- package/dist/interfaces/Rule.d.ts +22 -0
- package/dist/interfaces/Space.d.ts +141 -0
- package/dist/interfaces/SpaceMember.d.ts +29 -0
- package/dist/interfaces/User.d.ts +39 -0
- package/dist/modules/app-notifications/countUnreadNotifications.d.ts +2 -0
- package/dist/modules/app-notifications/fetchNotifications.d.ts +8 -0
- package/dist/modules/app-notifications/index.d.ts +4 -0
- package/dist/modules/app-notifications/markAllNotificationsAsRead.d.ts +5 -0
- package/dist/modules/app-notifications/markNotificationAsRead.d.ts +5 -0
- package/dist/modules/auth/changePassword.d.ts +11 -0
- package/dist/modules/auth/index.d.ts +10 -0
- package/dist/modules/auth/requestNewAccessToken.d.ts +16 -0
- package/dist/modules/auth/requestPasswordReset.d.ts +5 -0
- package/dist/modules/auth/resetPassword.d.ts +6 -0
- package/dist/modules/auth/sendVerificationEmail.d.ts +13 -0
- package/dist/modules/auth/signIn.d.ts +12 -0
- package/dist/modules/auth/signOut.d.ts +9 -0
- package/dist/modules/auth/signUp.d.ts +24 -0
- package/dist/modules/auth/verifyEmail.d.ts +5 -0
- package/dist/modules/auth/verifyExternalUser.d.ts +11 -0
- package/dist/modules/chat/addMember.d.ts +8 -0
- package/dist/modules/chat/changeMemberRole.d.ts +9 -0
- package/dist/modules/chat/createDirectConversation.d.ts +7 -0
- package/dist/modules/chat/createGroupConversation.d.ts +10 -0
- package/dist/modules/chat/deleteConversation.d.ts +8 -0
- package/dist/modules/chat/deleteMessage.d.ts +11 -0
- package/dist/modules/chat/editMessage.d.ts +13 -0
- package/dist/modules/chat/getConversation.d.ts +6 -0
- package/dist/modules/chat/getMessage.d.ts +7 -0
- package/dist/modules/chat/getUnreadCount.d.ts +6 -0
- package/dist/modules/chat/index.d.ts +21 -0
- package/dist/modules/chat/leaveConversation.d.ts +7 -0
- package/dist/modules/chat/listConversations.d.ts +17 -0
- package/dist/modules/chat/listMembers.d.ts +10 -0
- package/dist/modules/chat/listMessages.d.ts +23 -0
- package/dist/modules/chat/listReactions.d.ts +23 -0
- package/dist/modules/chat/markAsRead.d.ts +9 -0
- package/dist/modules/chat/removeMember.d.ts +9 -0
- package/dist/modules/chat/reportMessage.d.ts +12 -0
- package/dist/modules/chat/sendMessage.d.ts +21 -0
- package/dist/modules/chat/toggleReaction.d.ts +16 -0
- package/dist/modules/chat/updateConversation.d.ts +12 -0
- package/dist/modules/collections/addEntityToCollection.d.ts +13 -0
- package/dist/modules/collections/createNewCollection.d.ts +8 -0
- package/dist/modules/collections/deleteCollection.d.ts +5 -0
- package/dist/modules/collections/fetchCollectionEntities.d.ts +13 -0
- package/dist/modules/collections/fetchRootCollection.d.ts +3 -0
- package/dist/modules/collections/fetchSubCollections.d.ts +6 -0
- package/dist/modules/collections/index.d.ts +8 -0
- package/dist/modules/collections/removeEntityFromCollection.d.ts +7 -0
- package/dist/modules/collections/updateCollection.d.ts +7 -0
- package/dist/modules/comments/addReaction.d.ts +8 -0
- package/dist/modules/comments/createComment.d.ts +15 -0
- package/dist/modules/comments/deleteComment.d.ts +5 -0
- package/dist/modules/comments/fetchComment.d.ts +3 -1
- package/dist/modules/comments/fetchCommentByForeignId.d.ts +3 -1
- package/dist/modules/comments/fetchManyComments.d.ts +14 -0
- package/dist/modules/comments/fetchReactions.d.ts +15 -0
- package/dist/modules/comments/getUserReaction.d.ts +9 -0
- package/dist/modules/comments/index.d.ts +10 -3
- package/dist/modules/comments/removeReaction.d.ts +6 -0
- package/dist/modules/comments/updateComment.d.ts +7 -0
- package/dist/modules/connections/acceptConnection.d.ts +6 -0
- package/dist/modules/connections/declineConnection.d.ts +6 -0
- package/dist/modules/connections/fetchConnections.d.ts +8 -0
- package/dist/modules/connections/fetchConnectionsCount.d.ts +3 -0
- package/dist/modules/connections/fetchReceivedPendingConnections.d.ts +8 -0
- package/dist/modules/connections/fetchSentPendingConnections.d.ts +8 -0
- package/dist/modules/connections/index.d.ts +7 -0
- package/dist/modules/connections/removeConnection.d.ts +5 -0
- package/dist/modules/entities/addReaction.d.ts +8 -0
- package/dist/modules/entities/createEntity.d.ts +7 -2
- package/dist/modules/entities/deleteEntity.d.ts +1 -1
- package/dist/modules/entities/fetchDrafts.d.ts +11 -0
- package/dist/modules/entities/fetchEntity.d.ts +3 -1
- package/dist/modules/entities/fetchEntityByForeignId.d.ts +3 -1
- package/dist/modules/entities/fetchEntityByShortId.d.ts +3 -1
- package/dist/modules/entities/fetchManyEntities.d.ts +11 -3
- package/dist/modules/entities/fetchReactions.d.ts +15 -0
- package/dist/modules/entities/fetchTopComment.d.ts +6 -0
- package/dist/modules/entities/getUserReaction.d.ts +9 -0
- package/dist/modules/entities/index.d.ts +15 -8
- package/dist/modules/entities/isEntitySaved.d.ts +12 -0
- package/dist/modules/entities/publishDraft.d.ts +6 -0
- package/dist/modules/entities/removeReaction.d.ts +6 -0
- package/dist/modules/entities/updateEntity.d.ts +6 -7
- package/dist/modules/follows/deleteFollow.d.ts +5 -0
- package/dist/modules/follows/fetchFollowers.d.ts +8 -0
- package/dist/modules/follows/fetchFollowersCount.d.ts +5 -0
- package/dist/modules/follows/fetchFollowing.d.ts +8 -0
- package/dist/modules/follows/fetchFollowingCount.d.ts +5 -0
- package/dist/modules/follows/index.d.ts +5 -0
- package/dist/modules/oauth/authorize.d.ts +25 -0
- package/dist/modules/oauth/index.d.ts +4 -0
- package/dist/modules/oauth/linkIdentity.d.ts +14 -0
- package/dist/modules/oauth/listIdentities.d.ts +4 -0
- package/dist/modules/oauth/unlinkIdentity.d.ts +12 -0
- package/dist/modules/reports/createReport.d.ts +9 -0
- package/dist/modules/reports/fetchModeratedReports.d.ts +12 -0
- package/dist/modules/reports/index.d.ts +2 -0
- package/dist/modules/search/askContent.d.ts +51 -0
- package/dist/modules/search/index.d.ts +4 -0
- package/dist/modules/search/searchContent.d.ts +17 -0
- package/dist/modules/search/searchSpaces.d.ts +11 -0
- package/dist/modules/search/searchUsers.d.ts +11 -0
- package/dist/modules/spaces/approveMembership.d.ts +7 -0
- package/dist/modules/spaces/banMember.d.ts +13 -0
- package/dist/modules/spaces/checkMyMembership.d.ts +6 -0
- package/dist/modules/spaces/checkSlugAvailability.d.ts +8 -0
- package/dist/modules/spaces/createRule.d.ts +8 -0
- package/dist/modules/spaces/createSpace.d.ts +13 -0
- package/dist/modules/spaces/declineMembership.d.ts +7 -0
- package/dist/modules/spaces/deleteRule.d.ts +7 -0
- package/dist/modules/spaces/deleteSpace.d.ts +6 -0
- package/dist/modules/spaces/fetchChildSpaces.d.ts +11 -0
- package/dist/modules/spaces/fetchDigestConfig.d.ts +6 -0
- package/dist/modules/spaces/fetchManyRules.d.ts +6 -0
- package/dist/modules/spaces/fetchManySpaces.d.ts +16 -0
- package/dist/modules/spaces/fetchRule.d.ts +7 -0
- package/dist/modules/spaces/fetchSpace.d.ts +6 -0
- package/dist/modules/spaces/fetchSpaceBreadcrumb.d.ts +6 -0
- package/dist/modules/spaces/fetchSpaceByShortId.d.ts +6 -0
- package/dist/modules/spaces/fetchSpaceBySlug.d.ts +6 -0
- package/dist/modules/spaces/fetchSpaceMembers.d.ts +10 -0
- package/dist/modules/spaces/fetchSpaceTeam.d.ts +6 -0
- package/dist/modules/spaces/fetchUserSpaces.d.ts +11 -0
- package/dist/modules/spaces/getSpaceConversation.d.ts +6 -0
- package/dist/modules/spaces/handleCommentReport.d.ts +14 -0
- package/dist/modules/spaces/handleEntityReport.d.ts +17 -0
- package/dist/modules/spaces/handleSpaceChatReport.d.ts +18 -0
- package/dist/modules/spaces/index.d.ts +36 -0
- package/dist/modules/spaces/joinSpace.d.ts +6 -0
- package/dist/modules/spaces/leaveSpace.d.ts +6 -0
- package/dist/modules/spaces/moderateSpaceChatMessage.d.ts +12 -0
- package/dist/modules/spaces/moderateSpaceComment.d.ts +9 -0
- package/dist/modules/spaces/moderateSpaceEntity.d.ts +12 -0
- package/dist/modules/spaces/reorderRules.d.ts +7 -0
- package/dist/modules/spaces/unbanMember.d.ts +13 -0
- package/dist/modules/spaces/updateDigestConfig.d.ts +11 -0
- package/dist/modules/spaces/updateMemberRole.d.ts +8 -0
- package/dist/modules/spaces/updateRule.d.ts +9 -0
- package/dist/modules/spaces/updateSpace.d.ts +12 -0
- package/dist/modules/storage/deleteFile.d.ts +5 -0
- package/dist/modules/storage/getFile.d.ts +34 -0
- package/dist/modules/storage/index.d.ts +4 -0
- package/dist/modules/storage/uploadFile.d.ts +30 -0
- package/dist/modules/storage/uploadImage.d.ts +41 -0
- package/dist/modules/users/checkUsernameAvailability.d.ts +8 -0
- package/dist/modules/users/createFollow.d.ts +7 -0
- package/dist/modules/users/deleteFollow.d.ts +6 -0
- package/dist/modules/users/fetchConnectionStatus.d.ts +10 -0
- package/dist/modules/users/fetchConnectionsByUserId.d.ts +9 -0
- package/dist/modules/users/fetchConnectionsCountByUserId.d.ts +6 -0
- package/dist/modules/users/fetchFollowStatus.d.ts +14 -0
- package/dist/modules/users/fetchFollowersByUserId.d.ts +9 -0
- package/dist/modules/users/fetchFollowersCountByUserId.d.ts +8 -0
- package/dist/modules/users/fetchFollowingByUserId.d.ts +9 -0
- package/dist/modules/users/fetchFollowingCountByUserId.d.ts +8 -0
- package/dist/modules/users/fetchUserByForeignId.d.ts +3 -7
- package/dist/modules/users/fetchUserById.d.ts +3 -1
- package/dist/modules/users/fetchUserByUsername.d.ts +7 -0
- package/dist/modules/users/fetchUserSuggestions.d.ts +6 -0
- package/dist/modules/users/index.d.ts +18 -3
- package/dist/modules/users/removeConnectionByUserId.d.ts +10 -0
- package/dist/modules/users/requestConnection.d.ts +11 -0
- package/dist/modules/users/updateUser.d.ts +32 -0
- package/package.json +10 -7
- package/CLAUDE.md +0 -339
- package/pnpm-workspace.yaml +0 -2
- package/src/core/client.ts +0 -15
- package/src/index.ts +0 -45
- package/src/interfaces/IPaginatedResponse.ts +0 -12
- package/src/modules/comments/fetchComment.ts +0 -14
- package/src/modules/comments/fetchCommentByForeignId.ts +0 -14
- package/src/modules/comments/index.ts +0 -4
- package/src/modules/entities/createEntity.ts +0 -27
- package/src/modules/entities/deleteEntity.ts +0 -14
- package/src/modules/entities/fetchEntity.ts +0 -14
- package/src/modules/entities/fetchEntityByForeignId.ts +0 -15
- package/src/modules/entities/fetchEntityByShortId.ts +0 -14
- package/src/modules/entities/fetchManyEntities.ts +0 -79
- package/src/modules/entities/index.ts +0 -17
- package/src/modules/entities/updateEntity.ts +0 -28
- package/src/modules/users/fetchUserByForeignId.ts +0 -40
- package/src/modules/users/fetchUserById.ts +0 -15
- package/src/modules/users/index.ts +0 -4
- package/tsconfig.json +0 -14
package/dist/index.d.mts
CHANGED
|
@@ -1,33 +1,824 @@
|
|
|
1
1
|
import { AxiosInstance } from 'axios';
|
|
2
2
|
|
|
3
|
+
interface AuthTokens {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
}
|
|
3
7
|
interface ClientConfig {
|
|
4
8
|
projectId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional tokens to hydrate the SDK on init (SDK-managed mode) — e.g. tokens
|
|
11
|
+
* the host app persisted from a previous session.
|
|
12
|
+
*/
|
|
13
|
+
initialTokens?: AuthTokens;
|
|
14
|
+
/**
|
|
15
|
+
* Optional async hook returning the current access token. **Providing it puts
|
|
16
|
+
* the SDK in "host-managed" mode**: the host owns the token and its refresh,
|
|
17
|
+
* and the SDK never stores or refreshes tokens itself.
|
|
18
|
+
*/
|
|
19
|
+
getToken?: () => string | null | undefined | Promise<string | null | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* Called whenever the SDK sets, rotates, or clears tokens (SDK-managed mode
|
|
22
|
+
* only). Receives `null` on sign-out. Use it to persist tokens so a session
|
|
23
|
+
* survives a reload.
|
|
24
|
+
*/
|
|
25
|
+
onAuthChange?: (tokens: AuthTokens | null) => void;
|
|
5
26
|
}
|
|
6
27
|
declare class SublayHttpClient {
|
|
7
|
-
|
|
8
|
-
|
|
28
|
+
projectInstance: AxiosInstance;
|
|
29
|
+
private readonly baseURL;
|
|
30
|
+
private readonly hostManaged;
|
|
31
|
+
private readonly getToken?;
|
|
32
|
+
private readonly onAuthChange?;
|
|
33
|
+
private accessToken;
|
|
34
|
+
private refreshToken;
|
|
35
|
+
/** Shared so concurrent 403s trigger a single refresh (mutex). */
|
|
36
|
+
private refreshPromise;
|
|
37
|
+
constructor({ projectId, initialTokens, getToken, onAuthChange, }: ClientConfig);
|
|
38
|
+
/**
|
|
39
|
+
* The SDK's own in-memory access token (SDK-managed mode). Distinct from the
|
|
40
|
+
* `init({ getToken })` host hook, which supplies a token in host-managed mode.
|
|
41
|
+
*/
|
|
42
|
+
getAccessToken(): string | null;
|
|
43
|
+
getRefreshToken(): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* The `Authorization` header value (`Bearer <token>`) for the active auth
|
|
46
|
+
* mode, or `undefined` if there is no token. Host-managed mode reads the
|
|
47
|
+
* `getToken` hook; SDK-managed mode reads the in-memory access token. Use this
|
|
48
|
+
* for requests that bypass `projectInstance` (e.g. the SSE `askContent`
|
|
49
|
+
* stream, which needs `fetch` rather than axios).
|
|
50
|
+
*/
|
|
51
|
+
getAuthHeader(): Promise<string | undefined>;
|
|
52
|
+
/** Store a full token pair (SDK-managed mode only; no-op when host-managed). */
|
|
53
|
+
setTokens(tokens: AuthTokens): void;
|
|
54
|
+
/** Update just the access token, e.g. after a refresh (no-op when host-managed). */
|
|
55
|
+
setAccessToken(accessToken: string): void;
|
|
56
|
+
/** Clear tokens and notify with null (SDK-managed mode only). */
|
|
57
|
+
clearTokens(): void;
|
|
58
|
+
/**
|
|
59
|
+
* Refresh the access token using the in-memory refresh token. A single shared
|
|
60
|
+
* promise (mutex) means concurrent 403s trigger only one network refresh. The
|
|
61
|
+
* call goes through a bare axios (not `projectInstance`) so it never re-enters
|
|
62
|
+
* the response interceptor. Returns the new access token, or null on failure.
|
|
63
|
+
*/
|
|
64
|
+
private refreshAccessToken;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface FileImageVariant {
|
|
68
|
+
path: string;
|
|
69
|
+
publicPath: string;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
size: number;
|
|
73
|
+
format: string;
|
|
74
|
+
}
|
|
75
|
+
interface FileImage {
|
|
76
|
+
fileId: string;
|
|
77
|
+
originalWidth: number;
|
|
78
|
+
originalHeight: number;
|
|
79
|
+
variants: Record<string, FileImageVariant>;
|
|
80
|
+
processingStatus: "completed" | "failed";
|
|
81
|
+
processingError: string | null;
|
|
82
|
+
format: string;
|
|
83
|
+
quality: number;
|
|
84
|
+
exifStripped: boolean;
|
|
85
|
+
createdAt: string;
|
|
86
|
+
updatedAt: string;
|
|
87
|
+
}
|
|
88
|
+
interface File$1 {
|
|
89
|
+
id: string;
|
|
90
|
+
projectId: string;
|
|
91
|
+
userId: string | null;
|
|
92
|
+
entityId: string | null;
|
|
93
|
+
commentId: string | null;
|
|
94
|
+
chatMessageId: string | null;
|
|
95
|
+
spaceId: string | null;
|
|
96
|
+
type: "image" | "video" | "document" | "other";
|
|
97
|
+
originalPath: string;
|
|
98
|
+
originalSize: number;
|
|
99
|
+
originalMimeType: string;
|
|
100
|
+
position: number;
|
|
101
|
+
metadata: Record<string, any>;
|
|
102
|
+
image?: FileImage;
|
|
103
|
+
createdAt: string;
|
|
104
|
+
updatedAt: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
type UserRole = "admin" | "moderator" | "visitor";
|
|
108
|
+
type UserFull = {
|
|
109
|
+
id: string;
|
|
110
|
+
projectId: string;
|
|
111
|
+
foreignId: string | null;
|
|
112
|
+
role: UserRole;
|
|
113
|
+
email: string | null;
|
|
114
|
+
name: string | null;
|
|
115
|
+
username: string | null;
|
|
116
|
+
avatar: string | null;
|
|
117
|
+
avatarFileId: string | null;
|
|
118
|
+
bannerFileId: string | null;
|
|
119
|
+
avatarFile?: File$1 | null;
|
|
120
|
+
bannerFile?: File$1 | null;
|
|
121
|
+
bio: string | null;
|
|
122
|
+
birthdate: string | null;
|
|
123
|
+
location: {
|
|
124
|
+
type: "Point";
|
|
125
|
+
coordinates: [number, number];
|
|
126
|
+
} | null;
|
|
127
|
+
metadata: Record<string, any>;
|
|
128
|
+
secureMetadata: Record<string, any>;
|
|
129
|
+
reputation: number;
|
|
130
|
+
isVerified: boolean;
|
|
131
|
+
isActive: boolean;
|
|
132
|
+
lastActive: string;
|
|
133
|
+
createdAt: string;
|
|
134
|
+
updatedAt: string;
|
|
135
|
+
};
|
|
136
|
+
type AuthUser = Omit<UserFull, "secureMetadata"> & {
|
|
137
|
+
suspensions: {
|
|
138
|
+
reason: string | null;
|
|
139
|
+
startDate: string;
|
|
140
|
+
endDate: string | null;
|
|
141
|
+
}[];
|
|
142
|
+
authMethods: string[];
|
|
143
|
+
};
|
|
144
|
+
type User = Omit<UserFull, "email" | "secureMetadata" | "isVerified" | "isActive" | "lastActive" | "updatedAt">;
|
|
145
|
+
|
|
146
|
+
interface SignUpProps {
|
|
147
|
+
email: string;
|
|
148
|
+
password: string;
|
|
149
|
+
name?: string;
|
|
150
|
+
username?: string;
|
|
151
|
+
avatar?: string;
|
|
152
|
+
bio?: string;
|
|
153
|
+
location?: {
|
|
154
|
+
latitude: number;
|
|
155
|
+
longitude: number;
|
|
156
|
+
};
|
|
157
|
+
/** ISO 8601 datetime string. */
|
|
158
|
+
birthdate?: string;
|
|
159
|
+
metadata?: Record<string, any>;
|
|
160
|
+
secureMetadata?: Record<string, any>;
|
|
161
|
+
}
|
|
162
|
+
interface SignUpResponse {
|
|
163
|
+
user: AuthUser;
|
|
164
|
+
accessToken: string;
|
|
165
|
+
refreshToken: string;
|
|
166
|
+
}
|
|
167
|
+
declare function signUp(client: SublayHttpClient, data: SignUpProps): Promise<SignUpResponse>;
|
|
168
|
+
|
|
169
|
+
interface SignInProps {
|
|
170
|
+
email: string;
|
|
171
|
+
password: string;
|
|
172
|
+
}
|
|
173
|
+
interface SignInResponse {
|
|
174
|
+
user: AuthUser;
|
|
175
|
+
accessToken: string;
|
|
176
|
+
refreshToken: string;
|
|
177
|
+
}
|
|
178
|
+
declare function signIn(client: SublayHttpClient, data: SignInProps): Promise<SignInResponse>;
|
|
179
|
+
|
|
180
|
+
interface SignOutProps {
|
|
181
|
+
/**
|
|
182
|
+
* Defaults to the SDK's stored refresh token (SDK-managed mode). Pass it
|
|
183
|
+
* explicitly in host-managed mode, where the SDK holds no refresh token.
|
|
184
|
+
*/
|
|
185
|
+
refreshToken?: string;
|
|
186
|
+
}
|
|
187
|
+
declare function signOut(client: SublayHttpClient, data?: SignOutProps): Promise<void>;
|
|
188
|
+
|
|
189
|
+
interface RequestNewAccessTokenProps {
|
|
190
|
+
/** Defaults to the SDK's stored refresh token (SDK-managed mode). */
|
|
191
|
+
refreshToken?: string;
|
|
192
|
+
}
|
|
193
|
+
interface RequestNewAccessTokenResponse {
|
|
194
|
+
accessToken: string;
|
|
195
|
+
/** The server rotates the refresh token on every refresh and returns the new one. */
|
|
196
|
+
refreshToken?: string;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Manually rotate the access token. The SDK auto-refreshes on 403 in
|
|
200
|
+
* SDK-managed mode, so this is rarely needed directly; it's exposed for parity
|
|
201
|
+
* and for host-managed callers that own their own refresh flow.
|
|
202
|
+
*/
|
|
203
|
+
declare function requestNewAccessToken(client: SublayHttpClient, data?: RequestNewAccessTokenProps): Promise<RequestNewAccessTokenResponse>;
|
|
204
|
+
|
|
205
|
+
interface VerifyExternalUserProps {
|
|
206
|
+
userJwt: string;
|
|
207
|
+
}
|
|
208
|
+
interface VerifyExternalUserResponse {
|
|
209
|
+
user: AuthUser;
|
|
210
|
+
accessToken: string;
|
|
211
|
+
refreshToken: string;
|
|
212
|
+
}
|
|
213
|
+
declare function verifyExternalUser(client: SublayHttpClient, data: VerifyExternalUserProps): Promise<VerifyExternalUserResponse>;
|
|
214
|
+
|
|
215
|
+
interface RequestPasswordResetProps {
|
|
216
|
+
email: string;
|
|
217
|
+
}
|
|
218
|
+
declare function requestPasswordReset(client: SublayHttpClient, data: RequestPasswordResetProps): Promise<void>;
|
|
219
|
+
|
|
220
|
+
interface ResetPasswordProps {
|
|
221
|
+
token: string;
|
|
222
|
+
newPassword: string;
|
|
223
|
+
}
|
|
224
|
+
declare function resetPassword(client: SublayHttpClient, data: ResetPasswordProps): Promise<void>;
|
|
225
|
+
|
|
226
|
+
interface ChangePasswordProps {
|
|
227
|
+
/** The user's current password (verified before the change). */
|
|
228
|
+
password: string;
|
|
229
|
+
newPassword: string;
|
|
230
|
+
}
|
|
231
|
+
interface ChangePasswordResponse {
|
|
232
|
+
success: boolean;
|
|
233
|
+
message: string;
|
|
234
|
+
}
|
|
235
|
+
declare function changePassword(client: SublayHttpClient, data: ChangePasswordProps): Promise<ChangePasswordResponse>;
|
|
236
|
+
|
|
237
|
+
interface VerifyEmailProps {
|
|
238
|
+
token: string;
|
|
239
|
+
}
|
|
240
|
+
declare function verifyEmail(client: SublayHttpClient, data: VerifyEmailProps): Promise<void>;
|
|
241
|
+
|
|
242
|
+
interface SendVerificationEmailProps {
|
|
243
|
+
/** "code" emails a short token; "link" emails a verification URL. Defaults to "code". */
|
|
244
|
+
mode?: "code" | "link";
|
|
245
|
+
tokenFormat?: "hex" | "numeric" | "alpha" | "alphanumeric";
|
|
246
|
+
tokenLength?: number;
|
|
247
|
+
/** For mode "link": where to send the user after the link is verified. */
|
|
248
|
+
redirectUrl?: string;
|
|
249
|
+
}
|
|
250
|
+
interface SendVerificationEmailResponse {
|
|
251
|
+
success: boolean;
|
|
252
|
+
}
|
|
253
|
+
declare function sendVerificationEmail(client: SublayHttpClient, data?: SendVerificationEmailProps): Promise<SendVerificationEmailResponse>;
|
|
254
|
+
|
|
255
|
+
declare const Auth_changePassword: typeof changePassword;
|
|
256
|
+
declare const Auth_requestNewAccessToken: typeof requestNewAccessToken;
|
|
257
|
+
declare const Auth_requestPasswordReset: typeof requestPasswordReset;
|
|
258
|
+
declare const Auth_resetPassword: typeof resetPassword;
|
|
259
|
+
declare const Auth_sendVerificationEmail: typeof sendVerificationEmail;
|
|
260
|
+
declare const Auth_signIn: typeof signIn;
|
|
261
|
+
declare const Auth_signOut: typeof signOut;
|
|
262
|
+
declare const Auth_signUp: typeof signUp;
|
|
263
|
+
declare const Auth_verifyEmail: typeof verifyEmail;
|
|
264
|
+
declare const Auth_verifyExternalUser: typeof verifyExternalUser;
|
|
265
|
+
declare namespace Auth {
|
|
266
|
+
export { Auth_changePassword as changePassword, Auth_requestNewAccessToken as requestNewAccessToken, Auth_requestPasswordReset as requestPasswordReset, Auth_resetPassword as resetPassword, Auth_sendVerificationEmail as sendVerificationEmail, Auth_signIn as signIn, Auth_signOut as signOut, Auth_signUp as signUp, Auth_verifyEmail as verifyEmail, Auth_verifyExternalUser as verifyExternalUser };
|
|
9
267
|
}
|
|
10
268
|
|
|
11
269
|
interface FetchUserByIdProps {
|
|
12
270
|
userId: string;
|
|
271
|
+
include?: string;
|
|
13
272
|
}
|
|
14
|
-
declare function fetchUserById(client: SublayHttpClient, data: FetchUserByIdProps): Promise<
|
|
273
|
+
declare function fetchUserById(client: SublayHttpClient, data: FetchUserByIdProps): Promise<User>;
|
|
15
274
|
|
|
16
275
|
interface FetchUserByForeignIdProps {
|
|
17
276
|
foreignId: string;
|
|
277
|
+
include?: string;
|
|
278
|
+
}
|
|
279
|
+
declare function fetchUserByForeignId(client: SublayHttpClient, data: FetchUserByForeignIdProps): Promise<User>;
|
|
280
|
+
|
|
281
|
+
interface FetchUserByUsernameProps {
|
|
282
|
+
username: string;
|
|
283
|
+
include?: string;
|
|
284
|
+
}
|
|
285
|
+
declare function fetchUserByUsername(client: SublayHttpClient, data: FetchUserByUsernameProps): Promise<User>;
|
|
286
|
+
|
|
287
|
+
interface FetchUserSuggestionsProps {
|
|
288
|
+
query: string;
|
|
289
|
+
}
|
|
290
|
+
declare function fetchUserSuggestions(client: SublayHttpClient, data: FetchUserSuggestionsProps): Promise<User[]>;
|
|
291
|
+
|
|
292
|
+
interface CheckUsernameAvailabilityProps {
|
|
293
|
+
username: string;
|
|
294
|
+
}
|
|
295
|
+
interface CheckUsernameAvailabilityResponse {
|
|
296
|
+
available: boolean;
|
|
297
|
+
}
|
|
298
|
+
declare function checkUsernameAvailability(client: SublayHttpClient, data: CheckUsernameAvailabilityProps): Promise<CheckUsernameAvailabilityResponse>;
|
|
299
|
+
|
|
300
|
+
type ImageFit = "cover" | "contain" | "inside" | "outside";
|
|
301
|
+
type ImageFormat = "webp" | "jpeg" | "png" | "original";
|
|
302
|
+
interface BaseImageOptions {
|
|
303
|
+
/** 1–100. Output quality. */
|
|
304
|
+
quality?: number;
|
|
305
|
+
format?: ImageFormat;
|
|
306
|
+
stripExif?: boolean;
|
|
307
|
+
}
|
|
308
|
+
/** Mode 1 — explicit width/height per named variant. */
|
|
309
|
+
interface ExactDimensionsOptions extends BaseImageOptions {
|
|
310
|
+
mode: "exact-dimensions";
|
|
311
|
+
/** Keyed by variant name, e.g. `{ thumbnail: { width, height } }`. 50–10000. */
|
|
312
|
+
dimensions: Record<string, {
|
|
313
|
+
width: number;
|
|
314
|
+
height: number;
|
|
315
|
+
}>;
|
|
316
|
+
fit?: ImageFit;
|
|
317
|
+
}
|
|
318
|
+
/** Mode 2a — fixed aspect ratio, sized by width per variant. */
|
|
319
|
+
interface AspectRatioWidthOptions extends BaseImageOptions {
|
|
320
|
+
mode: "aspect-ratio-width-based";
|
|
321
|
+
aspectRatio: {
|
|
322
|
+
width: number;
|
|
323
|
+
height: number;
|
|
324
|
+
};
|
|
325
|
+
/** Keyed by variant name → target width (50–10000). */
|
|
326
|
+
widths: Record<string, number>;
|
|
327
|
+
fit?: ImageFit;
|
|
328
|
+
}
|
|
329
|
+
/** Mode 2b — fixed aspect ratio, sized by height per variant. */
|
|
330
|
+
interface AspectRatioHeightOptions extends BaseImageOptions {
|
|
331
|
+
mode: "aspect-ratio-height-based";
|
|
332
|
+
aspectRatio: {
|
|
333
|
+
width: number;
|
|
334
|
+
height: number;
|
|
335
|
+
};
|
|
336
|
+
/** Keyed by variant name → target height (50–10000). */
|
|
337
|
+
heights: Record<string, number>;
|
|
338
|
+
fit?: ImageFit;
|
|
339
|
+
}
|
|
340
|
+
/** Mode 3 — preserve the source aspect ratio, bounded per variant. */
|
|
341
|
+
interface OriginalAspectOptions extends BaseImageOptions {
|
|
342
|
+
mode: "original-aspect";
|
|
343
|
+
/** Keyed by variant name → bounding size (50–10000). */
|
|
344
|
+
sizes: Record<string, number>;
|
|
345
|
+
/** Server restricts this mode to `inside` | `outside`. */
|
|
346
|
+
fit?: "inside" | "outside";
|
|
347
|
+
}
|
|
348
|
+
/** Mode 4 — multiple aspect ratios, sized per variant. */
|
|
349
|
+
interface MultiAspectRatioOptions extends BaseImageOptions {
|
|
350
|
+
mode: "multi-aspect-ratio";
|
|
351
|
+
/** 1–10 aspect ratios. */
|
|
352
|
+
aspectRatios: {
|
|
353
|
+
width: number;
|
|
354
|
+
height: number;
|
|
355
|
+
}[];
|
|
356
|
+
/** Keyed by variant name → target size (50–10000). */
|
|
357
|
+
sizes: Record<string, number>;
|
|
358
|
+
fit?: ImageFit;
|
|
359
|
+
}
|
|
360
|
+
type ImageOptions = ExactDimensionsOptions | AspectRatioWidthOptions | AspectRatioHeightOptions | OriginalAspectOptions | MultiAspectRatioOptions;
|
|
361
|
+
|
|
362
|
+
/** A file plus the image-processing options the server requires alongside it. */
|
|
363
|
+
interface UserImageUpload {
|
|
364
|
+
file: Blob | File;
|
|
365
|
+
/** Image-processing config (must include `mode`) — see {@link ImageOptions}. */
|
|
366
|
+
options: ImageOptions;
|
|
367
|
+
}
|
|
368
|
+
interface UpdateUserProps {
|
|
369
|
+
/** The user to update (the target). A user token may only update itself. */
|
|
370
|
+
userId: string;
|
|
18
371
|
name?: string;
|
|
19
372
|
username?: string;
|
|
20
373
|
avatar?: string;
|
|
21
374
|
bio?: string;
|
|
375
|
+
birthdate?: string;
|
|
376
|
+
location?: {
|
|
377
|
+
latitude: number;
|
|
378
|
+
longitude: number;
|
|
379
|
+
} | null;
|
|
22
380
|
metadata?: Record<string, any>;
|
|
23
381
|
secureMetadata?: Record<string, any>;
|
|
382
|
+
/**
|
|
383
|
+
* New avatar image. When present the request is sent as `multipart/form-data`.
|
|
384
|
+
* The server processes the image per `options` and replaces the old avatar.
|
|
385
|
+
*/
|
|
386
|
+
avatarFile?: UserImageUpload;
|
|
387
|
+
/** New banner image; same contract as {@link UpdateUserProps.avatarFile}. */
|
|
388
|
+
bannerFile?: UserImageUpload;
|
|
389
|
+
}
|
|
390
|
+
declare function updateUser(client: SublayHttpClient, data: UpdateUserProps): Promise<AuthUser>;
|
|
391
|
+
|
|
392
|
+
interface Follow {
|
|
393
|
+
id: string;
|
|
394
|
+
projectId: string;
|
|
395
|
+
followerId: string;
|
|
396
|
+
followedId: string;
|
|
397
|
+
createdAt: string;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* An entry in a follower/following list. The list endpoints
|
|
401
|
+
* (`/follows/(followers|following)` and `/users/:userId/(followers|following)`)
|
|
402
|
+
* return the follow id, the populated other user, and when the follow happened
|
|
403
|
+
* — NOT the raw {@link Follow} row.
|
|
404
|
+
*/
|
|
405
|
+
interface FollowListItem {
|
|
406
|
+
followId: string;
|
|
407
|
+
user: User;
|
|
408
|
+
followedAt: string;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
interface PaginationMetadata {
|
|
412
|
+
page: number;
|
|
413
|
+
pageSize: number;
|
|
414
|
+
totalPages: number;
|
|
415
|
+
totalItems: number;
|
|
416
|
+
hasMore: boolean;
|
|
417
|
+
}
|
|
418
|
+
interface PaginatedResponse<T> {
|
|
419
|
+
data: T[];
|
|
420
|
+
pagination: PaginationMetadata;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
interface FetchFollowersByUserIdProps {
|
|
424
|
+
userId: string;
|
|
425
|
+
page?: number;
|
|
426
|
+
limit?: number;
|
|
427
|
+
}
|
|
428
|
+
declare function fetchFollowersByUserId(client: SublayHttpClient, data: FetchFollowersByUserIdProps): Promise<PaginatedResponse<FollowListItem>>;
|
|
429
|
+
|
|
430
|
+
interface FetchFollowersCountByUserIdProps {
|
|
431
|
+
userId: string;
|
|
432
|
+
}
|
|
433
|
+
interface FollowersCountResponse$1 {
|
|
434
|
+
count: number;
|
|
435
|
+
}
|
|
436
|
+
declare function fetchFollowersCountByUserId(client: SublayHttpClient, data: FetchFollowersCountByUserIdProps): Promise<FollowersCountResponse$1>;
|
|
437
|
+
|
|
438
|
+
interface FetchFollowingByUserIdProps {
|
|
439
|
+
userId: string;
|
|
440
|
+
page?: number;
|
|
441
|
+
limit?: number;
|
|
442
|
+
}
|
|
443
|
+
declare function fetchFollowingByUserId(client: SublayHttpClient, data: FetchFollowingByUserIdProps): Promise<PaginatedResponse<FollowListItem>>;
|
|
444
|
+
|
|
445
|
+
interface FetchFollowingCountByUserIdProps {
|
|
446
|
+
userId: string;
|
|
447
|
+
}
|
|
448
|
+
interface FollowingCountResponse$1 {
|
|
449
|
+
count: number;
|
|
450
|
+
}
|
|
451
|
+
declare function fetchFollowingCountByUserId(client: SublayHttpClient, data: FetchFollowingCountByUserIdProps): Promise<FollowingCountResponse$1>;
|
|
452
|
+
|
|
453
|
+
interface Connection {
|
|
454
|
+
id: string;
|
|
455
|
+
message?: string;
|
|
456
|
+
createdAt: string;
|
|
457
|
+
}
|
|
458
|
+
/** Returned by `POST /users/:userId/connection` (requestConnection). */
|
|
459
|
+
interface ConnectionRequestResponse {
|
|
460
|
+
id: string;
|
|
461
|
+
status: string;
|
|
462
|
+
createdAt: string;
|
|
463
|
+
}
|
|
464
|
+
interface EstablishedConnection {
|
|
465
|
+
id: string;
|
|
466
|
+
connectedUser: User;
|
|
467
|
+
connectedAt: string;
|
|
468
|
+
}
|
|
469
|
+
interface PendingConnection extends Connection {
|
|
470
|
+
user: User;
|
|
471
|
+
type: "received" | "sent";
|
|
472
|
+
}
|
|
473
|
+
interface ConnectionActionResponse {
|
|
474
|
+
id: string;
|
|
475
|
+
status: string;
|
|
476
|
+
createdAt?: string;
|
|
477
|
+
respondedAt?: string;
|
|
478
|
+
}
|
|
479
|
+
interface ConnectionCountResponse {
|
|
480
|
+
count: number;
|
|
481
|
+
}
|
|
482
|
+
interface RemoveConnectionByUserIdResponse {
|
|
483
|
+
id?: string;
|
|
484
|
+
status?: string;
|
|
485
|
+
respondedAt?: string;
|
|
486
|
+
message?: string;
|
|
487
|
+
action?: "withdraw" | "disconnect" | "decline";
|
|
488
|
+
}
|
|
489
|
+
interface ConnectionStatusNone {
|
|
490
|
+
status: "none";
|
|
491
|
+
}
|
|
492
|
+
interface ConnectionStatusPending {
|
|
493
|
+
status: "pending";
|
|
494
|
+
type: "sent" | "received";
|
|
495
|
+
connectionId: string;
|
|
496
|
+
createdAt: string;
|
|
497
|
+
}
|
|
498
|
+
interface ConnectionStatusConnected {
|
|
499
|
+
status: "connected";
|
|
500
|
+
connectionId: string;
|
|
501
|
+
connectedAt: string;
|
|
502
|
+
requestedAt: string;
|
|
503
|
+
}
|
|
504
|
+
interface ConnectionStatusDeclined {
|
|
505
|
+
status: "declined";
|
|
506
|
+
type: "sent" | "received";
|
|
507
|
+
connectionId: string;
|
|
508
|
+
respondedAt: string;
|
|
509
|
+
}
|
|
510
|
+
type ConnectionStatusResponse = ConnectionStatusNone | ConnectionStatusPending | ConnectionStatusConnected | ConnectionStatusDeclined;
|
|
511
|
+
|
|
512
|
+
interface FetchConnectionsByUserIdProps {
|
|
513
|
+
userId: string;
|
|
514
|
+
page?: number;
|
|
515
|
+
limit?: number;
|
|
516
|
+
}
|
|
517
|
+
declare function fetchConnectionsByUserId(client: SublayHttpClient, data: FetchConnectionsByUserIdProps): Promise<PaginatedResponse<EstablishedConnection>>;
|
|
518
|
+
|
|
519
|
+
interface FetchConnectionsCountByUserIdProps {
|
|
520
|
+
userId: string;
|
|
521
|
+
}
|
|
522
|
+
declare function fetchConnectionsCountByUserId(client: SublayHttpClient, data: FetchConnectionsCountByUserIdProps): Promise<ConnectionCountResponse>;
|
|
523
|
+
|
|
524
|
+
interface CreateFollowProps {
|
|
525
|
+
/** The user being followed (the target). The follower is the token holder. */
|
|
526
|
+
userId: string;
|
|
527
|
+
}
|
|
528
|
+
declare function createFollow(client: SublayHttpClient, data: CreateFollowProps): Promise<Follow>;
|
|
529
|
+
|
|
530
|
+
interface DeleteFollowProps {
|
|
531
|
+
/** The user being unfollowed (the target). The follower is the token holder. */
|
|
532
|
+
userId: string;
|
|
533
|
+
}
|
|
534
|
+
declare function deleteFollow$1(client: SublayHttpClient, data: DeleteFollowProps): Promise<void>;
|
|
535
|
+
|
|
536
|
+
interface FetchFollowStatusProps {
|
|
537
|
+
/**
|
|
538
|
+
* The user whose follow relationship is being checked (the target). The
|
|
539
|
+
* status is from the perspective of the token holder.
|
|
540
|
+
*/
|
|
541
|
+
userId: string;
|
|
542
|
+
}
|
|
543
|
+
interface FollowStatusResponse {
|
|
544
|
+
isFollowing: boolean;
|
|
545
|
+
followId?: string;
|
|
546
|
+
followedAt?: string;
|
|
547
|
+
}
|
|
548
|
+
declare function fetchFollowStatus(client: SublayHttpClient, data: FetchFollowStatusProps): Promise<FollowStatusResponse>;
|
|
549
|
+
|
|
550
|
+
interface RequestConnectionProps {
|
|
551
|
+
/**
|
|
552
|
+
* The user the connection is requested with (the target). The requester is
|
|
553
|
+
* the token holder.
|
|
554
|
+
*/
|
|
555
|
+
userId: string;
|
|
556
|
+
message?: string;
|
|
557
|
+
}
|
|
558
|
+
declare function requestConnection(client: SublayHttpClient, data: RequestConnectionProps): Promise<ConnectionRequestResponse>;
|
|
559
|
+
|
|
560
|
+
interface FetchConnectionStatusProps {
|
|
561
|
+
/**
|
|
562
|
+
* The other user in the connection (the target). The status is from the
|
|
563
|
+
* perspective of the token holder.
|
|
564
|
+
*/
|
|
565
|
+
userId: string;
|
|
566
|
+
}
|
|
567
|
+
declare function fetchConnectionStatus(client: SublayHttpClient, data: FetchConnectionStatusProps): Promise<ConnectionStatusResponse>;
|
|
568
|
+
|
|
569
|
+
interface RemoveConnectionByUserIdProps {
|
|
570
|
+
/**
|
|
571
|
+
* The other user in the connection (the target). The token holder is the
|
|
572
|
+
* user withdrawing/declining/disconnecting.
|
|
573
|
+
*/
|
|
574
|
+
userId: string;
|
|
24
575
|
}
|
|
25
|
-
declare function
|
|
576
|
+
declare function removeConnectionByUserId(client: SublayHttpClient, data: RemoveConnectionByUserIdProps): Promise<RemoveConnectionByUserIdResponse>;
|
|
26
577
|
|
|
578
|
+
declare const Users_checkUsernameAvailability: typeof checkUsernameAvailability;
|
|
579
|
+
declare const Users_createFollow: typeof createFollow;
|
|
580
|
+
declare const Users_fetchConnectionStatus: typeof fetchConnectionStatus;
|
|
581
|
+
declare const Users_fetchConnectionsByUserId: typeof fetchConnectionsByUserId;
|
|
582
|
+
declare const Users_fetchConnectionsCountByUserId: typeof fetchConnectionsCountByUserId;
|
|
583
|
+
declare const Users_fetchFollowStatus: typeof fetchFollowStatus;
|
|
584
|
+
declare const Users_fetchFollowersByUserId: typeof fetchFollowersByUserId;
|
|
585
|
+
declare const Users_fetchFollowersCountByUserId: typeof fetchFollowersCountByUserId;
|
|
586
|
+
declare const Users_fetchFollowingByUserId: typeof fetchFollowingByUserId;
|
|
587
|
+
declare const Users_fetchFollowingCountByUserId: typeof fetchFollowingCountByUserId;
|
|
27
588
|
declare const Users_fetchUserByForeignId: typeof fetchUserByForeignId;
|
|
28
589
|
declare const Users_fetchUserById: typeof fetchUserById;
|
|
590
|
+
declare const Users_fetchUserByUsername: typeof fetchUserByUsername;
|
|
591
|
+
declare const Users_fetchUserSuggestions: typeof fetchUserSuggestions;
|
|
592
|
+
declare const Users_removeConnectionByUserId: typeof removeConnectionByUserId;
|
|
593
|
+
declare const Users_requestConnection: typeof requestConnection;
|
|
594
|
+
declare const Users_updateUser: typeof updateUser;
|
|
29
595
|
declare namespace Users {
|
|
30
|
-
export { Users_fetchUserByForeignId as fetchUserByForeignId, Users_fetchUserById as fetchUserById };
|
|
596
|
+
export { Users_checkUsernameAvailability as checkUsernameAvailability, Users_createFollow as createFollow, deleteFollow$1 as deleteFollow, Users_fetchConnectionStatus as fetchConnectionStatus, Users_fetchConnectionsByUserId as fetchConnectionsByUserId, Users_fetchConnectionsCountByUserId as fetchConnectionsCountByUserId, Users_fetchFollowStatus as fetchFollowStatus, Users_fetchFollowersByUserId as fetchFollowersByUserId, Users_fetchFollowersCountByUserId as fetchFollowersCountByUserId, Users_fetchFollowingByUserId as fetchFollowingByUserId, Users_fetchFollowingCountByUserId as fetchFollowingCountByUserId, Users_fetchUserByForeignId as fetchUserByForeignId, Users_fetchUserById as fetchUserById, Users_fetchUserByUsername as fetchUserByUsername, Users_fetchUserSuggestions as fetchUserSuggestions, Users_removeConnectionByUserId as removeConnectionByUserId, Users_requestConnection as requestConnection, Users_updateUser as updateUser };
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
type Mention = UserMention | SpaceMention;
|
|
600
|
+
interface UserMention {
|
|
601
|
+
type: "user";
|
|
602
|
+
id: string;
|
|
603
|
+
foreignId?: string | null;
|
|
604
|
+
username: string;
|
|
605
|
+
}
|
|
606
|
+
interface SpaceMention {
|
|
607
|
+
type: "space";
|
|
608
|
+
id: string;
|
|
609
|
+
slug: string;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
type ReadingPermission = "anyone" | "members";
|
|
613
|
+
type PostingPermission = "anyone" | "members" | "admins";
|
|
614
|
+
type SpaceMemberRole = "admin" | "moderator" | "member";
|
|
615
|
+
type SpaceMemberStatus = "pending" | "active" | "banned" | "rejected";
|
|
616
|
+
interface SpaceMemberPermissions {
|
|
617
|
+
isAdmin: boolean;
|
|
618
|
+
isModerator: boolean;
|
|
619
|
+
isMember: boolean;
|
|
620
|
+
status: "pending" | "active" | "banned" | null;
|
|
621
|
+
canPost: boolean;
|
|
622
|
+
canModerate: boolean;
|
|
623
|
+
canRead: boolean;
|
|
624
|
+
}
|
|
625
|
+
interface SpacePreview {
|
|
626
|
+
id: string;
|
|
627
|
+
shortId: string;
|
|
628
|
+
name: string;
|
|
629
|
+
slug: string | null;
|
|
630
|
+
avatarFileId: string | null;
|
|
631
|
+
readingPermission?: ReadingPermission;
|
|
632
|
+
parentSpaceId?: string | null;
|
|
633
|
+
depth?: number;
|
|
634
|
+
avatarFile?: File$1;
|
|
635
|
+
}
|
|
636
|
+
interface Space {
|
|
637
|
+
id: string;
|
|
638
|
+
projectId: string;
|
|
639
|
+
shortId: string;
|
|
640
|
+
slug: string | null;
|
|
641
|
+
name: string;
|
|
642
|
+
description: string | null;
|
|
643
|
+
avatarFileId: string | null;
|
|
644
|
+
bannerFileId: string | null;
|
|
645
|
+
userId: string;
|
|
646
|
+
readingPermission: ReadingPermission;
|
|
647
|
+
postingPermission: PostingPermission;
|
|
648
|
+
requireJoinApproval: boolean;
|
|
649
|
+
parentSpaceId: string | null;
|
|
650
|
+
depth: number;
|
|
651
|
+
metadata: Record<string, any>;
|
|
652
|
+
createdAt: string;
|
|
653
|
+
updatedAt: string;
|
|
654
|
+
deletedAt: string | null;
|
|
655
|
+
membersCount: number;
|
|
656
|
+
childSpacesCount: number;
|
|
657
|
+
isMember?: boolean;
|
|
658
|
+
avatarFile?: File$1;
|
|
659
|
+
bannerFile?: File$1;
|
|
660
|
+
}
|
|
661
|
+
interface SpaceDetailed extends Space {
|
|
662
|
+
memberPermissions: SpaceMemberPermissions | null;
|
|
663
|
+
parentSpace: SpacePreview | null;
|
|
664
|
+
childSpaces: SpacePreview[];
|
|
665
|
+
}
|
|
666
|
+
interface UserSpaceItem {
|
|
667
|
+
space: Space;
|
|
668
|
+
membership: {
|
|
669
|
+
membershipId: string;
|
|
670
|
+
role: SpaceMemberRole;
|
|
671
|
+
status: SpaceMemberStatus;
|
|
672
|
+
joinedAt: string;
|
|
673
|
+
};
|
|
674
|
+
}
|
|
675
|
+
type UserSpacesResponse = PaginatedResponse<UserSpaceItem>;
|
|
676
|
+
interface JoinSpaceResponse {
|
|
677
|
+
message: string;
|
|
678
|
+
membership: {
|
|
679
|
+
id: string;
|
|
680
|
+
spaceId: string;
|
|
681
|
+
userId: string;
|
|
682
|
+
role: "member";
|
|
683
|
+
status: "pending" | "active";
|
|
684
|
+
joinedAt: string;
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
interface LeaveSpaceResponse {
|
|
688
|
+
message: string;
|
|
689
|
+
}
|
|
690
|
+
interface UpdateMemberRoleResponse {
|
|
691
|
+
message: string;
|
|
692
|
+
membership: {
|
|
693
|
+
id: string;
|
|
694
|
+
role: SpaceMemberRole;
|
|
695
|
+
status: string;
|
|
696
|
+
joinedAt: string;
|
|
697
|
+
userId: string;
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
interface ApproveMemberResponse {
|
|
701
|
+
message: string;
|
|
702
|
+
membership: {
|
|
703
|
+
id: string;
|
|
704
|
+
status: "active";
|
|
705
|
+
joinedAt: string;
|
|
706
|
+
};
|
|
707
|
+
}
|
|
708
|
+
interface DeclineMemberResponse {
|
|
709
|
+
message: string;
|
|
710
|
+
membership: {
|
|
711
|
+
id: string;
|
|
712
|
+
status: "rejected";
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
interface CheckMyMembershipResponse {
|
|
716
|
+
isMember: boolean;
|
|
717
|
+
role: "admin" | "moderator" | "member" | null;
|
|
718
|
+
status: "pending" | "active" | "banned" | "rejected" | null;
|
|
719
|
+
joinedAt: string | null;
|
|
720
|
+
permissions: {
|
|
721
|
+
canPost: boolean;
|
|
722
|
+
canModerate: boolean;
|
|
723
|
+
canRead: boolean;
|
|
724
|
+
isAdmin: boolean;
|
|
725
|
+
isModerator: boolean;
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
interface DeleteSpaceResponse {
|
|
729
|
+
message: string;
|
|
730
|
+
deletedSpace: {
|
|
731
|
+
id: string;
|
|
732
|
+
name: string;
|
|
733
|
+
};
|
|
734
|
+
counts: {
|
|
735
|
+
entities: number;
|
|
736
|
+
members: number;
|
|
737
|
+
childSpaces: number;
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
interface DigestConfig {
|
|
741
|
+
digestEnabled: boolean;
|
|
742
|
+
digestWebhookUrl: string | null;
|
|
743
|
+
digestWebhookSecret: string | null;
|
|
744
|
+
digestScheduleHour: number | null;
|
|
745
|
+
digestTimezone: string | null;
|
|
746
|
+
}
|
|
747
|
+
interface SpaceBreadcrumb {
|
|
748
|
+
breadcrumb: SpacePreview[];
|
|
749
|
+
depth: number;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
type ReactionType = "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
|
|
753
|
+
interface ReactionCounts {
|
|
754
|
+
upvote: number;
|
|
755
|
+
downvote: number;
|
|
756
|
+
like: number;
|
|
757
|
+
love: number;
|
|
758
|
+
wow: number;
|
|
759
|
+
sad: number;
|
|
760
|
+
angry: number;
|
|
761
|
+
funny: number;
|
|
762
|
+
}
|
|
763
|
+
interface Reaction {
|
|
764
|
+
id: string;
|
|
765
|
+
projectId: string;
|
|
766
|
+
targetType: "entity" | "comment";
|
|
767
|
+
targetId: string;
|
|
768
|
+
userId: string;
|
|
769
|
+
reactionType: ReactionType;
|
|
770
|
+
createdAt: string;
|
|
771
|
+
updatedAt: string;
|
|
772
|
+
user?: User;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
interface TopComment {
|
|
776
|
+
id: string;
|
|
777
|
+
user: User;
|
|
778
|
+
upvotesCount: number;
|
|
779
|
+
content: string;
|
|
780
|
+
createdAt: string;
|
|
781
|
+
}
|
|
782
|
+
interface Entity {
|
|
783
|
+
id: string;
|
|
784
|
+
foreignId: string | null;
|
|
785
|
+
shortId: string;
|
|
786
|
+
projectId: string;
|
|
787
|
+
sourceId: string | null;
|
|
788
|
+
spaceId: string | null;
|
|
789
|
+
space?: Space | null;
|
|
790
|
+
userId: string | null;
|
|
791
|
+
user?: User | null;
|
|
792
|
+
title: string | null;
|
|
793
|
+
content: string | null;
|
|
794
|
+
mentions: Mention[];
|
|
795
|
+
attachments: Record<string, any>[];
|
|
796
|
+
files?: File$1[];
|
|
797
|
+
keywords: string[];
|
|
798
|
+
upvotes: string[];
|
|
799
|
+
downvotes: string[];
|
|
800
|
+
reactionCounts: ReactionCounts;
|
|
801
|
+
userReaction?: ReactionType | null;
|
|
802
|
+
repliesCount: number;
|
|
803
|
+
views: number;
|
|
804
|
+
score: number;
|
|
805
|
+
scoreUpdatedAt: string;
|
|
806
|
+
location: {
|
|
807
|
+
type: "Point";
|
|
808
|
+
coordinates: [number, number];
|
|
809
|
+
} | null;
|
|
810
|
+
metadata: Record<string, any>;
|
|
811
|
+
topComment: TopComment | null;
|
|
812
|
+
isSaved?: boolean;
|
|
813
|
+
isDraft: boolean | null;
|
|
814
|
+
moderationStatus: "approved" | "removed" | null;
|
|
815
|
+
moderatedAt: string | null;
|
|
816
|
+
moderatedById: string | null;
|
|
817
|
+
moderatedByType: "client" | "user" | null;
|
|
818
|
+
moderationReason: string | null;
|
|
819
|
+
createdAt: string;
|
|
820
|
+
updatedAt: string;
|
|
821
|
+
deletedAt: string | null;
|
|
31
822
|
}
|
|
32
823
|
|
|
33
824
|
interface CreateEntityProps {
|
|
@@ -38,42 +829,36 @@ interface CreateEntityProps {
|
|
|
38
829
|
content?: string;
|
|
39
830
|
attachments?: Record<string, any>[];
|
|
40
831
|
keywords?: string[];
|
|
832
|
+
mentions?: Mention[];
|
|
41
833
|
location?: {
|
|
42
834
|
latitude: number;
|
|
43
835
|
longitude: number;
|
|
44
836
|
};
|
|
45
837
|
metadata?: Record<string, any>;
|
|
46
|
-
|
|
838
|
+
isDraft?: boolean;
|
|
839
|
+
/** Create the entity without attributing it to the logged-in user (authorless). */
|
|
840
|
+
excludeUserId?: boolean;
|
|
47
841
|
}
|
|
48
|
-
declare function createEntity(client: SublayHttpClient, data: CreateEntityProps): Promise<
|
|
842
|
+
declare function createEntity(client: SublayHttpClient, data: CreateEntityProps): Promise<Entity>;
|
|
49
843
|
|
|
50
844
|
interface FetchEntityProps {
|
|
51
845
|
entityId: string;
|
|
846
|
+
include?: string;
|
|
52
847
|
}
|
|
53
|
-
declare function fetchEntity(client: SublayHttpClient, data: FetchEntityProps): Promise<
|
|
848
|
+
declare function fetchEntity(client: SublayHttpClient, data: FetchEntityProps): Promise<Entity>;
|
|
54
849
|
|
|
55
850
|
interface FetchEntityByForeignIdProps {
|
|
56
851
|
foreignId: string;
|
|
57
852
|
createIfNotFound?: boolean;
|
|
853
|
+
include?: string;
|
|
58
854
|
}
|
|
59
|
-
declare function fetchEntityByForeignId(client: SublayHttpClient, data: FetchEntityByForeignIdProps): Promise<
|
|
855
|
+
declare function fetchEntityByForeignId(client: SublayHttpClient, data: FetchEntityByForeignIdProps): Promise<Entity>;
|
|
60
856
|
|
|
61
857
|
interface FetchEntityByShortIdProps {
|
|
62
858
|
shortId: string;
|
|
859
|
+
include?: string;
|
|
63
860
|
}
|
|
64
|
-
declare function fetchEntityByShortId(client: SublayHttpClient, data: FetchEntityByShortIdProps): Promise<
|
|
65
|
-
|
|
66
|
-
interface PaginationMetadata {
|
|
67
|
-
page: number;
|
|
68
|
-
pageSize: number;
|
|
69
|
-
totalPages: number;
|
|
70
|
-
totalItems: number;
|
|
71
|
-
hasMore: boolean;
|
|
72
|
-
}
|
|
73
|
-
interface PaginatedResponse<T> {
|
|
74
|
-
data: T[];
|
|
75
|
-
pagination: PaginationMetadata;
|
|
76
|
-
}
|
|
861
|
+
declare function fetchEntityByShortId(client: SublayHttpClient, data: FetchEntityByShortIdProps): Promise<Entity>;
|
|
77
862
|
|
|
78
863
|
interface KeywordsFilters {
|
|
79
864
|
includes?: string[];
|
|
@@ -83,6 +868,9 @@ interface MetadataFilters {
|
|
|
83
868
|
includes?: {
|
|
84
869
|
[key: string]: any;
|
|
85
870
|
};
|
|
871
|
+
includesAny?: {
|
|
872
|
+
[key: string]: any;
|
|
873
|
+
}[];
|
|
86
874
|
doesNotInclude?: {
|
|
87
875
|
[key: string]: any;
|
|
88
876
|
};
|
|
@@ -105,12 +893,16 @@ interface LocationFilters {
|
|
|
105
893
|
interface FetchManyEntitiesProps {
|
|
106
894
|
sourceId?: string;
|
|
107
895
|
spaceId?: string;
|
|
108
|
-
sortBy?: "hot" | "top" | "controversial";
|
|
896
|
+
sortBy?: "new" | "hot" | "top" | "controversial" | (string & {});
|
|
897
|
+
sortDir?: "asc" | "desc";
|
|
898
|
+
sortType?: "auto" | "numeric" | "text" | "boolean" | "timestamp";
|
|
899
|
+
sortByReaction?: "upvote" | "downvote" | "like" | "love" | "wow" | "sad" | "angry" | "funny";
|
|
109
900
|
page?: number;
|
|
110
901
|
limit?: number;
|
|
902
|
+
include?: string;
|
|
111
903
|
timeFrame?: "hour" | "day" | "week" | "month" | "year";
|
|
112
904
|
userId?: string;
|
|
113
|
-
followedOnly?: "true";
|
|
905
|
+
followedOnly?: "true" | "false";
|
|
114
906
|
keywordsFilters?: KeywordsFilters;
|
|
115
907
|
metadataFilters?: MetadataFilters;
|
|
116
908
|
titleFilters?: TextFilters;
|
|
@@ -122,7 +914,7 @@ interface FetchManyEntitiesProps {
|
|
|
122
914
|
attachmentsFilters?: AttachmentsFilters;
|
|
123
915
|
locationFilters?: LocationFilters;
|
|
124
916
|
}
|
|
125
|
-
declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<
|
|
917
|
+
declare function fetchManyEntities(client: SublayHttpClient, data: FetchManyEntitiesProps): Promise<PaginatedResponse<Entity>>;
|
|
126
918
|
|
|
127
919
|
interface UpdateEntityProps {
|
|
128
920
|
entityId: string;
|
|
@@ -130,48 +922,1707 @@ interface UpdateEntityProps {
|
|
|
130
922
|
content?: string;
|
|
131
923
|
attachments?: Record<string, any>[];
|
|
132
924
|
keywords?: string[];
|
|
925
|
+
mentions?: Mention[];
|
|
133
926
|
location?: {
|
|
134
|
-
|
|
135
|
-
|
|
927
|
+
latitude: number;
|
|
928
|
+
longitude: number;
|
|
136
929
|
};
|
|
137
930
|
metadata?: Record<string, any>;
|
|
138
|
-
mentions?: {
|
|
139
|
-
id: string;
|
|
140
|
-
username: string;
|
|
141
|
-
}[];
|
|
142
931
|
}
|
|
143
|
-
declare function updateEntity(client: SublayHttpClient, data: UpdateEntityProps): Promise<
|
|
932
|
+
declare function updateEntity(client: SublayHttpClient, data: UpdateEntityProps): Promise<Entity>;
|
|
144
933
|
|
|
145
934
|
interface DeleteEntityProps {
|
|
146
935
|
entityId: string;
|
|
147
936
|
}
|
|
148
|
-
declare function deleteEntity(client: SublayHttpClient, data: DeleteEntityProps): Promise<
|
|
937
|
+
declare function deleteEntity(client: SublayHttpClient, data: DeleteEntityProps): Promise<void>;
|
|
938
|
+
|
|
939
|
+
interface FetchDraftsProps {
|
|
940
|
+
page?: number;
|
|
941
|
+
limit?: number;
|
|
942
|
+
sourceId?: string;
|
|
943
|
+
spaceId?: string;
|
|
944
|
+
include?: string;
|
|
945
|
+
}
|
|
946
|
+
declare function fetchDrafts(client: SublayHttpClient, data: FetchDraftsProps): Promise<PaginatedResponse<Entity>>;
|
|
947
|
+
|
|
948
|
+
interface PublishDraftProps {
|
|
949
|
+
entityId: string;
|
|
950
|
+
}
|
|
951
|
+
declare function publishDraft(client: SublayHttpClient, data: PublishDraftProps): Promise<Entity>;
|
|
952
|
+
|
|
953
|
+
interface FetchTopCommentProps {
|
|
954
|
+
entityId: string;
|
|
955
|
+
}
|
|
956
|
+
declare function fetchTopComment(client: SublayHttpClient, data: FetchTopCommentProps): Promise<TopComment | null>;
|
|
957
|
+
|
|
958
|
+
interface AddEntityReactionProps {
|
|
959
|
+
entityId: string;
|
|
960
|
+
reactionType: ReactionType;
|
|
961
|
+
}
|
|
962
|
+
declare function addReaction$1(client: SublayHttpClient, data: AddEntityReactionProps): Promise<Entity>;
|
|
963
|
+
|
|
964
|
+
interface RemoveEntityReactionProps {
|
|
965
|
+
entityId: string;
|
|
966
|
+
}
|
|
967
|
+
declare function removeReaction$1(client: SublayHttpClient, data: RemoveEntityReactionProps): Promise<Entity>;
|
|
968
|
+
|
|
969
|
+
interface FetchEntityReactionsProps {
|
|
970
|
+
entityId: string;
|
|
971
|
+
reactionType?: ReactionType;
|
|
972
|
+
page?: number;
|
|
973
|
+
limit?: number;
|
|
974
|
+
sortDir?: "asc" | "desc";
|
|
975
|
+
}
|
|
976
|
+
interface FetchEntityReactionsResponse {
|
|
977
|
+
data: Reaction[];
|
|
978
|
+
pagination: PaginationMetadata;
|
|
979
|
+
}
|
|
980
|
+
declare function fetchReactions$1(client: SublayHttpClient, data: FetchEntityReactionsProps): Promise<FetchEntityReactionsResponse>;
|
|
981
|
+
|
|
982
|
+
interface GetUserEntityReactionProps {
|
|
983
|
+
entityId: string;
|
|
984
|
+
}
|
|
985
|
+
interface UserReactionResponse {
|
|
986
|
+
reactionType: ReactionType | null;
|
|
987
|
+
}
|
|
988
|
+
declare function getUserReaction$1(client: SublayHttpClient, data: GetUserEntityReactionProps): Promise<UserReactionResponse>;
|
|
989
|
+
|
|
990
|
+
interface IsEntitySavedProps {
|
|
991
|
+
entityId: string;
|
|
992
|
+
}
|
|
993
|
+
interface IsEntitySavedResponse {
|
|
994
|
+
saved: boolean;
|
|
995
|
+
collections: {
|
|
996
|
+
id: string;
|
|
997
|
+
name: string;
|
|
998
|
+
}[];
|
|
999
|
+
}
|
|
1000
|
+
declare function isEntitySaved(client: SublayHttpClient, data: IsEntitySavedProps): Promise<IsEntitySavedResponse>;
|
|
149
1001
|
|
|
150
1002
|
declare const Entities_createEntity: typeof createEntity;
|
|
151
1003
|
declare const Entities_deleteEntity: typeof deleteEntity;
|
|
1004
|
+
declare const Entities_fetchDrafts: typeof fetchDrafts;
|
|
152
1005
|
declare const Entities_fetchEntity: typeof fetchEntity;
|
|
153
1006
|
declare const Entities_fetchEntityByForeignId: typeof fetchEntityByForeignId;
|
|
154
1007
|
declare const Entities_fetchEntityByShortId: typeof fetchEntityByShortId;
|
|
155
1008
|
declare const Entities_fetchManyEntities: typeof fetchManyEntities;
|
|
1009
|
+
declare const Entities_fetchTopComment: typeof fetchTopComment;
|
|
1010
|
+
declare const Entities_isEntitySaved: typeof isEntitySaved;
|
|
1011
|
+
declare const Entities_publishDraft: typeof publishDraft;
|
|
156
1012
|
declare const Entities_updateEntity: typeof updateEntity;
|
|
157
1013
|
declare namespace Entities {
|
|
158
|
-
export { Entities_createEntity as createEntity, Entities_deleteEntity as deleteEntity, Entities_fetchEntity as fetchEntity, Entities_fetchEntityByForeignId as fetchEntityByForeignId, Entities_fetchEntityByShortId as fetchEntityByShortId, Entities_fetchManyEntities as fetchManyEntities, Entities_updateEntity as updateEntity };
|
|
1014
|
+
export { addReaction$1 as addReaction, Entities_createEntity as createEntity, Entities_deleteEntity as deleteEntity, Entities_fetchDrafts as fetchDrafts, Entities_fetchEntity as fetchEntity, Entities_fetchEntityByForeignId as fetchEntityByForeignId, Entities_fetchEntityByShortId as fetchEntityByShortId, Entities_fetchManyEntities as fetchManyEntities, fetchReactions$1 as fetchReactions, Entities_fetchTopComment as fetchTopComment, getUserReaction$1 as getUserReaction, Entities_isEntitySaved as isEntitySaved, Entities_publishDraft as publishDraft, removeReaction$1 as removeReaction, Entities_updateEntity as updateEntity };
|
|
159
1015
|
}
|
|
160
1016
|
|
|
161
|
-
interface
|
|
162
|
-
|
|
1017
|
+
interface GifData {
|
|
1018
|
+
id: string;
|
|
1019
|
+
url: string;
|
|
1020
|
+
gifUrl: string;
|
|
1021
|
+
gifPreviewUrl: string;
|
|
1022
|
+
altText: string;
|
|
1023
|
+
aspectRatio: string;
|
|
163
1024
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
1025
|
+
interface Comment {
|
|
1026
|
+
id: string;
|
|
1027
|
+
projectId: string;
|
|
1028
|
+
foreignId: string | null;
|
|
1029
|
+
entityId: string;
|
|
1030
|
+
entity?: Entity;
|
|
1031
|
+
userId: string;
|
|
1032
|
+
user?: User;
|
|
1033
|
+
parentId: string | null;
|
|
1034
|
+
parentComment?: Comment;
|
|
1035
|
+
content: string | null;
|
|
1036
|
+
gif: GifData | null;
|
|
1037
|
+
mentions: Mention[];
|
|
1038
|
+
upvotes: string[];
|
|
1039
|
+
downvotes: string[];
|
|
1040
|
+
reactionCounts: ReactionCounts;
|
|
1041
|
+
userReaction?: ReactionType | null;
|
|
1042
|
+
repliesCount: number;
|
|
1043
|
+
metadata: Record<string, any>;
|
|
1044
|
+
createdAt: string;
|
|
1045
|
+
updatedAt: string;
|
|
1046
|
+
deletedAt: string | null;
|
|
1047
|
+
parentDeletedAt: string | null;
|
|
1048
|
+
userDeletedAt: string | null;
|
|
1049
|
+
moderationStatus: "approved" | "removed" | null;
|
|
1050
|
+
moderatedAt: string | null;
|
|
1051
|
+
moderatedById: string | null;
|
|
1052
|
+
moderatedByType: "client" | "user" | null;
|
|
1053
|
+
moderationReason: string | null;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
interface CreateCommentProps {
|
|
1057
|
+
entityId: string;
|
|
1058
|
+
foreignId?: string;
|
|
1059
|
+
content?: string;
|
|
1060
|
+
gif?: GifData | null;
|
|
1061
|
+
mentions?: Mention[];
|
|
1062
|
+
parentId?: string | null;
|
|
1063
|
+
referencedCommentId?: string;
|
|
1064
|
+
attachments?: Record<string, any>[];
|
|
1065
|
+
metadata?: Record<string, any>;
|
|
1066
|
+
}
|
|
1067
|
+
declare function createComment(client: SublayHttpClient, data: CreateCommentProps): Promise<Comment>;
|
|
1068
|
+
|
|
1069
|
+
interface FetchCommentProps {
|
|
1070
|
+
commentId: string;
|
|
1071
|
+
include?: string;
|
|
1072
|
+
}
|
|
1073
|
+
declare function fetchComment(client: SublayHttpClient, data: FetchCommentProps): Promise<Comment>;
|
|
1074
|
+
|
|
1075
|
+
interface FetchCommentByForeignIdProps {
|
|
167
1076
|
foreignId: string;
|
|
1077
|
+
include?: string;
|
|
1078
|
+
}
|
|
1079
|
+
declare function fetchCommentByForeignId(client: SublayHttpClient, data: FetchCommentByForeignIdProps): Promise<Comment>;
|
|
1080
|
+
|
|
1081
|
+
interface UpdateCommentProps {
|
|
1082
|
+
commentId: string;
|
|
1083
|
+
content: string;
|
|
1084
|
+
}
|
|
1085
|
+
declare function updateComment(client: SublayHttpClient, data: UpdateCommentProps): Promise<Comment>;
|
|
1086
|
+
|
|
1087
|
+
interface DeleteCommentProps {
|
|
1088
|
+
commentId: string;
|
|
1089
|
+
}
|
|
1090
|
+
declare function deleteComment(client: SublayHttpClient, data: DeleteCommentProps): Promise<void>;
|
|
1091
|
+
|
|
1092
|
+
interface FetchManyCommentsProps {
|
|
1093
|
+
entityId?: string;
|
|
1094
|
+
userId?: string;
|
|
1095
|
+
parentId?: string;
|
|
1096
|
+
page?: number;
|
|
1097
|
+
limit?: number;
|
|
1098
|
+
sortBy?: "new" | "old" | "top" | "controversial";
|
|
1099
|
+
include?: string;
|
|
1100
|
+
sourceId?: string;
|
|
1101
|
+
}
|
|
1102
|
+
declare function fetchManyComments(client: SublayHttpClient, data: FetchManyCommentsProps): Promise<PaginatedResponse<Comment>>;
|
|
1103
|
+
|
|
1104
|
+
interface AddCommentReactionProps {
|
|
1105
|
+
commentId: string;
|
|
1106
|
+
reactionType: ReactionType;
|
|
1107
|
+
}
|
|
1108
|
+
declare function addReaction(client: SublayHttpClient, data: AddCommentReactionProps): Promise<Comment>;
|
|
1109
|
+
|
|
1110
|
+
interface RemoveCommentReactionProps {
|
|
1111
|
+
commentId: string;
|
|
168
1112
|
}
|
|
169
|
-
declare function
|
|
1113
|
+
declare function removeReaction(client: SublayHttpClient, data: RemoveCommentReactionProps): Promise<Comment>;
|
|
170
1114
|
|
|
1115
|
+
interface FetchCommentReactionsProps {
|
|
1116
|
+
commentId: string;
|
|
1117
|
+
reactionType?: ReactionType;
|
|
1118
|
+
page?: number;
|
|
1119
|
+
limit?: number;
|
|
1120
|
+
sortDir?: "asc" | "desc";
|
|
1121
|
+
}
|
|
1122
|
+
interface FetchCommentReactionsResponse {
|
|
1123
|
+
data: Reaction[];
|
|
1124
|
+
pagination: PaginationMetadata;
|
|
1125
|
+
}
|
|
1126
|
+
declare function fetchReactions(client: SublayHttpClient, data: FetchCommentReactionsProps): Promise<FetchCommentReactionsResponse>;
|
|
1127
|
+
|
|
1128
|
+
interface GetUserCommentReactionProps {
|
|
1129
|
+
commentId: string;
|
|
1130
|
+
}
|
|
1131
|
+
interface UserCommentReactionResponse {
|
|
1132
|
+
reactionType: ReactionType | null;
|
|
1133
|
+
}
|
|
1134
|
+
declare function getUserReaction(client: SublayHttpClient, data: GetUserCommentReactionProps): Promise<UserCommentReactionResponse>;
|
|
1135
|
+
|
|
1136
|
+
declare const Comments_addReaction: typeof addReaction;
|
|
1137
|
+
declare const Comments_createComment: typeof createComment;
|
|
1138
|
+
declare const Comments_deleteComment: typeof deleteComment;
|
|
171
1139
|
declare const Comments_fetchComment: typeof fetchComment;
|
|
172
1140
|
declare const Comments_fetchCommentByForeignId: typeof fetchCommentByForeignId;
|
|
1141
|
+
declare const Comments_fetchManyComments: typeof fetchManyComments;
|
|
1142
|
+
declare const Comments_fetchReactions: typeof fetchReactions;
|
|
1143
|
+
declare const Comments_getUserReaction: typeof getUserReaction;
|
|
1144
|
+
declare const Comments_removeReaction: typeof removeReaction;
|
|
1145
|
+
declare const Comments_updateComment: typeof updateComment;
|
|
173
1146
|
declare namespace Comments {
|
|
174
|
-
export { Comments_fetchComment as fetchComment, Comments_fetchCommentByForeignId as fetchCommentByForeignId };
|
|
1147
|
+
export { Comments_addReaction as addReaction, Comments_createComment as createComment, Comments_deleteComment as deleteComment, Comments_fetchComment as fetchComment, Comments_fetchCommentByForeignId as fetchCommentByForeignId, Comments_fetchManyComments as fetchManyComments, Comments_fetchReactions as fetchReactions, Comments_getUserReaction as getUserReaction, Comments_removeReaction as removeReaction, Comments_updateComment as updateComment };
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
interface CreateSpaceProps {
|
|
1151
|
+
name: string;
|
|
1152
|
+
slug?: string;
|
|
1153
|
+
description?: string;
|
|
1154
|
+
readingPermission?: ReadingPermission;
|
|
1155
|
+
postingPermission?: PostingPermission;
|
|
1156
|
+
requireJoinApproval?: boolean;
|
|
1157
|
+
parentSpaceId?: string;
|
|
1158
|
+
metadata?: Record<string, any>;
|
|
1159
|
+
}
|
|
1160
|
+
declare function createSpace(client: SublayHttpClient, data: CreateSpaceProps): Promise<Space>;
|
|
1161
|
+
|
|
1162
|
+
interface FetchManySpacesProps {
|
|
1163
|
+
page?: number;
|
|
1164
|
+
limit?: number;
|
|
1165
|
+
sortBy?: "alphabetical" | "newest" | "members";
|
|
1166
|
+
searchSlug?: string;
|
|
1167
|
+
searchName?: string;
|
|
1168
|
+
searchDescription?: string;
|
|
1169
|
+
searchAny?: string;
|
|
1170
|
+
memberOf?: "true";
|
|
1171
|
+
parentSpaceId?: string | "null";
|
|
1172
|
+
include?: string;
|
|
1173
|
+
}
|
|
1174
|
+
declare function fetchManySpaces(client: SublayHttpClient, data: FetchManySpacesProps): Promise<PaginatedResponse<Space>>;
|
|
1175
|
+
|
|
1176
|
+
interface FetchSpaceProps {
|
|
1177
|
+
spaceId: string;
|
|
1178
|
+
}
|
|
1179
|
+
declare function fetchSpace(client: SublayHttpClient, data: FetchSpaceProps): Promise<SpaceDetailed>;
|
|
1180
|
+
|
|
1181
|
+
interface FetchSpaceByShortIdProps {
|
|
1182
|
+
shortId: string;
|
|
1183
|
+
}
|
|
1184
|
+
declare function fetchSpaceByShortId(client: SublayHttpClient, data: FetchSpaceByShortIdProps): Promise<SpaceDetailed>;
|
|
1185
|
+
|
|
1186
|
+
interface FetchSpaceBySlugProps {
|
|
1187
|
+
slug: string;
|
|
1188
|
+
}
|
|
1189
|
+
declare function fetchSpaceBySlug(client: SublayHttpClient, data: FetchSpaceBySlugProps): Promise<SpaceDetailed>;
|
|
1190
|
+
|
|
1191
|
+
interface FetchUserSpacesProps {
|
|
1192
|
+
page?: number;
|
|
1193
|
+
limit?: number;
|
|
1194
|
+
sortBy?: "alphabetical" | "newest" | "members";
|
|
1195
|
+
include?: string;
|
|
1196
|
+
role?: string;
|
|
1197
|
+
all?: "true" | "false";
|
|
1198
|
+
}
|
|
1199
|
+
declare function fetchUserSpaces(client: SublayHttpClient, data: FetchUserSpacesProps): Promise<UserSpacesResponse>;
|
|
1200
|
+
|
|
1201
|
+
interface CheckSlugAvailabilityProps {
|
|
1202
|
+
slug: string;
|
|
1203
|
+
}
|
|
1204
|
+
interface CheckSlugAvailabilityResponse {
|
|
1205
|
+
available: boolean;
|
|
1206
|
+
}
|
|
1207
|
+
declare function checkSlugAvailability(client: SublayHttpClient, data: CheckSlugAvailabilityProps): Promise<CheckSlugAvailabilityResponse>;
|
|
1208
|
+
|
|
1209
|
+
interface UpdateSpaceProps {
|
|
1210
|
+
spaceId: string;
|
|
1211
|
+
name?: string;
|
|
1212
|
+
slug?: string;
|
|
1213
|
+
description?: string;
|
|
1214
|
+
readingPermission?: ReadingPermission;
|
|
1215
|
+
postingPermission?: PostingPermission;
|
|
1216
|
+
metadata?: Record<string, any>;
|
|
1217
|
+
}
|
|
1218
|
+
declare function updateSpace(client: SublayHttpClient, data: UpdateSpaceProps): Promise<Space>;
|
|
1219
|
+
|
|
1220
|
+
interface DeleteSpaceProps {
|
|
1221
|
+
spaceId: string;
|
|
1222
|
+
}
|
|
1223
|
+
declare function deleteSpace(client: SublayHttpClient, data: DeleteSpaceProps): Promise<DeleteSpaceResponse>;
|
|
1224
|
+
|
|
1225
|
+
interface FetchChildSpacesProps {
|
|
1226
|
+
spaceId: string;
|
|
1227
|
+
page?: number;
|
|
1228
|
+
limit?: number;
|
|
1229
|
+
sortBy?: "alphabetical" | "newest" | "members";
|
|
1230
|
+
include?: string;
|
|
1231
|
+
}
|
|
1232
|
+
declare function fetchChildSpaces(client: SublayHttpClient, data: FetchChildSpacesProps): Promise<PaginatedResponse<Space>>;
|
|
1233
|
+
|
|
1234
|
+
interface FetchSpaceBreadcrumbProps {
|
|
1235
|
+
spaceId: string;
|
|
1236
|
+
}
|
|
1237
|
+
declare function fetchSpaceBreadcrumb(client: SublayHttpClient, data: FetchSpaceBreadcrumbProps): Promise<SpaceBreadcrumb>;
|
|
1238
|
+
|
|
1239
|
+
interface JoinSpaceProps {
|
|
1240
|
+
spaceId: string;
|
|
1241
|
+
}
|
|
1242
|
+
declare function joinSpace(client: SublayHttpClient, data: JoinSpaceProps): Promise<JoinSpaceResponse>;
|
|
1243
|
+
|
|
1244
|
+
interface LeaveSpaceProps {
|
|
1245
|
+
spaceId: string;
|
|
1246
|
+
}
|
|
1247
|
+
declare function leaveSpace(client: SublayHttpClient, data: LeaveSpaceProps): Promise<LeaveSpaceResponse>;
|
|
1248
|
+
|
|
1249
|
+
interface CheckMyMembershipProps {
|
|
1250
|
+
spaceId: string;
|
|
1251
|
+
}
|
|
1252
|
+
declare function checkMyMembership(client: SublayHttpClient, data: CheckMyMembershipProps): Promise<CheckMyMembershipResponse>;
|
|
1253
|
+
|
|
1254
|
+
interface SpaceMemberWithUser {
|
|
1255
|
+
membershipId: string;
|
|
1256
|
+
role: SpaceMemberRole;
|
|
1257
|
+
status: SpaceMemberStatus;
|
|
1258
|
+
joinedAt: string;
|
|
1259
|
+
user: {
|
|
1260
|
+
id: string;
|
|
1261
|
+
username: string;
|
|
1262
|
+
displayName: string;
|
|
1263
|
+
avatar: string;
|
|
1264
|
+
metadata: object;
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
type SpaceMembersResponse = PaginatedResponse<SpaceMemberWithUser>;
|
|
1268
|
+
interface SpaceTeamResponse {
|
|
1269
|
+
data: SpaceMemberWithUser[];
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
interface FetchSpaceMembersProps {
|
|
1273
|
+
spaceId: string;
|
|
1274
|
+
page?: number;
|
|
1275
|
+
limit?: number;
|
|
1276
|
+
role?: "admin" | "moderator" | "member";
|
|
1277
|
+
status?: "pending" | "active" | "banned" | "rejected";
|
|
1278
|
+
}
|
|
1279
|
+
declare function fetchSpaceMembers(client: SublayHttpClient, data: FetchSpaceMembersProps): Promise<SpaceMembersResponse>;
|
|
1280
|
+
|
|
1281
|
+
interface FetchSpaceTeamProps {
|
|
1282
|
+
spaceId: string;
|
|
1283
|
+
}
|
|
1284
|
+
declare function fetchSpaceTeam(client: SublayHttpClient, data: FetchSpaceTeamProps): Promise<SpaceTeamResponse>;
|
|
1285
|
+
|
|
1286
|
+
interface UpdateMemberRoleProps {
|
|
1287
|
+
spaceId: string;
|
|
1288
|
+
memberId: string;
|
|
1289
|
+
role: SpaceMemberRole;
|
|
1290
|
+
}
|
|
1291
|
+
declare function updateMemberRole(client: SublayHttpClient, data: UpdateMemberRoleProps): Promise<UpdateMemberRoleResponse>;
|
|
1292
|
+
|
|
1293
|
+
interface ApproveMembershipProps {
|
|
1294
|
+
spaceId: string;
|
|
1295
|
+
memberId: string;
|
|
1296
|
+
}
|
|
1297
|
+
declare function approveMembership(client: SublayHttpClient, data: ApproveMembershipProps): Promise<ApproveMemberResponse>;
|
|
1298
|
+
|
|
1299
|
+
interface DeclineMembershipProps {
|
|
1300
|
+
spaceId: string;
|
|
1301
|
+
memberId: string;
|
|
1302
|
+
}
|
|
1303
|
+
declare function declineMembership(client: SublayHttpClient, data: DeclineMembershipProps): Promise<DeclineMemberResponse>;
|
|
1304
|
+
|
|
1305
|
+
interface BanMemberProps {
|
|
1306
|
+
spaceId: string;
|
|
1307
|
+
memberId: string;
|
|
1308
|
+
}
|
|
1309
|
+
interface BanMemberResponse {
|
|
1310
|
+
message: string;
|
|
1311
|
+
membership: {
|
|
1312
|
+
id: string;
|
|
1313
|
+
status: "banned";
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
declare function banMember(client: SublayHttpClient, data: BanMemberProps): Promise<BanMemberResponse>;
|
|
1317
|
+
|
|
1318
|
+
interface UnbanMemberProps {
|
|
1319
|
+
spaceId: string;
|
|
1320
|
+
memberId: string;
|
|
1321
|
+
}
|
|
1322
|
+
interface UnbanMemberResponse {
|
|
1323
|
+
message: string;
|
|
1324
|
+
membership: {
|
|
1325
|
+
id: string;
|
|
1326
|
+
status: "active";
|
|
1327
|
+
};
|
|
1328
|
+
}
|
|
1329
|
+
declare function unbanMember(client: SublayHttpClient, data: UnbanMemberProps): Promise<UnbanMemberResponse>;
|
|
1330
|
+
|
|
1331
|
+
interface Rule {
|
|
1332
|
+
id: string;
|
|
1333
|
+
projectId: string;
|
|
1334
|
+
spaceId: string;
|
|
1335
|
+
title: string;
|
|
1336
|
+
description: string | null;
|
|
1337
|
+
order: number;
|
|
1338
|
+
lastApprovedBy: string | null;
|
|
1339
|
+
createdAt: string;
|
|
1340
|
+
updatedAt: string;
|
|
1341
|
+
}
|
|
1342
|
+
interface FetchManyRulesResponse {
|
|
1343
|
+
data: Rule[];
|
|
1344
|
+
count: number;
|
|
1345
|
+
}
|
|
1346
|
+
interface DeleteRuleResponse {
|
|
1347
|
+
message: string;
|
|
1348
|
+
deletedRule: {
|
|
1349
|
+
id: string;
|
|
1350
|
+
title: string;
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
interface FetchManyRulesProps {
|
|
1355
|
+
spaceId: string;
|
|
1356
|
+
}
|
|
1357
|
+
declare function fetchManyRules(client: SublayHttpClient, data: FetchManyRulesProps): Promise<FetchManyRulesResponse>;
|
|
1358
|
+
|
|
1359
|
+
interface FetchRuleProps {
|
|
1360
|
+
spaceId: string;
|
|
1361
|
+
ruleId: string;
|
|
1362
|
+
}
|
|
1363
|
+
declare function fetchRule(client: SublayHttpClient, data: FetchRuleProps): Promise<Rule>;
|
|
1364
|
+
|
|
1365
|
+
interface CreateRuleProps {
|
|
1366
|
+
spaceId: string;
|
|
1367
|
+
title: string;
|
|
1368
|
+
description?: string;
|
|
1369
|
+
}
|
|
1370
|
+
declare function createRule(client: SublayHttpClient, data: CreateRuleProps): Promise<Rule>;
|
|
1371
|
+
|
|
1372
|
+
interface UpdateRuleProps {
|
|
1373
|
+
spaceId: string;
|
|
1374
|
+
ruleId: string;
|
|
1375
|
+
title?: string;
|
|
1376
|
+
description?: string;
|
|
1377
|
+
}
|
|
1378
|
+
declare function updateRule(client: SublayHttpClient, data: UpdateRuleProps): Promise<Rule>;
|
|
1379
|
+
|
|
1380
|
+
interface DeleteRuleProps {
|
|
1381
|
+
spaceId: string;
|
|
1382
|
+
ruleId: string;
|
|
1383
|
+
}
|
|
1384
|
+
declare function deleteRule(client: SublayHttpClient, data: DeleteRuleProps): Promise<DeleteRuleResponse>;
|
|
1385
|
+
|
|
1386
|
+
interface ReorderRulesProps {
|
|
1387
|
+
spaceId: string;
|
|
1388
|
+
ruleIds: string[];
|
|
1389
|
+
}
|
|
1390
|
+
declare function reorderRules(client: SublayHttpClient, data: ReorderRulesProps): Promise<Rule[]>;
|
|
1391
|
+
|
|
1392
|
+
type EntityReportAction = "remove-entity" | "ban-user" | "dismiss";
|
|
1393
|
+
interface HandleEntityReportProps {
|
|
1394
|
+
spaceId: string;
|
|
1395
|
+
reportId: string;
|
|
1396
|
+
entityId: string;
|
|
1397
|
+
actions: EntityReportAction[];
|
|
1398
|
+
summary?: string;
|
|
1399
|
+
reason?: string;
|
|
1400
|
+
/** The user to ban (target), required when actions include "ban-user". */
|
|
1401
|
+
userId?: string;
|
|
1402
|
+
}
|
|
1403
|
+
interface HandleReportResponse {
|
|
1404
|
+
message: string;
|
|
1405
|
+
code: string;
|
|
1406
|
+
}
|
|
1407
|
+
declare function handleEntityReport(client: SublayHttpClient, data: HandleEntityReportProps): Promise<HandleReportResponse>;
|
|
1408
|
+
|
|
1409
|
+
type CommentReportAction = "remove-comment" | "ban-user" | "dismiss";
|
|
1410
|
+
interface HandleCommentReportProps {
|
|
1411
|
+
spaceId: string;
|
|
1412
|
+
reportId: string;
|
|
1413
|
+
commentId: string;
|
|
1414
|
+
actions: CommentReportAction[];
|
|
1415
|
+
summary?: string;
|
|
1416
|
+
reason?: string;
|
|
1417
|
+
/** The user to ban (target), required when actions include "ban-user". */
|
|
1418
|
+
userId?: string;
|
|
1419
|
+
}
|
|
1420
|
+
declare function handleCommentReport(client: SublayHttpClient, data: HandleCommentReportProps): Promise<HandleReportResponse>;
|
|
1421
|
+
|
|
1422
|
+
interface ModerateSpaceEntityProps {
|
|
1423
|
+
spaceId: string;
|
|
1424
|
+
entityId: string;
|
|
1425
|
+
action: "approve" | "remove";
|
|
1426
|
+
reason?: string;
|
|
1427
|
+
}
|
|
1428
|
+
interface ModerationResponse {
|
|
1429
|
+
message: string;
|
|
1430
|
+
moderationStatus: "approved" | "removed";
|
|
1431
|
+
}
|
|
1432
|
+
declare function moderateSpaceEntity(client: SublayHttpClient, data: ModerateSpaceEntityProps): Promise<ModerationResponse>;
|
|
1433
|
+
|
|
1434
|
+
interface ModerateSpaceCommentProps {
|
|
1435
|
+
spaceId: string;
|
|
1436
|
+
commentId: string;
|
|
1437
|
+
action: "approve" | "remove";
|
|
1438
|
+
reason?: string;
|
|
1439
|
+
}
|
|
1440
|
+
declare function moderateSpaceComment(client: SublayHttpClient, data: ModerateSpaceCommentProps): Promise<ModerationResponse>;
|
|
1441
|
+
|
|
1442
|
+
interface FetchDigestConfigProps {
|
|
1443
|
+
spaceId: string;
|
|
1444
|
+
}
|
|
1445
|
+
declare function fetchDigestConfig(client: SublayHttpClient, data: FetchDigestConfigProps): Promise<DigestConfig>;
|
|
1446
|
+
|
|
1447
|
+
interface UpdateDigestConfigProps {
|
|
1448
|
+
spaceId: string;
|
|
1449
|
+
digestEnabled?: boolean;
|
|
1450
|
+
digestWebhookUrl?: string;
|
|
1451
|
+
digestWebhookSecret?: string;
|
|
1452
|
+
digestScheduleHour?: number;
|
|
1453
|
+
digestTimezone?: string;
|
|
1454
|
+
}
|
|
1455
|
+
declare function updateDigestConfig(client: SublayHttpClient, data: UpdateDigestConfigProps): Promise<DigestConfig>;
|
|
1456
|
+
|
|
1457
|
+
interface ChatMessage {
|
|
1458
|
+
id: string;
|
|
1459
|
+
projectId: string;
|
|
1460
|
+
conversationId: string;
|
|
1461
|
+
userId: string | null;
|
|
1462
|
+
content: string | null;
|
|
1463
|
+
gif: GifData | null;
|
|
1464
|
+
mentions: Mention[];
|
|
1465
|
+
files?: File$1[];
|
|
1466
|
+
metadata: Record<string, any>;
|
|
1467
|
+
parentMessageId: string | null;
|
|
1468
|
+
quotedMessageId: string | null;
|
|
1469
|
+
threadReplyCount: number;
|
|
1470
|
+
reactionCounts: Record<string, number>;
|
|
1471
|
+
userReactions: string[];
|
|
1472
|
+
editedAt: string | null;
|
|
1473
|
+
userDeletedAt: string | null;
|
|
1474
|
+
moderationStatus: "approved" | "removed" | null;
|
|
1475
|
+
moderatedAt: string | null;
|
|
1476
|
+
moderatedById: string | null;
|
|
1477
|
+
moderatedByType: "client" | "user" | null;
|
|
1478
|
+
moderationReason: string | null;
|
|
1479
|
+
createdAt: string;
|
|
1480
|
+
updatedAt: string;
|
|
1481
|
+
user: User | null;
|
|
1482
|
+
quotedMessage?: ChatMessage | null;
|
|
1483
|
+
parentMessage?: ChatMessage | null;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1486
|
+
type ConversationMemberRole = "admin" | "member";
|
|
1487
|
+
interface ConversationMember {
|
|
1488
|
+
id: string;
|
|
1489
|
+
projectId: string;
|
|
1490
|
+
conversationId: string;
|
|
1491
|
+
userId: string;
|
|
1492
|
+
role: ConversationMemberRole | null;
|
|
1493
|
+
lastReadAt: string | null;
|
|
1494
|
+
mutedUntil: string | null;
|
|
1495
|
+
isActive: boolean;
|
|
1496
|
+
leftAt: string | null;
|
|
1497
|
+
createdAt: string;
|
|
1498
|
+
updatedAt: string;
|
|
1499
|
+
user?: User;
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
interface Conversation {
|
|
1503
|
+
id: string;
|
|
1504
|
+
projectId: string;
|
|
1505
|
+
type: "direct" | "group" | "space";
|
|
1506
|
+
name: string | null;
|
|
1507
|
+
description: string | null;
|
|
1508
|
+
spaceId: string | null;
|
|
1509
|
+
createdById: string | null;
|
|
1510
|
+
avatarFileId: string | null;
|
|
1511
|
+
lastMessageAt: string | null;
|
|
1512
|
+
postingPermission: "members" | "admins" | null;
|
|
1513
|
+
metadata: Record<string, any>;
|
|
1514
|
+
createdAt: string;
|
|
1515
|
+
updatedAt: string;
|
|
1516
|
+
memberCount?: number;
|
|
1517
|
+
currentMember?: ConversationMember;
|
|
1518
|
+
avatarFile?: File$1;
|
|
1519
|
+
}
|
|
1520
|
+
interface ConversationPreview extends Conversation {
|
|
1521
|
+
unreadCount: number;
|
|
1522
|
+
lastMessage: ChatMessage | null;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
interface GetSpaceConversationProps {
|
|
1526
|
+
spaceId: string;
|
|
1527
|
+
}
|
|
1528
|
+
declare function getSpaceConversation(client: SublayHttpClient, data: GetSpaceConversationProps): Promise<Conversation>;
|
|
1529
|
+
|
|
1530
|
+
interface ModerateSpaceChatMessageProps {
|
|
1531
|
+
spaceId: string;
|
|
1532
|
+
messageId: string;
|
|
1533
|
+
moderationStatus: "removed";
|
|
1534
|
+
moderationReason?: string;
|
|
1535
|
+
}
|
|
1536
|
+
interface ModerateSpaceChatMessageResponse {
|
|
1537
|
+
message: string;
|
|
1538
|
+
moderationStatus: string;
|
|
1539
|
+
}
|
|
1540
|
+
declare function moderateSpaceChatMessage(client: SublayHttpClient, data: ModerateSpaceChatMessageProps): Promise<ModerateSpaceChatMessageResponse>;
|
|
1541
|
+
|
|
1542
|
+
type SpaceChatReportAction = "remove-message" | "ban-user" | "dismiss";
|
|
1543
|
+
interface HandleSpaceChatReportProps {
|
|
1544
|
+
spaceId: string;
|
|
1545
|
+
reportId: string;
|
|
1546
|
+
actions: SpaceChatReportAction[];
|
|
1547
|
+
summary?: string;
|
|
1548
|
+
/** The user to ban (target), required when actions include "ban-user". */
|
|
1549
|
+
userId?: string;
|
|
1550
|
+
reason?: string;
|
|
1551
|
+
/** The message to remove, required when actions include "remove-message". */
|
|
1552
|
+
messageId?: string;
|
|
1553
|
+
}
|
|
1554
|
+
interface HandleSpaceChatReportResponse {
|
|
1555
|
+
message: string;
|
|
1556
|
+
code: string;
|
|
1557
|
+
}
|
|
1558
|
+
declare function handleSpaceChatReport(client: SublayHttpClient, data: HandleSpaceChatReportProps): Promise<HandleSpaceChatReportResponse>;
|
|
1559
|
+
|
|
1560
|
+
declare const Spaces_approveMembership: typeof approveMembership;
|
|
1561
|
+
declare const Spaces_banMember: typeof banMember;
|
|
1562
|
+
declare const Spaces_checkMyMembership: typeof checkMyMembership;
|
|
1563
|
+
declare const Spaces_checkSlugAvailability: typeof checkSlugAvailability;
|
|
1564
|
+
declare const Spaces_createRule: typeof createRule;
|
|
1565
|
+
declare const Spaces_createSpace: typeof createSpace;
|
|
1566
|
+
declare const Spaces_declineMembership: typeof declineMembership;
|
|
1567
|
+
declare const Spaces_deleteRule: typeof deleteRule;
|
|
1568
|
+
declare const Spaces_deleteSpace: typeof deleteSpace;
|
|
1569
|
+
declare const Spaces_fetchChildSpaces: typeof fetchChildSpaces;
|
|
1570
|
+
declare const Spaces_fetchDigestConfig: typeof fetchDigestConfig;
|
|
1571
|
+
declare const Spaces_fetchManyRules: typeof fetchManyRules;
|
|
1572
|
+
declare const Spaces_fetchManySpaces: typeof fetchManySpaces;
|
|
1573
|
+
declare const Spaces_fetchRule: typeof fetchRule;
|
|
1574
|
+
declare const Spaces_fetchSpace: typeof fetchSpace;
|
|
1575
|
+
declare const Spaces_fetchSpaceBreadcrumb: typeof fetchSpaceBreadcrumb;
|
|
1576
|
+
declare const Spaces_fetchSpaceByShortId: typeof fetchSpaceByShortId;
|
|
1577
|
+
declare const Spaces_fetchSpaceBySlug: typeof fetchSpaceBySlug;
|
|
1578
|
+
declare const Spaces_fetchSpaceMembers: typeof fetchSpaceMembers;
|
|
1579
|
+
declare const Spaces_fetchSpaceTeam: typeof fetchSpaceTeam;
|
|
1580
|
+
declare const Spaces_fetchUserSpaces: typeof fetchUserSpaces;
|
|
1581
|
+
declare const Spaces_getSpaceConversation: typeof getSpaceConversation;
|
|
1582
|
+
declare const Spaces_handleCommentReport: typeof handleCommentReport;
|
|
1583
|
+
declare const Spaces_handleEntityReport: typeof handleEntityReport;
|
|
1584
|
+
declare const Spaces_handleSpaceChatReport: typeof handleSpaceChatReport;
|
|
1585
|
+
declare const Spaces_joinSpace: typeof joinSpace;
|
|
1586
|
+
declare const Spaces_leaveSpace: typeof leaveSpace;
|
|
1587
|
+
declare const Spaces_moderateSpaceChatMessage: typeof moderateSpaceChatMessage;
|
|
1588
|
+
declare const Spaces_moderateSpaceComment: typeof moderateSpaceComment;
|
|
1589
|
+
declare const Spaces_moderateSpaceEntity: typeof moderateSpaceEntity;
|
|
1590
|
+
declare const Spaces_reorderRules: typeof reorderRules;
|
|
1591
|
+
declare const Spaces_unbanMember: typeof unbanMember;
|
|
1592
|
+
declare const Spaces_updateDigestConfig: typeof updateDigestConfig;
|
|
1593
|
+
declare const Spaces_updateMemberRole: typeof updateMemberRole;
|
|
1594
|
+
declare const Spaces_updateRule: typeof updateRule;
|
|
1595
|
+
declare const Spaces_updateSpace: typeof updateSpace;
|
|
1596
|
+
declare namespace Spaces {
|
|
1597
|
+
export { Spaces_approveMembership as approveMembership, Spaces_banMember as banMember, Spaces_checkMyMembership as checkMyMembership, Spaces_checkSlugAvailability as checkSlugAvailability, Spaces_createRule as createRule, Spaces_createSpace as createSpace, Spaces_declineMembership as declineMembership, Spaces_deleteRule as deleteRule, Spaces_deleteSpace as deleteSpace, Spaces_fetchChildSpaces as fetchChildSpaces, Spaces_fetchDigestConfig as fetchDigestConfig, Spaces_fetchManyRules as fetchManyRules, Spaces_fetchManySpaces as fetchManySpaces, Spaces_fetchRule as fetchRule, Spaces_fetchSpace as fetchSpace, Spaces_fetchSpaceBreadcrumb as fetchSpaceBreadcrumb, Spaces_fetchSpaceByShortId as fetchSpaceByShortId, Spaces_fetchSpaceBySlug as fetchSpaceBySlug, Spaces_fetchSpaceMembers as fetchSpaceMembers, Spaces_fetchSpaceTeam as fetchSpaceTeam, Spaces_fetchUserSpaces as fetchUserSpaces, Spaces_getSpaceConversation as getSpaceConversation, Spaces_handleCommentReport as handleCommentReport, Spaces_handleEntityReport as handleEntityReport, Spaces_handleSpaceChatReport as handleSpaceChatReport, Spaces_joinSpace as joinSpace, Spaces_leaveSpace as leaveSpace, Spaces_moderateSpaceChatMessage as moderateSpaceChatMessage, Spaces_moderateSpaceComment as moderateSpaceComment, Spaces_moderateSpaceEntity as moderateSpaceEntity, Spaces_reorderRules as reorderRules, Spaces_unbanMember as unbanMember, Spaces_updateDigestConfig as updateDigestConfig, Spaces_updateMemberRole as updateMemberRole, Spaces_updateRule as updateRule, Spaces_updateSpace as updateSpace };
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
interface Collection {
|
|
1601
|
+
id: string;
|
|
1602
|
+
projectId: string;
|
|
1603
|
+
userId: string;
|
|
1604
|
+
parentId: string | null;
|
|
1605
|
+
name: string;
|
|
1606
|
+
entityCount: number;
|
|
1607
|
+
createdAt: string;
|
|
1608
|
+
updatedAt: string;
|
|
1609
|
+
}
|
|
1610
|
+
|
|
1611
|
+
declare function fetchRootCollection(client: SublayHttpClient): Promise<Collection>;
|
|
1612
|
+
|
|
1613
|
+
interface FetchSubCollectionsProps {
|
|
1614
|
+
collectionId: string;
|
|
1615
|
+
}
|
|
1616
|
+
declare function fetchSubCollections(client: SublayHttpClient, data: FetchSubCollectionsProps): Promise<Collection[]>;
|
|
1617
|
+
|
|
1618
|
+
interface CreateNewCollectionProps {
|
|
1619
|
+
/** The parent collection under which to create the sub-collection. */
|
|
1620
|
+
collectionId: string;
|
|
1621
|
+
collectionName: string;
|
|
1622
|
+
}
|
|
1623
|
+
declare function createNewCollection(client: SublayHttpClient, data: CreateNewCollectionProps): Promise<Collection>;
|
|
1624
|
+
|
|
1625
|
+
interface FetchCollectionEntitiesProps {
|
|
1626
|
+
collectionId: string;
|
|
1627
|
+
page?: number;
|
|
1628
|
+
limit?: number;
|
|
1629
|
+
sortBy?: "new" | "added" | "top" | "hot";
|
|
1630
|
+
sortDir?: "asc" | "desc";
|
|
1631
|
+
/** Comma-separated list of associations to populate, e.g. "user". */
|
|
1632
|
+
include?: string;
|
|
1633
|
+
}
|
|
1634
|
+
declare function fetchCollectionEntities(client: SublayHttpClient, data: FetchCollectionEntitiesProps): Promise<PaginatedResponse<Entity>>;
|
|
1635
|
+
|
|
1636
|
+
interface AddEntityToCollectionProps {
|
|
1637
|
+
collectionId: string;
|
|
1638
|
+
entityId: string;
|
|
1639
|
+
}
|
|
1640
|
+
interface CollectionEntityMutationResponse {
|
|
1641
|
+
success: boolean;
|
|
1642
|
+
collection: {
|
|
1643
|
+
id: string;
|
|
1644
|
+
entityCount: number;
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1647
|
+
declare function addEntityToCollection(client: SublayHttpClient, data: AddEntityToCollectionProps): Promise<CollectionEntityMutationResponse>;
|
|
1648
|
+
|
|
1649
|
+
interface RemoveEntityFromCollectionProps {
|
|
1650
|
+
collectionId: string;
|
|
1651
|
+
entityId: string;
|
|
1652
|
+
}
|
|
1653
|
+
declare function removeEntityFromCollection(client: SublayHttpClient, data: RemoveEntityFromCollectionProps): Promise<CollectionEntityMutationResponse>;
|
|
1654
|
+
|
|
1655
|
+
interface UpdateCollectionProps {
|
|
1656
|
+
collectionId: string;
|
|
1657
|
+
name?: string;
|
|
1658
|
+
}
|
|
1659
|
+
declare function updateCollection(client: SublayHttpClient, data: UpdateCollectionProps): Promise<Collection>;
|
|
1660
|
+
|
|
1661
|
+
interface DeleteCollectionProps {
|
|
1662
|
+
collectionId: string;
|
|
1663
|
+
}
|
|
1664
|
+
declare function deleteCollection(client: SublayHttpClient, data: DeleteCollectionProps): Promise<void>;
|
|
1665
|
+
|
|
1666
|
+
declare const Collections_addEntityToCollection: typeof addEntityToCollection;
|
|
1667
|
+
declare const Collections_createNewCollection: typeof createNewCollection;
|
|
1668
|
+
declare const Collections_deleteCollection: typeof deleteCollection;
|
|
1669
|
+
declare const Collections_fetchCollectionEntities: typeof fetchCollectionEntities;
|
|
1670
|
+
declare const Collections_fetchRootCollection: typeof fetchRootCollection;
|
|
1671
|
+
declare const Collections_fetchSubCollections: typeof fetchSubCollections;
|
|
1672
|
+
declare const Collections_removeEntityFromCollection: typeof removeEntityFromCollection;
|
|
1673
|
+
declare const Collections_updateCollection: typeof updateCollection;
|
|
1674
|
+
declare namespace Collections {
|
|
1675
|
+
export { Collections_addEntityToCollection as addEntityToCollection, Collections_createNewCollection as createNewCollection, Collections_deleteCollection as deleteCollection, Collections_fetchCollectionEntities as fetchCollectionEntities, Collections_fetchRootCollection as fetchRootCollection, Collections_fetchSubCollections as fetchSubCollections, Collections_removeEntityFromCollection as removeEntityFromCollection, Collections_updateCollection as updateCollection };
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
interface FetchFollowingProps {
|
|
1679
|
+
page?: number;
|
|
1680
|
+
limit?: number;
|
|
1681
|
+
}
|
|
1682
|
+
declare function fetchFollowing(client: SublayHttpClient, data: FetchFollowingProps): Promise<PaginatedResponse<FollowListItem>>;
|
|
1683
|
+
|
|
1684
|
+
interface FetchFollowersProps {
|
|
1685
|
+
page?: number;
|
|
1686
|
+
limit?: number;
|
|
1687
|
+
}
|
|
1688
|
+
declare function fetchFollowers(client: SublayHttpClient, data: FetchFollowersProps): Promise<PaginatedResponse<FollowListItem>>;
|
|
1689
|
+
|
|
1690
|
+
interface FollowingCountResponse {
|
|
1691
|
+
count: number;
|
|
1692
|
+
}
|
|
1693
|
+
declare function fetchFollowingCount(client: SublayHttpClient): Promise<FollowingCountResponse>;
|
|
1694
|
+
|
|
1695
|
+
interface FollowersCountResponse {
|
|
1696
|
+
count: number;
|
|
1697
|
+
}
|
|
1698
|
+
declare function fetchFollowersCount(client: SublayHttpClient): Promise<FollowersCountResponse>;
|
|
1699
|
+
|
|
1700
|
+
interface DeleteFollowByIdProps {
|
|
1701
|
+
followId: string;
|
|
1702
|
+
}
|
|
1703
|
+
declare function deleteFollow(client: SublayHttpClient, data: DeleteFollowByIdProps): Promise<void>;
|
|
1704
|
+
|
|
1705
|
+
declare const Follows_deleteFollow: typeof deleteFollow;
|
|
1706
|
+
declare const Follows_fetchFollowers: typeof fetchFollowers;
|
|
1707
|
+
declare const Follows_fetchFollowersCount: typeof fetchFollowersCount;
|
|
1708
|
+
declare const Follows_fetchFollowing: typeof fetchFollowing;
|
|
1709
|
+
declare const Follows_fetchFollowingCount: typeof fetchFollowingCount;
|
|
1710
|
+
declare namespace Follows {
|
|
1711
|
+
export { Follows_deleteFollow as deleteFollow, Follows_fetchFollowers as fetchFollowers, Follows_fetchFollowersCount as fetchFollowersCount, Follows_fetchFollowing as fetchFollowing, Follows_fetchFollowingCount as fetchFollowingCount };
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
interface FetchConnectionsProps {
|
|
1715
|
+
page?: number;
|
|
1716
|
+
limit?: number;
|
|
1717
|
+
}
|
|
1718
|
+
declare function fetchConnections(client: SublayHttpClient, data: FetchConnectionsProps): Promise<PaginatedResponse<EstablishedConnection>>;
|
|
1719
|
+
|
|
1720
|
+
declare function fetchConnectionsCount(client: SublayHttpClient): Promise<ConnectionCountResponse>;
|
|
1721
|
+
|
|
1722
|
+
interface FetchSentPendingConnectionsProps {
|
|
1723
|
+
page?: number;
|
|
1724
|
+
limit?: number;
|
|
1725
|
+
}
|
|
1726
|
+
declare function fetchSentPendingConnections(client: SublayHttpClient, data: FetchSentPendingConnectionsProps): Promise<PaginatedResponse<PendingConnection>>;
|
|
1727
|
+
|
|
1728
|
+
interface FetchReceivedPendingConnectionsProps {
|
|
1729
|
+
page?: number;
|
|
1730
|
+
limit?: number;
|
|
1731
|
+
}
|
|
1732
|
+
declare function fetchReceivedPendingConnections(client: SublayHttpClient, data: FetchReceivedPendingConnectionsProps): Promise<PaginatedResponse<PendingConnection>>;
|
|
1733
|
+
|
|
1734
|
+
interface AcceptConnectionProps {
|
|
1735
|
+
connectionId: string;
|
|
1736
|
+
}
|
|
1737
|
+
declare function acceptConnection(client: SublayHttpClient, data: AcceptConnectionProps): Promise<ConnectionActionResponse>;
|
|
1738
|
+
|
|
1739
|
+
interface DeclineConnectionProps {
|
|
1740
|
+
connectionId: string;
|
|
1741
|
+
}
|
|
1742
|
+
declare function declineConnection(client: SublayHttpClient, data: DeclineConnectionProps): Promise<ConnectionActionResponse>;
|
|
1743
|
+
|
|
1744
|
+
interface RemoveConnectionProps {
|
|
1745
|
+
connectionId: string;
|
|
1746
|
+
}
|
|
1747
|
+
declare function removeConnection(client: SublayHttpClient, data: RemoveConnectionProps): Promise<void>;
|
|
1748
|
+
|
|
1749
|
+
declare const Connections_acceptConnection: typeof acceptConnection;
|
|
1750
|
+
declare const Connections_declineConnection: typeof declineConnection;
|
|
1751
|
+
declare const Connections_fetchConnections: typeof fetchConnections;
|
|
1752
|
+
declare const Connections_fetchConnectionsCount: typeof fetchConnectionsCount;
|
|
1753
|
+
declare const Connections_fetchReceivedPendingConnections: typeof fetchReceivedPendingConnections;
|
|
1754
|
+
declare const Connections_fetchSentPendingConnections: typeof fetchSentPendingConnections;
|
|
1755
|
+
declare const Connections_removeConnection: typeof removeConnection;
|
|
1756
|
+
declare namespace Connections {
|
|
1757
|
+
export { Connections_acceptConnection as acceptConnection, Connections_declineConnection as declineConnection, Connections_fetchConnections as fetchConnections, Connections_fetchConnectionsCount as fetchConnectionsCount, Connections_fetchReceivedPendingConnections as fetchReceivedPendingConnections, Connections_fetchSentPendingConnections as fetchSentPendingConnections, Connections_removeConnection as removeConnection };
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
type AppNotificationType = "system" | "entity-comment" | "comment-reply" | "entity-mention" | "comment-mention" | "entity-upvote" | "comment-upvote" | "entity-reaction" | "comment-reaction" | "entity-reaction-milestone-specific" | "entity-reaction-milestone-total" | "comment-reaction-milestone-specific" | "comment-reaction-milestone-total" | "new-follow" | "connection-request" | "connection-accepted" | "space-membership-approved";
|
|
1761
|
+
interface BaseAppNotification {
|
|
1762
|
+
id: string;
|
|
1763
|
+
userId: string;
|
|
1764
|
+
type: AppNotificationType;
|
|
1765
|
+
isRead: boolean;
|
|
1766
|
+
metadata: Record<string, any>;
|
|
1767
|
+
createdAt: string;
|
|
1768
|
+
}
|
|
1769
|
+
interface SystemNotification extends BaseAppNotification {
|
|
1770
|
+
type: "system";
|
|
1771
|
+
action: string;
|
|
1772
|
+
metadata: {
|
|
1773
|
+
title?: string;
|
|
1774
|
+
content?: string;
|
|
1775
|
+
buttonData: {
|
|
1776
|
+
text: string;
|
|
1777
|
+
url: string;
|
|
1778
|
+
} | null;
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
interface EntityCommentNotification extends BaseAppNotification {
|
|
1782
|
+
type: "entity-comment";
|
|
1783
|
+
action: "open-comment";
|
|
1784
|
+
metadata: {
|
|
1785
|
+
entityId: string;
|
|
1786
|
+
entityShortId: string;
|
|
1787
|
+
entityTitle: string | null | undefined;
|
|
1788
|
+
entityContent: string | null | undefined;
|
|
1789
|
+
commentId: string;
|
|
1790
|
+
commentContent: string | null | undefined;
|
|
1791
|
+
initiatorId: string;
|
|
1792
|
+
initiatorName: string | null | undefined;
|
|
1793
|
+
initiatorUsername: string | null | undefined;
|
|
1794
|
+
initiatorAvatar: string | null | undefined;
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
interface CommentReplyNotification extends BaseAppNotification {
|
|
1798
|
+
type: "comment-reply";
|
|
1799
|
+
action: "open-comment";
|
|
1800
|
+
metadata: {
|
|
1801
|
+
entityId: string;
|
|
1802
|
+
entityShortId: string;
|
|
1803
|
+
entityTitle: string | null | undefined;
|
|
1804
|
+
entityContent: string | null | undefined;
|
|
1805
|
+
commentId: string;
|
|
1806
|
+
commentContent: string | null | undefined;
|
|
1807
|
+
replyId: string;
|
|
1808
|
+
replyContent: string | null | undefined;
|
|
1809
|
+
initiatorId: string;
|
|
1810
|
+
initiatorName: string | null | undefined;
|
|
1811
|
+
initiatorUsername: string | null | undefined;
|
|
1812
|
+
initiatorAvatar: string | null | undefined;
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
interface EntityMentionNotification extends BaseAppNotification {
|
|
1816
|
+
type: "entity-mention";
|
|
1817
|
+
action: "open-entity";
|
|
1818
|
+
metadata: {
|
|
1819
|
+
entityId: string;
|
|
1820
|
+
entityShortId: string;
|
|
1821
|
+
entityTitle: string | null | undefined;
|
|
1822
|
+
entityContent: string | null | undefined;
|
|
1823
|
+
initiatorId: string;
|
|
1824
|
+
initiatorName: string | null | undefined;
|
|
1825
|
+
initiatorUsername: string | null | undefined;
|
|
1826
|
+
initiatorAvatar: string | null | undefined;
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
interface CommentMentionNotification extends BaseAppNotification {
|
|
1830
|
+
type: "comment-mention";
|
|
1831
|
+
action: "open-comment";
|
|
1832
|
+
metadata: {
|
|
1833
|
+
entityId: string;
|
|
1834
|
+
entityShortId: string;
|
|
1835
|
+
entityTitle: string | null | undefined;
|
|
1836
|
+
entityContent: string | null | undefined;
|
|
1837
|
+
commentId: string;
|
|
1838
|
+
commentContent: string | null | undefined;
|
|
1839
|
+
initiatorId: string;
|
|
1840
|
+
initiatorName: string | null | undefined;
|
|
1841
|
+
initiatorUsername: string | null | undefined;
|
|
1842
|
+
initiatorAvatar: string | null | undefined;
|
|
1843
|
+
};
|
|
1844
|
+
}
|
|
1845
|
+
interface EntityUpvoteNotification extends BaseAppNotification {
|
|
1846
|
+
type: "entity-upvote";
|
|
1847
|
+
action: "open-entity";
|
|
1848
|
+
metadata: {
|
|
1849
|
+
entityId: string;
|
|
1850
|
+
entityShortId: string;
|
|
1851
|
+
entityTitle: string | null | undefined;
|
|
1852
|
+
entityContent: string | null | undefined;
|
|
1853
|
+
initiatorId: string;
|
|
1854
|
+
initiatorName: string | null | undefined;
|
|
1855
|
+
initiatorUsername: string | null | undefined;
|
|
1856
|
+
initiatorAvatar: string | null | undefined;
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
interface CommentUpvoteNotification extends BaseAppNotification {
|
|
1860
|
+
type: "comment-upvote";
|
|
1861
|
+
action: "open-comment";
|
|
1862
|
+
metadata: {
|
|
1863
|
+
entityId: string;
|
|
1864
|
+
entityShortId: string;
|
|
1865
|
+
entityTitle: string | null | undefined;
|
|
1866
|
+
entityContent: string | null | undefined;
|
|
1867
|
+
commentId: string;
|
|
1868
|
+
commentContent: string | null | undefined;
|
|
1869
|
+
initiatorId: string;
|
|
1870
|
+
initiatorName: string | null | undefined;
|
|
1871
|
+
initiatorUsername: string | null | undefined;
|
|
1872
|
+
initiatorAvatar: string | null | undefined;
|
|
1873
|
+
};
|
|
1874
|
+
}
|
|
1875
|
+
interface EntityReactionNotification extends BaseAppNotification {
|
|
1876
|
+
type: "entity-reaction";
|
|
1877
|
+
action: "open-entity";
|
|
1878
|
+
metadata: {
|
|
1879
|
+
entityId: string;
|
|
1880
|
+
entityShortId: string;
|
|
1881
|
+
entityTitle: string | null | undefined;
|
|
1882
|
+
entityContent: string | null | undefined;
|
|
1883
|
+
reactionType: string;
|
|
1884
|
+
initiatorId: string;
|
|
1885
|
+
initiatorName: string | null | undefined;
|
|
1886
|
+
initiatorUsername: string | null | undefined;
|
|
1887
|
+
initiatorAvatar: string | null | undefined;
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
interface CommentReactionNotification extends BaseAppNotification {
|
|
1891
|
+
type: "comment-reaction";
|
|
1892
|
+
action: "open-comment";
|
|
1893
|
+
metadata: {
|
|
1894
|
+
entityId: string;
|
|
1895
|
+
entityShortId: string;
|
|
1896
|
+
entityTitle: string | null | undefined;
|
|
1897
|
+
entityContent: string | null | undefined;
|
|
1898
|
+
commentId: string;
|
|
1899
|
+
commentContent: string | null | undefined;
|
|
1900
|
+
reactionType: string;
|
|
1901
|
+
initiatorId: string;
|
|
1902
|
+
initiatorName: string | null | undefined;
|
|
1903
|
+
initiatorUsername: string | null | undefined;
|
|
1904
|
+
initiatorAvatar: string | null | undefined;
|
|
1905
|
+
};
|
|
1906
|
+
}
|
|
1907
|
+
interface MilestoneUser {
|
|
1908
|
+
id: string;
|
|
1909
|
+
name: string | null | undefined;
|
|
1910
|
+
username: string | null | undefined;
|
|
1911
|
+
avatar: string | null | undefined;
|
|
1912
|
+
}
|
|
1913
|
+
interface EntityReactionMilestoneSpecificNotification extends BaseAppNotification {
|
|
1914
|
+
type: "entity-reaction-milestone-specific";
|
|
1915
|
+
action: "open-entity";
|
|
1916
|
+
metadata: {
|
|
1917
|
+
entityId: string;
|
|
1918
|
+
entityShortId: string;
|
|
1919
|
+
entityTitle: string | null | undefined;
|
|
1920
|
+
entityContent: string | null | undefined;
|
|
1921
|
+
reactionType: string;
|
|
1922
|
+
milestoneCount: number;
|
|
1923
|
+
lastThreeUsers: MilestoneUser[];
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
interface EntityReactionMilestoneTotalNotification extends BaseAppNotification {
|
|
1927
|
+
type: "entity-reaction-milestone-total";
|
|
1928
|
+
action: "open-entity";
|
|
1929
|
+
metadata: {
|
|
1930
|
+
entityId: string;
|
|
1931
|
+
entityShortId: string;
|
|
1932
|
+
entityTitle: string | null | undefined;
|
|
1933
|
+
entityContent: string | null | undefined;
|
|
1934
|
+
milestoneCount: number;
|
|
1935
|
+
reactionCounts: Record<string, number>;
|
|
1936
|
+
lastThreeUsers: MilestoneUser[];
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
interface CommentReactionMilestoneSpecificNotification extends BaseAppNotification {
|
|
1940
|
+
type: "comment-reaction-milestone-specific";
|
|
1941
|
+
action: "open-comment";
|
|
1942
|
+
metadata: {
|
|
1943
|
+
entityId: string;
|
|
1944
|
+
entityShortId: string;
|
|
1945
|
+
entityTitle: string | null | undefined;
|
|
1946
|
+
entityContent: string | null | undefined;
|
|
1947
|
+
commentId: string;
|
|
1948
|
+
commentContent: string | null | undefined;
|
|
1949
|
+
reactionType: string;
|
|
1950
|
+
milestoneCount: number;
|
|
1951
|
+
lastThreeUsers: MilestoneUser[];
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
interface CommentReactionMilestoneTotalNotification extends BaseAppNotification {
|
|
1955
|
+
type: "comment-reaction-milestone-total";
|
|
1956
|
+
action: "open-comment";
|
|
1957
|
+
metadata: {
|
|
1958
|
+
entityId: string;
|
|
1959
|
+
entityShortId: string;
|
|
1960
|
+
entityTitle: string | null | undefined;
|
|
1961
|
+
entityContent: string | null | undefined;
|
|
1962
|
+
commentId: string;
|
|
1963
|
+
commentContent: string | null | undefined;
|
|
1964
|
+
milestoneCount: number;
|
|
1965
|
+
reactionCounts: Record<string, number>;
|
|
1966
|
+
lastThreeUsers: MilestoneUser[];
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
interface SpaceMembershipApprovedNotification extends BaseAppNotification {
|
|
1970
|
+
type: "space-membership-approved";
|
|
1971
|
+
action: "open-space";
|
|
1972
|
+
metadata: {
|
|
1973
|
+
spaceId: string;
|
|
1974
|
+
spaceName: string;
|
|
1975
|
+
spaceShortId: string;
|
|
1976
|
+
spaceSlug: string | null | undefined;
|
|
1977
|
+
spaceAvatar: string | null | undefined;
|
|
1978
|
+
};
|
|
1979
|
+
}
|
|
1980
|
+
interface NewFollowNotification extends BaseAppNotification {
|
|
1981
|
+
type: "new-follow";
|
|
1982
|
+
action: "open-profile";
|
|
1983
|
+
metadata: {
|
|
1984
|
+
initiatorId: string;
|
|
1985
|
+
initiatorName: string | null | undefined;
|
|
1986
|
+
initiatorUsername: string | null | undefined;
|
|
1987
|
+
initiatorAvatar: string | null | undefined;
|
|
1988
|
+
};
|
|
1989
|
+
}
|
|
1990
|
+
interface ConnectionRequestNotification extends BaseAppNotification {
|
|
1991
|
+
type: "connection-request";
|
|
1992
|
+
action: "open-profile";
|
|
1993
|
+
metadata: {
|
|
1994
|
+
connectionId: string;
|
|
1995
|
+
initiatorId: string;
|
|
1996
|
+
initiatorName: string | null | undefined;
|
|
1997
|
+
initiatorUsername: string | null | undefined;
|
|
1998
|
+
initiatorAvatar: string | null | undefined;
|
|
1999
|
+
};
|
|
2000
|
+
}
|
|
2001
|
+
interface ConnectionAcceptedNotification extends BaseAppNotification {
|
|
2002
|
+
type: "connection-accepted";
|
|
2003
|
+
action: "open-profile";
|
|
2004
|
+
metadata: {
|
|
2005
|
+
connectionId: string;
|
|
2006
|
+
initiatorId: string;
|
|
2007
|
+
initiatorName: string | null | undefined;
|
|
2008
|
+
initiatorUsername: string | null | undefined;
|
|
2009
|
+
initiatorAvatar: string | null | undefined;
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
type UnifiedAppNotification = SystemNotification | EntityCommentNotification | CommentReplyNotification | EntityMentionNotification | CommentMentionNotification | EntityUpvoteNotification | CommentUpvoteNotification | EntityReactionNotification | CommentReactionNotification | EntityReactionMilestoneSpecificNotification | EntityReactionMilestoneTotalNotification | CommentReactionMilestoneSpecificNotification | CommentReactionMilestoneTotalNotification | NewFollowNotification | ConnectionRequestNotification | ConnectionAcceptedNotification | SpaceMembershipApprovedNotification;
|
|
2013
|
+
|
|
2014
|
+
interface FetchNotificationsProps {
|
|
2015
|
+
page?: number;
|
|
2016
|
+
limit?: number;
|
|
2017
|
+
}
|
|
2018
|
+
declare function fetchNotifications(client: SublayHttpClient, data?: FetchNotificationsProps): Promise<PaginatedResponse<UnifiedAppNotification>>;
|
|
2019
|
+
|
|
2020
|
+
declare function countUnreadNotifications(client: SublayHttpClient): Promise<number>;
|
|
2021
|
+
|
|
2022
|
+
interface MarkNotificationAsReadProps {
|
|
2023
|
+
notificationId: string;
|
|
2024
|
+
}
|
|
2025
|
+
declare function markNotificationAsRead(client: SublayHttpClient, data: MarkNotificationAsReadProps): Promise<void>;
|
|
2026
|
+
|
|
2027
|
+
interface MarkAllNotificationsAsReadResponse {
|
|
2028
|
+
markedAsRead: number;
|
|
2029
|
+
}
|
|
2030
|
+
declare function markAllNotificationsAsRead(client: SublayHttpClient): Promise<MarkAllNotificationsAsReadResponse>;
|
|
2031
|
+
|
|
2032
|
+
declare const AppNotifications_countUnreadNotifications: typeof countUnreadNotifications;
|
|
2033
|
+
declare const AppNotifications_fetchNotifications: typeof fetchNotifications;
|
|
2034
|
+
declare const AppNotifications_markAllNotificationsAsRead: typeof markAllNotificationsAsRead;
|
|
2035
|
+
declare const AppNotifications_markNotificationAsRead: typeof markNotificationAsRead;
|
|
2036
|
+
declare namespace AppNotifications {
|
|
2037
|
+
export { AppNotifications_countUnreadNotifications as countUnreadNotifications, AppNotifications_fetchNotifications as fetchNotifications, AppNotifications_markAllNotificationsAsRead as markAllNotificationsAsRead, AppNotifications_markNotificationAsRead as markNotificationAsRead };
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
type ReportTargetType = "entity" | "comment";
|
|
2041
|
+
type ReportStatus = "pending" | "on-hold" | "escalated" | "dismissed" | "actioned";
|
|
2042
|
+
interface UserReport {
|
|
2043
|
+
id: string;
|
|
2044
|
+
projectId: string;
|
|
2045
|
+
reportId: string;
|
|
2046
|
+
userId: string;
|
|
2047
|
+
reason: string;
|
|
2048
|
+
details: string | null;
|
|
2049
|
+
createdAt: string;
|
|
2050
|
+
}
|
|
2051
|
+
interface Report {
|
|
2052
|
+
id: string;
|
|
2053
|
+
projectId: string;
|
|
2054
|
+
spaceId: string | null;
|
|
2055
|
+
targetId: string;
|
|
2056
|
+
targetType: ReportTargetType;
|
|
2057
|
+
status: ReportStatus;
|
|
2058
|
+
reporterCount: number;
|
|
2059
|
+
createdAt: string;
|
|
2060
|
+
updatedAt: string;
|
|
2061
|
+
userReports?: UserReport[];
|
|
2062
|
+
target?: Entity | Comment | null;
|
|
2063
|
+
space?: Space | null;
|
|
2064
|
+
}
|
|
2065
|
+
interface CreateReportResponse {
|
|
2066
|
+
message: string;
|
|
2067
|
+
code: "report/created" | "report/updated" | "report/already-reported";
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
interface CreateReportProps {
|
|
2071
|
+
targetType: ReportTargetType;
|
|
2072
|
+
targetId: string;
|
|
2073
|
+
reason: string;
|
|
2074
|
+
details?: string;
|
|
2075
|
+
}
|
|
2076
|
+
declare function createReport(client: SublayHttpClient, data: CreateReportProps): Promise<CreateReportResponse>;
|
|
2077
|
+
|
|
2078
|
+
interface FetchModeratedReportsProps {
|
|
2079
|
+
spaceId?: string;
|
|
2080
|
+
targetType?: ReportTargetType;
|
|
2081
|
+
status?: ReportStatus;
|
|
2082
|
+
sortBy?: "new" | "old";
|
|
2083
|
+
page?: number;
|
|
2084
|
+
limit?: number;
|
|
2085
|
+
}
|
|
2086
|
+
declare function fetchModeratedReports(client: SublayHttpClient, data: FetchModeratedReportsProps): Promise<PaginatedResponse<Report>>;
|
|
2087
|
+
|
|
2088
|
+
declare const Reports_createReport: typeof createReport;
|
|
2089
|
+
declare const Reports_fetchModeratedReports: typeof fetchModeratedReports;
|
|
2090
|
+
declare namespace Reports {
|
|
2091
|
+
export { Reports_createReport as createReport, Reports_fetchModeratedReports as fetchModeratedReports };
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
interface SearchContentProps {
|
|
2095
|
+
query: string;
|
|
2096
|
+
sourceTypes?: ("entity" | "comment" | "message")[];
|
|
2097
|
+
spaceId?: string;
|
|
2098
|
+
conversationId?: string;
|
|
2099
|
+
limit?: number;
|
|
2100
|
+
}
|
|
2101
|
+
interface ContentSearchResult {
|
|
2102
|
+
sourceType: "entity" | "comment" | "message";
|
|
2103
|
+
similarity: number;
|
|
2104
|
+
record: Entity | Comment | ChatMessage;
|
|
2105
|
+
}
|
|
2106
|
+
declare function searchContent(client: SublayHttpClient, data: SearchContentProps): Promise<ContentSearchResult[]>;
|
|
2107
|
+
|
|
2108
|
+
interface SearchUsersProps {
|
|
2109
|
+
query: string;
|
|
2110
|
+
limit?: number;
|
|
2111
|
+
}
|
|
2112
|
+
interface UserSearchResult {
|
|
2113
|
+
similarity: number;
|
|
2114
|
+
record: User;
|
|
2115
|
+
}
|
|
2116
|
+
declare function searchUsers(client: SublayHttpClient, data: SearchUsersProps): Promise<UserSearchResult[]>;
|
|
2117
|
+
|
|
2118
|
+
interface SearchSpacesProps {
|
|
2119
|
+
query: string;
|
|
2120
|
+
limit?: number;
|
|
2121
|
+
}
|
|
2122
|
+
interface SpaceSearchResult {
|
|
2123
|
+
similarity: number;
|
|
2124
|
+
record: Space;
|
|
2125
|
+
}
|
|
2126
|
+
declare function searchSpaces(client: SublayHttpClient, data: SearchSpacesProps): Promise<SpaceSearchResult[]>;
|
|
2127
|
+
|
|
2128
|
+
interface AskContentProps {
|
|
2129
|
+
query: string;
|
|
2130
|
+
sourceTypes?: ("entity" | "comment" | "message")[];
|
|
2131
|
+
spaceId?: string;
|
|
2132
|
+
conversationId?: string;
|
|
2133
|
+
limit?: number;
|
|
2134
|
+
/** Abort the in-flight stream (e.g. when the user navigates away). */
|
|
2135
|
+
signal?: AbortSignal;
|
|
2136
|
+
}
|
|
2137
|
+
/**
|
|
2138
|
+
* A single Server-Sent Event from the `askContent` stream.
|
|
2139
|
+
* - `token` — an incremental chunk of the answer text.
|
|
2140
|
+
* - `sources` — the hydrated source records, emitted once after the answer.
|
|
2141
|
+
* - `done` — the stream finished successfully.
|
|
2142
|
+
* - `error` — the server reported an error (the stream ends after this).
|
|
2143
|
+
*/
|
|
2144
|
+
type AskContentEvent = {
|
|
2145
|
+
type: "token";
|
|
2146
|
+
content: string;
|
|
2147
|
+
} | {
|
|
2148
|
+
type: "sources";
|
|
2149
|
+
sources: ContentSearchResult[];
|
|
2150
|
+
} | {
|
|
2151
|
+
type: "done";
|
|
2152
|
+
} | {
|
|
2153
|
+
type: "error";
|
|
2154
|
+
error: string;
|
|
2155
|
+
};
|
|
2156
|
+
/**
|
|
2157
|
+
* Ask a question over your project's content (semantic RAG). The server answers
|
|
2158
|
+
* by streaming Server-Sent Events, so this is an **async generator**: iterate it
|
|
2159
|
+
* to consume the answer as it arrives.
|
|
2160
|
+
*
|
|
2161
|
+
* ```ts
|
|
2162
|
+
* let answer = "";
|
|
2163
|
+
* for await (const ev of client.search.askContent({ query: "How do refunds work?" })) {
|
|
2164
|
+
* if (ev.type === "token") answer += ev.content;
|
|
2165
|
+
* else if (ev.type === "sources") console.log("sources:", ev.sources);
|
|
2166
|
+
* else if (ev.type === "error") throw new Error(ev.error);
|
|
2167
|
+
* }
|
|
2168
|
+
* ```
|
|
2169
|
+
*
|
|
2170
|
+
* Cancel by passing an `AbortSignal`, or by `break`ing out of the loop.
|
|
2171
|
+
*
|
|
2172
|
+
* Note: this request uses `fetch` (not the axios instance), so it does not get
|
|
2173
|
+
* the automatic 403→refresh retry. The token is read fresh at call time via the
|
|
2174
|
+
* client's active auth mode.
|
|
2175
|
+
*/
|
|
2176
|
+
declare function askContent(client: SublayHttpClient, data: AskContentProps): AsyncGenerator<AskContentEvent, void, unknown>;
|
|
2177
|
+
|
|
2178
|
+
declare const Search_askContent: typeof askContent;
|
|
2179
|
+
declare const Search_searchContent: typeof searchContent;
|
|
2180
|
+
declare const Search_searchSpaces: typeof searchSpaces;
|
|
2181
|
+
declare const Search_searchUsers: typeof searchUsers;
|
|
2182
|
+
declare namespace Search {
|
|
2183
|
+
export { Search_askContent as askContent, Search_searchContent as searchContent, Search_searchSpaces as searchSpaces, Search_searchUsers as searchUsers };
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
interface UploadedImageVariant {
|
|
2187
|
+
path: string;
|
|
2188
|
+
width: number;
|
|
2189
|
+
height: number;
|
|
2190
|
+
size: number;
|
|
2191
|
+
format: string;
|
|
2192
|
+
publicPath: string;
|
|
2193
|
+
}
|
|
2194
|
+
interface UploadImageResponse {
|
|
2195
|
+
fileId: string;
|
|
2196
|
+
type: "image";
|
|
2197
|
+
originalPath: string;
|
|
2198
|
+
originalSize: number;
|
|
2199
|
+
originalWidth: number;
|
|
2200
|
+
originalHeight: number;
|
|
2201
|
+
variants: Record<string, UploadedImageVariant>;
|
|
2202
|
+
format: string;
|
|
2203
|
+
quality: number;
|
|
2204
|
+
/** ISO-8601 timestamp. */
|
|
2205
|
+
createdAt: string;
|
|
2206
|
+
}
|
|
2207
|
+
interface UploadImageProps {
|
|
2208
|
+
/** The image to upload, as a browser `File` or `Blob`. */
|
|
2209
|
+
file: Blob | File;
|
|
2210
|
+
/** Optional filename for the multipart part (defaults to the `File.name` or `"upload"`). */
|
|
2211
|
+
filename?: string;
|
|
2212
|
+
/**
|
|
2213
|
+
* Image-processing configuration. A discriminated union on `mode` mirroring
|
|
2214
|
+
* the server's `uploadImageBodySchema` — see {@link ImageOptions}.
|
|
2215
|
+
*/
|
|
2216
|
+
imageOptions: ImageOptions;
|
|
2217
|
+
/** Storage path segments, e.g. ["spaces", spaceId, "banner"]. */
|
|
2218
|
+
pathParts?: string[];
|
|
2219
|
+
/** Only one of entityId/commentId/spaceId may be set. */
|
|
2220
|
+
entityId?: string;
|
|
2221
|
+
commentId?: string;
|
|
2222
|
+
spaceId?: string;
|
|
2223
|
+
}
|
|
2224
|
+
declare function uploadImage(client: SublayHttpClient, data: UploadImageProps): Promise<UploadImageResponse>;
|
|
2225
|
+
|
|
2226
|
+
interface UploadFileResponse {
|
|
2227
|
+
fileId: string;
|
|
2228
|
+
type: string;
|
|
2229
|
+
relativePath: string;
|
|
2230
|
+
publicPath: string;
|
|
2231
|
+
size: number;
|
|
2232
|
+
mimeType: string;
|
|
2233
|
+
/** ISO-8601 timestamp. */
|
|
2234
|
+
createdAt: string;
|
|
2235
|
+
}
|
|
2236
|
+
interface UploadFileProps {
|
|
2237
|
+
/** The file to upload, as a browser `File` or `Blob`. */
|
|
2238
|
+
file: Blob | File;
|
|
2239
|
+
/** Optional filename for the multipart part (defaults to the `File.name` or `"upload"`). */
|
|
2240
|
+
filename?: string;
|
|
2241
|
+
/**
|
|
2242
|
+
* Storage path segments for the file, e.g. ["avatars", userId]. Required by
|
|
2243
|
+
* the server (`uploadFileBodySchema.pathParts`).
|
|
2244
|
+
*/
|
|
2245
|
+
pathParts: string[];
|
|
2246
|
+
/** Ordering within the associated entity/comment/space. */
|
|
2247
|
+
position?: number;
|
|
2248
|
+
metadata?: Record<string, any>;
|
|
2249
|
+
/** Only one of entityId/commentId/spaceId may be set. */
|
|
2250
|
+
entityId?: string;
|
|
2251
|
+
commentId?: string;
|
|
2252
|
+
spaceId?: string;
|
|
2253
|
+
}
|
|
2254
|
+
declare function uploadFile(client: SublayHttpClient, data: UploadFileProps): Promise<UploadFileResponse>;
|
|
2255
|
+
|
|
2256
|
+
interface GetFileImage {
|
|
2257
|
+
originalWidth: number;
|
|
2258
|
+
originalHeight: number;
|
|
2259
|
+
variants: Record<string, UploadedImageVariant>;
|
|
2260
|
+
processingStatus: "completed" | "failed";
|
|
2261
|
+
format: string;
|
|
2262
|
+
quality: number;
|
|
2263
|
+
exifStripped: boolean;
|
|
2264
|
+
}
|
|
2265
|
+
/** Shape returned by `GET /storage/:fileId` (a flat projection, not the populated `File` model). */
|
|
2266
|
+
interface GetFileResponse {
|
|
2267
|
+
fileId: string;
|
|
2268
|
+
type: string;
|
|
2269
|
+
originalPath: string;
|
|
2270
|
+
originalSize: number;
|
|
2271
|
+
originalMimeType: string;
|
|
2272
|
+
position: number | null;
|
|
2273
|
+
metadata: Record<string, any> | null;
|
|
2274
|
+
/** ISO-8601 timestamp. */
|
|
2275
|
+
createdAt: string;
|
|
2276
|
+
/** ISO-8601 timestamp. */
|
|
2277
|
+
updatedAt: string;
|
|
2278
|
+
userId?: string;
|
|
2279
|
+
entityId?: string;
|
|
2280
|
+
commentId?: string;
|
|
2281
|
+
spaceId?: string;
|
|
2282
|
+
image?: GetFileImage;
|
|
2283
|
+
}
|
|
2284
|
+
interface GetFileProps {
|
|
2285
|
+
fileId: string;
|
|
2286
|
+
}
|
|
2287
|
+
declare function getFile(client: SublayHttpClient, data: GetFileProps): Promise<GetFileResponse>;
|
|
2288
|
+
|
|
2289
|
+
interface DeleteFileProps {
|
|
2290
|
+
fileId: string;
|
|
2291
|
+
}
|
|
2292
|
+
declare function deleteFile(client: SublayHttpClient, data: DeleteFileProps): Promise<void>;
|
|
2293
|
+
|
|
2294
|
+
declare const Storage_deleteFile: typeof deleteFile;
|
|
2295
|
+
declare const Storage_getFile: typeof getFile;
|
|
2296
|
+
declare const Storage_uploadFile: typeof uploadFile;
|
|
2297
|
+
declare const Storage_uploadImage: typeof uploadImage;
|
|
2298
|
+
declare namespace Storage {
|
|
2299
|
+
export { Storage_deleteFile as deleteFile, Storage_getFile as getFile, Storage_uploadFile as uploadFile, Storage_uploadImage as uploadImage };
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
/** Providers the server supports (mirrors the server's `oauthProviderSchema`). */
|
|
2303
|
+
type OAuthProvider = "google" | "github" | "apple" | "facebook";
|
|
2304
|
+
interface AuthorizeProps {
|
|
2305
|
+
provider: OAuthProvider;
|
|
2306
|
+
/**
|
|
2307
|
+
* Where the server should send the browser back to once auth completes. Must
|
|
2308
|
+
* be one of the project's allowed redirect URIs (configured in the dashboard).
|
|
2309
|
+
*/
|
|
2310
|
+
redirectAfterAuth: string;
|
|
2311
|
+
}
|
|
2312
|
+
interface AuthorizeResponse {
|
|
2313
|
+
/**
|
|
2314
|
+
* The provider's authorization URL. The host app redirects the browser here;
|
|
2315
|
+
* the provider then bounces to the server's `/oauth/callback`, which finishes
|
|
2316
|
+
* auth and redirects back to `redirectAfterAuth` with the session.
|
|
2317
|
+
*/
|
|
2318
|
+
authorizationUrl: string;
|
|
2319
|
+
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Begin an OAuth sign-in / sign-up flow (unauthenticated). Returns the
|
|
2322
|
+
* `authorizationUrl` for the host to redirect to — it does NOT return tokens;
|
|
2323
|
+
* the server's callback establishes the session.
|
|
2324
|
+
*/
|
|
2325
|
+
declare function authorize(client: SublayHttpClient, data: AuthorizeProps): Promise<AuthorizeResponse>;
|
|
2326
|
+
|
|
2327
|
+
interface LinkIdentityProps {
|
|
2328
|
+
provider: OAuthProvider;
|
|
2329
|
+
/** Allowed redirect URI to return the browser to after linking completes. */
|
|
2330
|
+
redirectAfterAuth: string;
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Link a new OAuth provider to the **current** user (authenticated). Same
|
|
2334
|
+
* redirect contract as {@link authorize}: returns the `authorizationUrl` for the
|
|
2335
|
+
* host to redirect to. The current user is taken from the auth token, never the
|
|
2336
|
+
* body.
|
|
2337
|
+
*/
|
|
2338
|
+
declare function linkIdentity(client: SublayHttpClient, data: LinkIdentityProps): Promise<AuthorizeResponse>;
|
|
2339
|
+
|
|
2340
|
+
interface OAuthIdentity {
|
|
2341
|
+
id: string;
|
|
2342
|
+
provider: string;
|
|
2343
|
+
providerAccountId: string;
|
|
2344
|
+
email: string | null;
|
|
2345
|
+
name: string | null;
|
|
2346
|
+
avatar: string | null;
|
|
2347
|
+
isVerified: boolean;
|
|
2348
|
+
createdAt: string;
|
|
2349
|
+
}
|
|
2350
|
+
interface ListIdentitiesResponse {
|
|
2351
|
+
identities: OAuthIdentity[];
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
/** List the current user's linked OAuth identities (authenticated). */
|
|
2355
|
+
declare function listIdentities(client: SublayHttpClient): Promise<ListIdentitiesResponse>;
|
|
2356
|
+
|
|
2357
|
+
interface UnlinkIdentityProps {
|
|
2358
|
+
identityId: string;
|
|
2359
|
+
}
|
|
2360
|
+
interface UnlinkIdentityResponse {
|
|
2361
|
+
success: boolean;
|
|
2362
|
+
}
|
|
2363
|
+
/**
|
|
2364
|
+
* Unlink one of the current user's OAuth identities (authenticated). The server
|
|
2365
|
+
* refuses to remove the last identity if the user has no password set.
|
|
2366
|
+
*/
|
|
2367
|
+
declare function unlinkIdentity(client: SublayHttpClient, data: UnlinkIdentityProps): Promise<UnlinkIdentityResponse>;
|
|
2368
|
+
|
|
2369
|
+
declare const OAuth_authorize: typeof authorize;
|
|
2370
|
+
declare const OAuth_linkIdentity: typeof linkIdentity;
|
|
2371
|
+
declare const OAuth_listIdentities: typeof listIdentities;
|
|
2372
|
+
declare const OAuth_unlinkIdentity: typeof unlinkIdentity;
|
|
2373
|
+
declare namespace OAuth {
|
|
2374
|
+
export { OAuth_authorize as authorize, OAuth_linkIdentity as linkIdentity, OAuth_listIdentities as listIdentities, OAuth_unlinkIdentity as unlinkIdentity };
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
interface ListConversationsProps {
|
|
2378
|
+
/** Comma-separated conversation types, e.g. "direct,group,space". */
|
|
2379
|
+
types?: string;
|
|
2380
|
+
/** Cursor for keyset pagination: the `lastMessageAt` of the last item from the previous page (ISO datetime). */
|
|
2381
|
+
cursor?: string;
|
|
2382
|
+
/** Tie-breaker cursor: the `createdAt` of the last item from the previous page (ISO datetime). */
|
|
2383
|
+
cursorCreatedAt?: string;
|
|
2384
|
+
/** Default 20, max 50. */
|
|
2385
|
+
limit?: number;
|
|
2386
|
+
}
|
|
2387
|
+
interface ListConversationsResponse {
|
|
2388
|
+
conversations: ConversationPreview[];
|
|
2389
|
+
hasMore: boolean;
|
|
2390
|
+
}
|
|
2391
|
+
declare function listConversations(client: SublayHttpClient, data?: ListConversationsProps): Promise<ListConversationsResponse>;
|
|
2392
|
+
|
|
2393
|
+
interface CreateGroupConversationProps {
|
|
2394
|
+
name?: string;
|
|
2395
|
+
description?: string;
|
|
2396
|
+
/** Member user IDs to add to the group. Defaults to []. */
|
|
2397
|
+
memberIds?: string[];
|
|
2398
|
+
metadata?: Record<string, any>;
|
|
2399
|
+
}
|
|
2400
|
+
declare function createGroupConversation(client: SublayHttpClient, data: CreateGroupConversationProps): Promise<Conversation>;
|
|
2401
|
+
|
|
2402
|
+
interface CreateDirectConversationProps {
|
|
2403
|
+
/** The other participant (the target). */
|
|
2404
|
+
userId: string;
|
|
2405
|
+
}
|
|
2406
|
+
declare function createDirectConversation(client: SublayHttpClient, data: CreateDirectConversationProps): Promise<Conversation>;
|
|
2407
|
+
|
|
2408
|
+
interface GetConversationProps {
|
|
2409
|
+
conversationId: string;
|
|
2410
|
+
}
|
|
2411
|
+
declare function getConversation(client: SublayHttpClient, data: GetConversationProps): Promise<Conversation>;
|
|
2412
|
+
|
|
2413
|
+
interface UpdateConversationProps {
|
|
2414
|
+
conversationId: string;
|
|
2415
|
+
name?: string;
|
|
2416
|
+
description?: string;
|
|
2417
|
+
/** File id for the conversation avatar, or null to clear it. */
|
|
2418
|
+
avatarFileId?: string | null;
|
|
2419
|
+
/** Space conversations only: who may post. */
|
|
2420
|
+
postingPermission?: "members" | "admins";
|
|
2421
|
+
}
|
|
2422
|
+
declare function updateConversation(client: SublayHttpClient, data: UpdateConversationProps): Promise<Conversation>;
|
|
2423
|
+
|
|
2424
|
+
interface DeleteConversationProps {
|
|
2425
|
+
conversationId: string;
|
|
2426
|
+
}
|
|
2427
|
+
interface DeleteConversationResponse {
|
|
2428
|
+
message: string;
|
|
2429
|
+
}
|
|
2430
|
+
declare function deleteConversation(client: SublayHttpClient, data: DeleteConversationProps): Promise<DeleteConversationResponse>;
|
|
2431
|
+
|
|
2432
|
+
interface UnreadCountResponse {
|
|
2433
|
+
totalUnread: number;
|
|
2434
|
+
unreadConversationCount: number;
|
|
2435
|
+
}
|
|
2436
|
+
declare function getUnreadCount(client: SublayHttpClient): Promise<UnreadCountResponse>;
|
|
2437
|
+
|
|
2438
|
+
interface ListMembersProps {
|
|
2439
|
+
conversationId: string;
|
|
2440
|
+
page?: number;
|
|
2441
|
+
limit?: number;
|
|
2442
|
+
role?: "admin" | "member";
|
|
2443
|
+
}
|
|
2444
|
+
declare function listMembers(client: SublayHttpClient, data: ListMembersProps): Promise<PaginatedResponse<ConversationMember>>;
|
|
2445
|
+
|
|
2446
|
+
interface AddMemberProps {
|
|
2447
|
+
conversationId: string;
|
|
2448
|
+
/** The member to add (the target). */
|
|
2449
|
+
userId: string;
|
|
2450
|
+
}
|
|
2451
|
+
declare function addMember(client: SublayHttpClient, data: AddMemberProps): Promise<ConversationMember>;
|
|
2452
|
+
|
|
2453
|
+
interface RemoveMemberProps {
|
|
2454
|
+
conversationId: string;
|
|
2455
|
+
/** The member to remove (the target). */
|
|
2456
|
+
userId: string;
|
|
2457
|
+
}
|
|
2458
|
+
declare function removeMember(client: SublayHttpClient, data: RemoveMemberProps): Promise<{
|
|
2459
|
+
message: string;
|
|
2460
|
+
}>;
|
|
2461
|
+
|
|
2462
|
+
interface LeaveConversationProps {
|
|
2463
|
+
conversationId: string;
|
|
2464
|
+
}
|
|
2465
|
+
declare function leaveConversation(client: SublayHttpClient, data: LeaveConversationProps): Promise<{
|
|
2466
|
+
message: string;
|
|
2467
|
+
}>;
|
|
2468
|
+
|
|
2469
|
+
interface ChangeMemberRoleProps {
|
|
2470
|
+
conversationId: string;
|
|
2471
|
+
/** The member whose role changes (the target). */
|
|
2472
|
+
userId: string;
|
|
2473
|
+
role: ConversationMemberRole;
|
|
2474
|
+
}
|
|
2475
|
+
declare function changeMemberRole(client: SublayHttpClient, data: ChangeMemberRoleProps): Promise<ConversationMember>;
|
|
2476
|
+
|
|
2477
|
+
interface ListMessagesProps {
|
|
2478
|
+
conversationId: string;
|
|
2479
|
+
/** Restrict to replies of this message (thread view). */
|
|
2480
|
+
parentId?: string;
|
|
2481
|
+
/** Keyset pagination: ISO timestamp; return messages created before this. Mutually exclusive with `after`. */
|
|
2482
|
+
before?: string;
|
|
2483
|
+
/** Keyset pagination: ISO timestamp; return messages created after this. Mutually exclusive with `before`. */
|
|
2484
|
+
after?: string;
|
|
2485
|
+
/** Page size (default 50, max 100). */
|
|
2486
|
+
limit?: number;
|
|
2487
|
+
sort?: "asc" | "desc";
|
|
2488
|
+
/** Comma-separated associations to populate, e.g. "files". */
|
|
2489
|
+
include?: string;
|
|
2490
|
+
}
|
|
2491
|
+
interface ListMessagesResponse {
|
|
2492
|
+
messages: ChatMessage[];
|
|
2493
|
+
hasMore: boolean;
|
|
2494
|
+
oldestCreatedAt: string | null;
|
|
2495
|
+
newestCreatedAt: string | null;
|
|
2496
|
+
}
|
|
2497
|
+
declare function listMessages(client: SublayHttpClient, data: ListMessagesProps): Promise<ListMessagesResponse>;
|
|
2498
|
+
|
|
2499
|
+
interface SendMessageProps {
|
|
2500
|
+
conversationId: string;
|
|
2501
|
+
content?: string;
|
|
2502
|
+
gif?: GifData | null;
|
|
2503
|
+
mentions?: Mention[];
|
|
2504
|
+
parentMessageId?: string;
|
|
2505
|
+
quotedMessageId?: string;
|
|
2506
|
+
metadata?: Record<string, any>;
|
|
2507
|
+
/** Client-generated id echoed back on the created message (not stored). */
|
|
2508
|
+
localId?: string;
|
|
2509
|
+
/**
|
|
2510
|
+
* Optional file attachments (browser `File`/`Blob`), up to 10. When present
|
|
2511
|
+
* the request is sent as `multipart/form-data`; otherwise it's a JSON body.
|
|
2512
|
+
*/
|
|
2513
|
+
files?: (Blob | File)[];
|
|
2514
|
+
}
|
|
2515
|
+
declare function sendMessage(client: SublayHttpClient, data: SendMessageProps): Promise<ChatMessage>;
|
|
2516
|
+
|
|
2517
|
+
interface GetMessageProps {
|
|
2518
|
+
conversationId: string;
|
|
2519
|
+
messageId: string;
|
|
2520
|
+
}
|
|
2521
|
+
declare function getMessage(client: SublayHttpClient, data: GetMessageProps): Promise<ChatMessage>;
|
|
2522
|
+
|
|
2523
|
+
interface EditMessageProps {
|
|
2524
|
+
conversationId: string;
|
|
2525
|
+
messageId: string;
|
|
2526
|
+
content?: string;
|
|
2527
|
+
/** A GIF URL, or null to clear it. */
|
|
2528
|
+
gif?: string | null;
|
|
2529
|
+
mentions?: Mention[];
|
|
2530
|
+
metadata?: Record<string, any> | null;
|
|
2531
|
+
}
|
|
2532
|
+
declare function editMessage(client: SublayHttpClient, data: EditMessageProps): Promise<ChatMessage>;
|
|
2533
|
+
|
|
2534
|
+
interface DeleteMessageProps {
|
|
2535
|
+
conversationId: string;
|
|
2536
|
+
messageId: string;
|
|
2537
|
+
}
|
|
2538
|
+
interface DeleteMessageResponse {
|
|
2539
|
+
message: string;
|
|
2540
|
+
/** Present when the author soft-deletes their own message. */
|
|
2541
|
+
userDeletedAt?: string;
|
|
2542
|
+
}
|
|
2543
|
+
declare function deleteMessage(client: SublayHttpClient, data: DeleteMessageProps): Promise<DeleteMessageResponse>;
|
|
2544
|
+
|
|
2545
|
+
interface ToggleReactionProps {
|
|
2546
|
+
conversationId: string;
|
|
2547
|
+
messageId: string;
|
|
2548
|
+
/** The reaction emoji (required, 1–10 chars). */
|
|
2549
|
+
emoji: string;
|
|
2550
|
+
}
|
|
2551
|
+
interface ToggleReactionResponse {
|
|
2552
|
+
/** Updated emoji → count map for the message. */
|
|
2553
|
+
reactionCounts: Record<string, number>;
|
|
2554
|
+
/** Emojis the acting user has reacted with after the toggle. */
|
|
2555
|
+
userReactions: string[];
|
|
2556
|
+
/** +1 if the reaction was added, -1 if it was removed. */
|
|
2557
|
+
delta: 1 | -1;
|
|
2558
|
+
}
|
|
2559
|
+
declare function toggleReaction(client: SublayHttpClient, data: ToggleReactionProps): Promise<ToggleReactionResponse>;
|
|
2560
|
+
|
|
2561
|
+
interface ListReactionsProps {
|
|
2562
|
+
conversationId: string;
|
|
2563
|
+
messageId: string;
|
|
2564
|
+
/** The reaction emoji to list reactors for (required). */
|
|
2565
|
+
emoji: string;
|
|
2566
|
+
/** Page number (default 1). */
|
|
2567
|
+
page?: number;
|
|
2568
|
+
/** Page size (default 50, max 100). */
|
|
2569
|
+
limit?: number;
|
|
2570
|
+
}
|
|
2571
|
+
interface MessageReaction {
|
|
2572
|
+
user: User;
|
|
2573
|
+
emoji: string;
|
|
2574
|
+
createdAt: Date;
|
|
2575
|
+
}
|
|
2576
|
+
interface ListReactionsResponse {
|
|
2577
|
+
data: MessageReaction[];
|
|
2578
|
+
pagination: PaginationMetadata;
|
|
2579
|
+
}
|
|
2580
|
+
declare function listReactions(client: SublayHttpClient, data: ListReactionsProps): Promise<ListReactionsResponse>;
|
|
2581
|
+
|
|
2582
|
+
interface MarkAsReadProps {
|
|
2583
|
+
conversationId: string;
|
|
2584
|
+
/** The message up to which the conversation is marked read (uuid, required). */
|
|
2585
|
+
messageId: string;
|
|
2586
|
+
}
|
|
2587
|
+
declare function markAsRead(client: SublayHttpClient, data: MarkAsReadProps): Promise<{
|
|
2588
|
+
message: string;
|
|
2589
|
+
}>;
|
|
2590
|
+
|
|
2591
|
+
interface ReportMessageProps {
|
|
2592
|
+
conversationId: string;
|
|
2593
|
+
messageId: string;
|
|
2594
|
+
reason: string;
|
|
2595
|
+
details?: string;
|
|
2596
|
+
}
|
|
2597
|
+
interface ReportMessageResponse {
|
|
2598
|
+
message: string;
|
|
2599
|
+
code: string;
|
|
2600
|
+
}
|
|
2601
|
+
declare function reportMessage(client: SublayHttpClient, data: ReportMessageProps): Promise<ReportMessageResponse>;
|
|
2602
|
+
|
|
2603
|
+
declare const Chat_addMember: typeof addMember;
|
|
2604
|
+
declare const Chat_changeMemberRole: typeof changeMemberRole;
|
|
2605
|
+
declare const Chat_createDirectConversation: typeof createDirectConversation;
|
|
2606
|
+
declare const Chat_createGroupConversation: typeof createGroupConversation;
|
|
2607
|
+
declare const Chat_deleteConversation: typeof deleteConversation;
|
|
2608
|
+
declare const Chat_deleteMessage: typeof deleteMessage;
|
|
2609
|
+
declare const Chat_editMessage: typeof editMessage;
|
|
2610
|
+
declare const Chat_getConversation: typeof getConversation;
|
|
2611
|
+
declare const Chat_getMessage: typeof getMessage;
|
|
2612
|
+
declare const Chat_getUnreadCount: typeof getUnreadCount;
|
|
2613
|
+
declare const Chat_leaveConversation: typeof leaveConversation;
|
|
2614
|
+
declare const Chat_listConversations: typeof listConversations;
|
|
2615
|
+
declare const Chat_listMembers: typeof listMembers;
|
|
2616
|
+
declare const Chat_listMessages: typeof listMessages;
|
|
2617
|
+
declare const Chat_listReactions: typeof listReactions;
|
|
2618
|
+
declare const Chat_markAsRead: typeof markAsRead;
|
|
2619
|
+
declare const Chat_removeMember: typeof removeMember;
|
|
2620
|
+
declare const Chat_reportMessage: typeof reportMessage;
|
|
2621
|
+
declare const Chat_sendMessage: typeof sendMessage;
|
|
2622
|
+
declare const Chat_toggleReaction: typeof toggleReaction;
|
|
2623
|
+
declare const Chat_updateConversation: typeof updateConversation;
|
|
2624
|
+
declare namespace Chat {
|
|
2625
|
+
export { Chat_addMember as addMember, Chat_changeMemberRole as changeMemberRole, Chat_createDirectConversation as createDirectConversation, Chat_createGroupConversation as createGroupConversation, Chat_deleteConversation as deleteConversation, Chat_deleteMessage as deleteMessage, Chat_editMessage as editMessage, Chat_getConversation as getConversation, Chat_getMessage as getMessage, Chat_getUnreadCount as getUnreadCount, Chat_leaveConversation as leaveConversation, Chat_listConversations as listConversations, Chat_listMembers as listMembers, Chat_listMessages as listMessages, Chat_listReactions as listReactions, Chat_markAsRead as markAsRead, Chat_removeMember as removeMember, Chat_reportMessage as reportMessage, Chat_sendMessage as sendMessage, Chat_toggleReaction as toggleReaction, Chat_updateConversation as updateConversation };
|
|
175
2626
|
}
|
|
176
2627
|
|
|
177
2628
|
type BoundModule<T extends Record<string, (client: SublayHttpClient, ...args: any[]) => any>> = {
|
|
@@ -179,11 +2630,26 @@ type BoundModule<T extends Record<string, (client: SublayHttpClient, ...args: an
|
|
|
179
2630
|
};
|
|
180
2631
|
declare class SublayClient {
|
|
181
2632
|
private http;
|
|
2633
|
+
auth: BoundModule<typeof Auth>;
|
|
182
2634
|
users: BoundModule<typeof Users>;
|
|
183
2635
|
entities: BoundModule<typeof Entities>;
|
|
184
2636
|
comments: BoundModule<typeof Comments>;
|
|
2637
|
+
spaces: BoundModule<typeof Spaces>;
|
|
2638
|
+
collections: BoundModule<typeof Collections>;
|
|
2639
|
+
follows: BoundModule<typeof Follows>;
|
|
2640
|
+
connections: BoundModule<typeof Connections>;
|
|
2641
|
+
appNotifications: BoundModule<typeof AppNotifications>;
|
|
2642
|
+
reports: BoundModule<typeof Reports>;
|
|
2643
|
+
search: BoundModule<typeof Search>;
|
|
2644
|
+
storage: BoundModule<typeof Storage>;
|
|
2645
|
+
oauth: BoundModule<typeof OAuth>;
|
|
2646
|
+
chat: BoundModule<typeof Chat>;
|
|
185
2647
|
private constructor();
|
|
186
2648
|
static init(config: ClientConfig): Promise<SublayClient>;
|
|
2649
|
+
/** Imperatively set the session tokens (SDK-managed mode). */
|
|
2650
|
+
setTokens(tokens: AuthTokens): void;
|
|
2651
|
+
/** Imperatively clear the session tokens, e.g. on logout (SDK-managed mode). */
|
|
2652
|
+
clearTokens(): void;
|
|
187
2653
|
}
|
|
188
2654
|
|
|
189
|
-
export { type PaginatedResponse, type PaginationMetadata, SublayClient };
|
|
2655
|
+
export { type AuthTokens, type ClientConfig, type PaginatedResponse, type PaginationMetadata, SublayClient };
|