@scryme/chat 2.91.7 → 2.91.16

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/src/sdk.ts CHANGED
@@ -8,6 +8,11 @@ import type {
8
8
  V3UpdateMemberRoleDto,
9
9
  CreateWorkspaceChannelDto,
10
10
  UpdateWorkspaceChannelDto,
11
+ UpdateChannelMemberDto,
12
+ V3CreateChannelDto,
13
+ V3UpdateChannelDto,
14
+ V3AddChannelMemberDto,
15
+ V3UpdateChannelMemberDto,
11
16
  ChannelsControllerGetMessagesParams,
12
17
  ChannelsControllerUpdateMessageBody,
13
18
  ChannelsControllerAddReactionBody,
@@ -326,6 +331,8 @@ export interface WorkspaceChannel {
326
331
  description?: string | null;
327
332
  /** True if the channel is private and restricted. */
328
333
  isPrivate: boolean;
334
+ /** Custom channel metadata object. */
335
+ metadata?: Record<string, unknown> | null;
329
336
  /** Unique workspace identifier. */
330
337
  workspaceId: string;
331
338
  /** Optional parent channel or category identifier. */
@@ -993,6 +1000,78 @@ export class ScrymeSDK {
993
1000
  delete: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<{ success: boolean }> => {
994
1001
  return this.raw.channelsControllerDeleteChannel(slug, channelId, options) as unknown as { success: boolean };
995
1002
  },
1003
+ /**
1004
+ * Sub-namespace for managing channel member access and permissions.
1005
+ */
1006
+ members: {
1007
+ /**
1008
+ * Lists members belonging to a specific channel.
1009
+ * @param slug The unique workspace slug.
1010
+ * @param channelId Unique identifier of the channel.
1011
+ * @param options Optional request config override.
1012
+ */
1013
+ list: async (slug: string, channelId: string, options?: AxiosRequestConfig): Promise<any[]> => {
1014
+ return this.raw.channelsControllerGetChannelMembers(slug, channelId, options) as unknown as any[];
1015
+ },
1016
+ /**
1017
+ * Adds member(s) to a channel with optional role and bitwise permissions.
1018
+ * @param slug The unique workspace slug.
1019
+ * @param channelId Unique identifier of the channel.
1020
+ * @param data Object containing userIds or userId, role, and optional permissions.
1021
+ * @param options Optional request config override.
1022
+ */
1023
+ add: async (
1024
+ slug: string,
1025
+ channelId: string,
1026
+ data: { userIds?: string[]; userId?: string; role?: string },
1027
+ options?: AxiosRequestConfig
1028
+ ): Promise<any[]> => {
1029
+ return this.raw.channelsControllerAddChannelMembers(slug, channelId, data, options) as unknown as any[];
1030
+ },
1031
+ /**
1032
+ * Updates a channel member's role or bitwise permissions.
1033
+ * @param slug The unique workspace slug.
1034
+ * @param channelId Unique identifier of the channel.
1035
+ * @param targetUserId Target user ID of the channel member.
1036
+ * @param data Object containing role and/or bitwise permissions.
1037
+ * @param options Optional request config override.
1038
+ */
1039
+ update: async (
1040
+ slug: string,
1041
+ channelId: string,
1042
+ targetUserId: string,
1043
+ data: UpdateChannelMemberDto,
1044
+ options?: AxiosRequestConfig
1045
+ ): Promise<any> => {
1046
+ return this.raw.channelsControllerUpdateChannelMember(
1047
+ slug,
1048
+ channelId,
1049
+ targetUserId,
1050
+ data,
1051
+ options
1052
+ ) as unknown as any;
1053
+ },
1054
+ /**
1055
+ * Removes a member from a channel.
1056
+ * @param slug The unique workspace slug.
1057
+ * @param channelId Unique identifier of the channel.
1058
+ * @param targetUserId Target user ID to remove.
1059
+ * @param options Optional request config override.
1060
+ */
1061
+ remove: async (
1062
+ slug: string,
1063
+ channelId: string,
1064
+ targetUserId: string,
1065
+ options?: AxiosRequestConfig
1066
+ ): Promise<{ success: boolean }> => {
1067
+ return this.raw.channelsControllerRemoveChannelMember(
1068
+ slug,
1069
+ channelId,
1070
+ targetUserId,
1071
+ options
1072
+ ) as unknown as { success: boolean };
1073
+ },
1074
+ },
996
1075
  /**
997
1076
  * Sub-namespace for managing messages inside a channel.
998
1077
  */
@@ -1776,6 +1855,181 @@ export class ScrymeSDK {
1776
1855
  },
1777
1856
  },
1778
1857
 
1858
+ /**
1859
+ * M2M Workspace Channel Operations (Listing, Creating, Updating settings/visibility, and Deleting channels).
1860
+ */
1861
+ channel: {
1862
+ /**
1863
+ * Lists all channels in a workspace via Enterprise M2M API V3. Requires channels:read scope.
1864
+ * @param slug The unique workspace slug.
1865
+ * @param options Optional request config override.
1866
+ */
1867
+ list: async (
1868
+ slug: string,
1869
+ options?: AxiosRequestConfig
1870
+ ): Promise<{ success: boolean; data: { channels: WorkspaceChannel[] } }> => {
1871
+ return this.raw.v3WorkspacesControllerGetChannels(slug, options) as unknown as {
1872
+ success: boolean;
1873
+ data: { channels: WorkspaceChannel[] };
1874
+ };
1875
+ },
1876
+ /**
1877
+ * Creates a new channel in a workspace with customizable visibility, icon, metadata, and initial members. Requires channels:write scope.
1878
+ * @param slug The unique workspace slug.
1879
+ * @param data Channel creation DTO.
1880
+ * @param options Optional request config override.
1881
+ */
1882
+ create: async (
1883
+ slug: string,
1884
+ data: V3CreateChannelDto,
1885
+ options?: AxiosRequestConfig
1886
+ ): Promise<{ success: boolean; data: { channel: WorkspaceChannel } }> => {
1887
+ return this.raw.v3WorkspacesControllerCreateChannel(slug, data, options) as unknown as {
1888
+ success: boolean;
1889
+ data: { channel: WorkspaceChannel };
1890
+ };
1891
+ },
1892
+ /**
1893
+ * Retrieves details of a specific channel. Requires channels:read scope.
1894
+ * @param slug The unique workspace slug.
1895
+ * @param channelId Unique identifier of the channel.
1896
+ * @param options Optional request config override.
1897
+ */
1898
+ get: async (
1899
+ slug: string,
1900
+ channelId: string,
1901
+ options?: AxiosRequestConfig
1902
+ ): Promise<{ success: boolean; data: { channel: WorkspaceChannel } }> => {
1903
+ return this.raw.v3WorkspacesControllerGetChannel(slug, channelId, options) as unknown as {
1904
+ success: boolean;
1905
+ data: { channel: WorkspaceChannel };
1906
+ };
1907
+ },
1908
+ /**
1909
+ * Updates channel settings, description, visibility, icon, or custom metadata. Requires channels:write scope.
1910
+ * @param slug The unique workspace slug.
1911
+ * @param channelId Unique identifier of the channel.
1912
+ * @param data Channel update DTO.
1913
+ * @param options Optional request config override.
1914
+ */
1915
+ update: async (
1916
+ slug: string,
1917
+ channelId: string,
1918
+ data: V3UpdateChannelDto,
1919
+ options?: AxiosRequestConfig
1920
+ ): Promise<{ success: boolean; data: { channel: WorkspaceChannel } }> => {
1921
+ return this.raw.v3WorkspacesControllerUpdateChannel(
1922
+ slug,
1923
+ channelId,
1924
+ data,
1925
+ options
1926
+ ) as unknown as { success: boolean; data: { channel: WorkspaceChannel } };
1927
+ },
1928
+ /**
1929
+ * Permanently deletes a channel from a workspace. Requires channels:write scope.
1930
+ * @param slug The unique workspace slug.
1931
+ * @param channelId Unique identifier of the channel.
1932
+ * @param options Optional request config override.
1933
+ */
1934
+ delete: async (
1935
+ slug: string,
1936
+ channelId: string,
1937
+ options?: AxiosRequestConfig
1938
+ ): Promise<{ success: boolean; data: { success: boolean } }> => {
1939
+ return this.raw.v3WorkspacesControllerDeleteChannel(
1940
+ slug,
1941
+ channelId,
1942
+ options
1943
+ ) as unknown as { success: boolean; data: { success: boolean } };
1944
+ },
1945
+
1946
+ /**
1947
+ * Sub-namespace for managing channel member access and bitwise permissions via M2M V3 API.
1948
+ */
1949
+ member: {
1950
+ /**
1951
+ * Lists members belonging to a channel. Requires channels:read scope.
1952
+ * @param slug The unique workspace slug.
1953
+ * @param channelId Unique identifier of the channel.
1954
+ * @param options Optional request config override.
1955
+ */
1956
+ list: async (
1957
+ slug: string,
1958
+ channelId: string,
1959
+ options?: AxiosRequestConfig
1960
+ ): Promise<{ success: boolean; data: { members: any[] } }> => {
1961
+ return this.raw.v3WorkspacesControllerGetChannelMembers(
1962
+ slug,
1963
+ channelId,
1964
+ options
1965
+ ) as unknown as { success: boolean; data: { members: any[] } };
1966
+ },
1967
+ /**
1968
+ * Adds user(s) to a channel with optional role and bitwise permissions. Requires channels:write scope.
1969
+ * @param slug The unique workspace slug.
1970
+ * @param channelId Unique identifier of the channel.
1971
+ * @param data DTO specifying user(s) and permissions.
1972
+ * @param options Optional request config override.
1973
+ */
1974
+ add: async (
1975
+ slug: string,
1976
+ channelId: string,
1977
+ data: V3AddChannelMemberDto,
1978
+ options?: AxiosRequestConfig
1979
+ ): Promise<{ success: boolean; data: { members: any[] } }> => {
1980
+ return this.raw.v3WorkspacesControllerAddChannelMembers(
1981
+ slug,
1982
+ channelId,
1983
+ data,
1984
+ options
1985
+ ) as unknown as { success: boolean; data: { members: any[] } };
1986
+ },
1987
+ /**
1988
+ * Updates role or bitwise permissions of a channel member. Requires channels:write scope.
1989
+ * @param slug The unique workspace slug.
1990
+ * @param channelId Unique identifier of the channel.
1991
+ * @param userId Unique identifier of the user.
1992
+ * @param data DTO containing role and/or bitwise permissions.
1993
+ * @param options Optional request config override.
1994
+ */
1995
+ update: async (
1996
+ slug: string,
1997
+ channelId: string,
1998
+ userId: string,
1999
+ data: V3UpdateChannelMemberDto,
2000
+ options?: AxiosRequestConfig
2001
+ ): Promise<{ success: boolean; data: { member: any } }> => {
2002
+ return this.raw.v3WorkspacesControllerUpdateChannelMember(
2003
+ slug,
2004
+ channelId,
2005
+ userId,
2006
+ data,
2007
+ options
2008
+ ) as unknown as { success: boolean; data: { member: any } };
2009
+ },
2010
+ /**
2011
+ * Removes a member from a channel. Requires channels:write scope.
2012
+ * @param slug The unique workspace slug.
2013
+ * @param channelId Unique identifier of the channel.
2014
+ * @param userId Unique identifier of the user.
2015
+ * @param options Optional request config override.
2016
+ */
2017
+ delete: async (
2018
+ slug: string,
2019
+ channelId: string,
2020
+ userId: string,
2021
+ options?: AxiosRequestConfig
2022
+ ): Promise<{ success: boolean; data: { success: boolean } }> => {
2023
+ return this.raw.v3WorkspacesControllerDeleteChannelMember(
2024
+ slug,
2025
+ channelId,
2026
+ userId,
2027
+ options
2028
+ ) as unknown as { success: boolean; data: { success: boolean } };
2029
+ },
2030
+ },
2031
+ },
2032
+
1779
2033
  /**
1780
2034
  * M2M Workspace Membership Operations (Adding, modifying roles, and removing workspace members).
1781
2035
  */