Skip to content

Commit

Permalink
Adding typescript for multi-tenant feature
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed May 15, 2020
1 parent 833ad1f commit 6160aa6
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions types/stream-chat/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ export class StreamChat {
hardDelete?: boolean,
): Promise<DeleteMessageAPIResponse>;
verifyWebhook(requestBody: string | Int8Array | Buffer, xSignature: string): boolean;

// TODO: Add detailed types for following api responses
getPermission(name: string): Promise<APIResponse>;
createPermission(permissionData: object): Promise<APIResponse>;
updatePermission(name: string, permissionData: object): Promise<APIResponse>;
deletePermission(name: string): Promise<APIResponse>;
listPermissions(): Promise<APIResponse>;
createRole(name: string): Promise<APIResponse>;
listRoles(): Promise<APIResponse>;
deleteRole(name: string): Promise<APIResponse>;
}

export interface updateUserRequest {
Expand Down Expand Up @@ -529,6 +539,41 @@ export const AnyRole: ['*'];
export const MaxPriority: 999;
export const MinPriority: 1;

export const BuiltinRoles: {
Anonymous: 'anonymous';
Guest: 'guest';
User: 'user';
Admin: 'admin';
ChannelModerator: 'channel_moderator';
ChannelMember: 'channel_member';
};

export const BuiltinPermissions: {
CreateMessage: 'Create Message';
UpdateAnyMessage: 'Update Any Message';
UpdateOwnMessage: 'Update Own Message';
DeleteAnyMessage: 'Delete Any Message';
DeleteOwnMessage: 'Delete Own Message';
CreateChannel: 'Create Channel';
ReadAnyChannel: 'Read Any Channel';
ReadOwnChannel: 'Read Own Channel';
UpdateMembersAnyChannel: 'Update Members Any Channel';
UpdateMembersOwnChannel: 'Update Members Own Channel';
UpdateAnyChannel: 'Update Any Channel';
UpdateOwnChannel: 'Update Own Channel';
DeleteAnyChannel: 'Delete Any Channel';
DeleteOwnChannel: 'Delete Own Channel';
RunMessageAction: 'Run Message Action';
BanUser: 'Ban User';
UploadAttachment: 'Upload Attachment';
DeleteAnyAttachment: 'Delete Any Attachment';
DeleteOwnAttachment: 'Delete Own Attachment';
AddLinks: 'Add Links';
CreateReaction: 'Create Reaction';
DeleteAnyReaction: 'Delete Any Reaction';
DeleteOwnReaction: 'Delete Own Reaction';
};

export function JWTUserToken(
apiSecret: string,
userId: string,
Expand Down Expand Up @@ -883,6 +928,7 @@ export interface ChannelConfigWithInfo

export interface ChannelTypeConfig extends ChannelConfigWithInfo {
permissions: Permission[];
roles: object;
}

export type CommandVariants =
Expand Down

0 comments on commit 6160aa6

Please sign in to comment.