@gymspace/evolution 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +26 -19
- package/dist/index.d.ts +26 -19
- package/dist/index.js +173 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +173 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -3
- package/src/api/errors.ts +0 -220
- package/src/api/routes.ts +0 -76
- package/src/api/service.ts +0 -141
- package/src/index.ts +0 -89
- package/src/modules/chats/index.ts +0 -253
- package/src/modules/chats/schemas/archive.ts +0 -15
- package/src/modules/chats/schemas/check.ts +0 -20
- package/src/modules/chats/schemas/delete-message.ts +0 -16
- package/src/modules/chats/schemas/fetch-profile-picture.ts +0 -13
- package/src/modules/chats/schemas/find-all.ts +0 -49
- package/src/modules/chats/schemas/find-contacts.ts +0 -17
- package/src/modules/chats/schemas/find-messages.ts +0 -55
- package/src/modules/chats/schemas/find-status-message.ts +0 -11
- package/src/modules/chats/schemas/get-base64-from-media-message.ts +0 -20
- package/src/modules/chats/schemas/index.ts +0 -33
- package/src/modules/chats/schemas/mark-as-read.ts +0 -20
- package/src/modules/chats/schemas/mark-as-unread.ts +0 -17
- package/src/modules/chats/schemas/presence.ts +0 -41
- package/src/modules/chats/schemas/update-message.ts +0 -16
- package/src/modules/groups/index.ts +0 -246
- package/src/modules/groups/schemas/accept-invite-code.ts +0 -14
- package/src/modules/groups/schemas/common.ts +0 -89
- package/src/modules/groups/schemas/create.ts +0 -15
- package/src/modules/groups/schemas/fetch-invite-code.ts +0 -13
- package/src/modules/groups/schemas/find-all.ts +0 -26
- package/src/modules/groups/schemas/find-by-invite-code.ts +0 -39
- package/src/modules/groups/schemas/find-by-jid.ts +0 -14
- package/src/modules/groups/schemas/find-members.ts +0 -16
- package/src/modules/groups/schemas/index.ts +0 -24
- package/src/modules/groups/schemas/leave.ts +0 -14
- package/src/modules/groups/schemas/revoke-invite-code.ts +0 -14
- package/src/modules/groups/schemas/send-group-invite.ts +0 -15
- package/src/modules/groups/schemas/toggle-ephemeral.ts +0 -15
- package/src/modules/groups/schemas/update-description.ts +0 -15
- package/src/modules/groups/schemas/update-members.ts +0 -18
- package/src/modules/groups/schemas/update-picture.ts +0 -15
- package/src/modules/groups/schemas/update-setting.ts +0 -16
- package/src/modules/groups/schemas/update-subject.ts +0 -15
- package/src/modules/index.ts +0 -7
- package/src/modules/instance/index.ts +0 -126
- package/src/modules/instance/schemas/connect.ts +0 -14
- package/src/modules/instance/schemas/connection-state.ts +0 -16
- package/src/modules/instance/schemas/create.ts +0 -99
- package/src/modules/instance/schemas/delete.ts +0 -21
- package/src/modules/instance/schemas/fetch-all.ts +0 -57
- package/src/modules/instance/schemas/index.ts +0 -8
- package/src/modules/instance/schemas/logout.ts +0 -22
- package/src/modules/instance/schemas/restart.ts +0 -13
- package/src/modules/instance/schemas/set-presence.ts +0 -20
- package/src/modules/messages/index.ts +0 -246
- package/src/modules/messages/schemas/audio.ts +0 -12
- package/src/modules/messages/schemas/base.ts +0 -11
- package/src/modules/messages/schemas/contact.ts +0 -70
- package/src/modules/messages/schemas/document.ts +0 -12
- package/src/modules/messages/schemas/image.ts +0 -12
- package/src/modules/messages/schemas/index.ts +0 -31
- package/src/modules/messages/schemas/list.ts +0 -36
- package/src/modules/messages/schemas/location.ts +0 -76
- package/src/modules/messages/schemas/media.ts +0 -51
- package/src/modules/messages/schemas/poll.ts +0 -87
- package/src/modules/messages/schemas/reaction.ts +0 -21
- package/src/modules/messages/schemas/status.ts +0 -18
- package/src/modules/messages/schemas/sticker.ts +0 -77
- package/src/modules/messages/schemas/template.ts +0 -39
- package/src/modules/messages/schemas/text.ts +0 -88
- package/src/modules/messages/schemas/video.ts +0 -12
- package/src/modules/messages/schemas/voice.ts +0 -94
- package/src/modules/profile/index.ts +0 -110
- package/src/modules/profile/schemas/fetch-business-profile.ts +0 -29
- package/src/modules/profile/schemas/fetch-privacy-settings.ts +0 -11
- package/src/modules/profile/schemas/fetch-profile.ts +0 -23
- package/src/modules/profile/schemas/index.ts +0 -8
- package/src/modules/profile/schemas/remove-picture.ts +0 -4
- package/src/modules/profile/schemas/update-name.ts +0 -11
- package/src/modules/profile/schemas/update-picture.ts +0 -11
- package/src/modules/profile/schemas/update-privacy-settings.ts +0 -18
- package/src/modules/profile/schemas/update-status.ts +0 -11
- package/src/modules/settings/index.ts +0 -28
- package/src/modules/settings/schemas/find.ts +0 -11
- package/src/modules/settings/schemas/index.ts +0 -2
- package/src/modules/settings/schemas/set.ts +0 -18
- package/src/modules/webhook/index.ts +0 -28
- package/src/modules/webhook/schemas/find.ts +0 -7
- package/src/modules/webhook/schemas/index.ts +0 -2
- package/src/modules/webhook/schemas/set.ts +0 -16
- package/src/schemas/client.ts +0 -23
- package/src/schemas/common.ts +0 -44
- package/src/types/api.ts +0 -17
- package/src/types/events.ts +0 -53
- package/src/types/messages.ts +0 -5
- package/src/types/tags.ts +0 -14
- package/src/types/webhooks.ts +0 -255
- package/src/utils/phone-numer-from-jid.ts +0 -9
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
import { Routes } from "@/api/routes";
|
|
2
|
-
import type { ApiService } from "@/api/service";
|
|
3
|
-
import type { MethodOptions } from "@/types/api";
|
|
4
|
-
import type { GroupInviteCode, GroupJid } from "@/types/tags";
|
|
5
|
-
|
|
6
|
-
import type * as AcceptInviteCode from "./schemas/accept-invite-code";
|
|
7
|
-
import type * as Create from "./schemas/create";
|
|
8
|
-
import type * as FetchInviteCode from "./schemas/fetch-invite-code";
|
|
9
|
-
import type * as FindAll from "./schemas/find-all";
|
|
10
|
-
import type * as FindByInviteCode from "./schemas/find-by-invite-code";
|
|
11
|
-
import type * as FindByJid from "./schemas/find-by-jid";
|
|
12
|
-
import type * as FindMembers from "./schemas/find-members";
|
|
13
|
-
import type * as Leave from "./schemas/leave";
|
|
14
|
-
import type * as RevokeInviteCode from "./schemas/revoke-invite-code";
|
|
15
|
-
import type * as SendGroupInvite from "./schemas/send-group-invite";
|
|
16
|
-
import type * as ToggleEphemeral from "./schemas/toggle-ephemeral";
|
|
17
|
-
import type * as UpdateDescription from "./schemas/update-description";
|
|
18
|
-
import type * as UpdateMembers from "./schemas/update-members";
|
|
19
|
-
import type * as UpdatePicture from "./schemas/update-picture";
|
|
20
|
-
import type * as UpdateSetting from "./schemas/update-setting";
|
|
21
|
-
import type * as UpdateSubject from "./schemas/update-subject";
|
|
22
|
-
|
|
23
|
-
export class GroupsModule {
|
|
24
|
-
constructor(private readonly api: ApiService) {}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Gets all groups
|
|
28
|
-
* @param getParticipants - Whether to get participants
|
|
29
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
30
|
-
*/
|
|
31
|
-
async findAll(
|
|
32
|
-
getParticipants: false,
|
|
33
|
-
methodOptions?: MethodOptions
|
|
34
|
-
): Promise<FindAll.FindAllGroupsResponse>;
|
|
35
|
-
async findAll(
|
|
36
|
-
getParticipants: true,
|
|
37
|
-
methodOptions?: MethodOptions
|
|
38
|
-
): Promise<FindAll.FindAllGroupsWithParticipantsResponse>;
|
|
39
|
-
async findAll(
|
|
40
|
-
getParticipants = false,
|
|
41
|
-
methodOptions?: MethodOptions
|
|
42
|
-
): Promise<
|
|
43
|
-
| FindAll.FindAllGroupsResponse
|
|
44
|
-
| FindAll.FindAllGroupsWithParticipantsResponse
|
|
45
|
-
> {
|
|
46
|
-
const response = await this.api.get(Routes.Groups.FindAll, {
|
|
47
|
-
params: { getParticipants },
|
|
48
|
-
...methodOptions,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
if (getParticipants) {
|
|
52
|
-
return response as FindAll.FindAllGroupsWithParticipantsResponse;
|
|
53
|
-
}
|
|
54
|
-
return response as FindAll.FindAllGroupsResponse;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Gets a group by invite code
|
|
59
|
-
* @param inviteCode - The group invite code (not the URL)
|
|
60
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
61
|
-
*/
|
|
62
|
-
async findByInviteCode(
|
|
63
|
-
inviteCode: string | GroupInviteCode,
|
|
64
|
-
methodOptions?: MethodOptions
|
|
65
|
-
): Promise<FindByInviteCode.FindGroupByInviteCodeResponse> {
|
|
66
|
-
const response = await this.api.get(Routes.Groups.FindByInviteCode, {
|
|
67
|
-
params: { inviteCode: inviteCode as GroupInviteCode },
|
|
68
|
-
...methodOptions,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
return response as FindByInviteCode.FindGroupByInviteCodeResponse;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Gets a group by JID
|
|
76
|
-
* @param groupJid - The group JID terminated with \@g.us
|
|
77
|
-
* @param methodOptions - Method-specific options (instance override)
|
|
78
|
-
*/
|
|
79
|
-
async findByJid(
|
|
80
|
-
groupJid: string | GroupJid,
|
|
81
|
-
methodOptions?: MethodOptions
|
|
82
|
-
): Promise<FindByJid.FindGroupByJidResponse> {
|
|
83
|
-
const response = await this.api.get(Routes.Groups.FindByJid, {
|
|
84
|
-
params: { groupJid: groupJid as GroupJid },
|
|
85
|
-
...methodOptions,
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
return response as FindByJid.FindGroupByJidResponse;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
async create(
|
|
92
|
-
options: Create.CreateGroupRequest,
|
|
93
|
-
methodOptions?: MethodOptions
|
|
94
|
-
): Promise<Create.CreateGroupResponse> {
|
|
95
|
-
const response = await this.api.post(Routes.Groups.Create, {
|
|
96
|
-
body: options,
|
|
97
|
-
...methodOptions,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return response as Create.CreateGroupResponse;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async updatePicture(
|
|
104
|
-
options: UpdatePicture.UpdatePictureRequest,
|
|
105
|
-
methodOptions?: MethodOptions
|
|
106
|
-
): Promise<UpdatePicture.UpdatePictureResponse> {
|
|
107
|
-
const response = await this.api.post(Routes.Groups.UpdatePicture, {
|
|
108
|
-
body: options,
|
|
109
|
-
...methodOptions,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
return response as UpdatePicture.UpdatePictureResponse;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async updateSubject(
|
|
116
|
-
options: UpdateSubject.UpdateSubjectRequest,
|
|
117
|
-
methodOptions?: MethodOptions
|
|
118
|
-
): Promise<UpdateSubject.UpdateSubjectResponse> {
|
|
119
|
-
const response = await this.api.post(Routes.Groups.UpdateSubject, {
|
|
120
|
-
body: options,
|
|
121
|
-
...methodOptions,
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
return response as UpdateSubject.UpdateSubjectResponse;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async updateDescription(
|
|
128
|
-
options: UpdateDescription.UpdateDescriptionRequest,
|
|
129
|
-
methodOptions?: MethodOptions
|
|
130
|
-
): Promise<UpdateDescription.UpdateDescriptionResponse> {
|
|
131
|
-
const response = await this.api.post(Routes.Groups.UpdateDescription, {
|
|
132
|
-
body: options,
|
|
133
|
-
...methodOptions,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
return response as UpdateDescription.UpdateDescriptionResponse;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
async fetchInviteCode(
|
|
140
|
-
options: FetchInviteCode.FetchInviteCodeRequest,
|
|
141
|
-
methodOptions?: MethodOptions
|
|
142
|
-
): Promise<FetchInviteCode.FetchInviteCodeResponse> {
|
|
143
|
-
const response = await this.api.get(Routes.Groups.FetchInviteCode, {
|
|
144
|
-
params: options,
|
|
145
|
-
...methodOptions,
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
return response as FetchInviteCode.FetchInviteCodeResponse;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
async acceptInviteCode(
|
|
152
|
-
options: AcceptInviteCode.AcceptInviteCodeRequest,
|
|
153
|
-
methodOptions?: MethodOptions
|
|
154
|
-
): Promise<AcceptInviteCode.AcceptInviteCodeResponse> {
|
|
155
|
-
const response = await this.api.post(Routes.Groups.AcceptInviteCode, {
|
|
156
|
-
body: options,
|
|
157
|
-
...methodOptions,
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
return response as AcceptInviteCode.AcceptInviteCodeResponse;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async revokeInviteCode(
|
|
164
|
-
options: RevokeInviteCode.RevokeInviteCodeRequest,
|
|
165
|
-
methodOptions?: MethodOptions
|
|
166
|
-
): Promise<RevokeInviteCode.RevokeInviteCodeResponse> {
|
|
167
|
-
const response = await this.api.post(Routes.Groups.RevokeInviteCode, {
|
|
168
|
-
body: options,
|
|
169
|
-
...methodOptions,
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
return response as RevokeInviteCode.RevokeInviteCodeResponse;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
async sendGroupInvite(
|
|
176
|
-
options: SendGroupInvite.SendGroupInviteRequest,
|
|
177
|
-
methodOptions?: MethodOptions
|
|
178
|
-
): Promise<SendGroupInvite.SendGroupInviteResponse> {
|
|
179
|
-
const response = await this.api.post(Routes.Groups.SendGroupInvite, {
|
|
180
|
-
body: options,
|
|
181
|
-
...methodOptions,
|
|
182
|
-
});
|
|
183
|
-
|
|
184
|
-
return response as SendGroupInvite.SendGroupInviteResponse;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
async findMembers(
|
|
188
|
-
options: FindMembers.FindMembersRequest,
|
|
189
|
-
methodOptions?: MethodOptions
|
|
190
|
-
): Promise<FindMembers.FindMembersResponse> {
|
|
191
|
-
const response = await this.api.get(Routes.Groups.FindMembers, {
|
|
192
|
-
params: options,
|
|
193
|
-
...methodOptions,
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
return response as FindMembers.FindMembersResponse;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
async updateMembers(
|
|
200
|
-
options: UpdateMembers.UpdateMembersRequest,
|
|
201
|
-
methodOptions?: MethodOptions
|
|
202
|
-
): Promise<UpdateMembers.UpdateMembersResponse> {
|
|
203
|
-
const response = await this.api.post(Routes.Groups.UpdateMembers, {
|
|
204
|
-
body: options,
|
|
205
|
-
...methodOptions,
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
return response as UpdateMembers.UpdateMembersResponse;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
async updateSetting(
|
|
212
|
-
options: UpdateSetting.UpdateSettingRequest,
|
|
213
|
-
methodOptions?: MethodOptions
|
|
214
|
-
): Promise<UpdateSetting.UpdateSettingResponse> {
|
|
215
|
-
const response = await this.api.post(Routes.Groups.UpdateSetting, {
|
|
216
|
-
body: options,
|
|
217
|
-
...methodOptions,
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
return response as UpdateSetting.UpdateSettingResponse;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
async toggleEphemeral(
|
|
224
|
-
options: ToggleEphemeral.ToggleEphemeralRequest,
|
|
225
|
-
methodOptions?: MethodOptions
|
|
226
|
-
): Promise<ToggleEphemeral.ToggleEphemeralResponse> {
|
|
227
|
-
const response = await this.api.post(Routes.Groups.ToggleEphemeral, {
|
|
228
|
-
body: options,
|
|
229
|
-
...methodOptions,
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
return response as ToggleEphemeral.ToggleEphemeralResponse;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
async leave(
|
|
236
|
-
options: Leave.LeaveRequest,
|
|
237
|
-
methodOptions?: MethodOptions
|
|
238
|
-
): Promise<Leave.LeaveResponse> {
|
|
239
|
-
const response = await this.api.post(Routes.Groups.Leave, {
|
|
240
|
-
body: options,
|
|
241
|
-
...methodOptions,
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
return response as Leave.LeaveResponse;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupInviteCode } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface AcceptInviteCodeRequest {
|
|
5
|
-
inviteCode: GroupInviteCode;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface AcceptInviteCodeResponse {
|
|
9
|
-
status: string;
|
|
10
|
-
gid: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Backward compatibility aliases
|
|
14
|
-
export type AcceptInviteCodeOptions = AcceptInviteCodeRequest;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import { GroupJid, Jid } from "@/types/tags";
|
|
3
|
-
import { phoneNumberFromJid } from "@/utils/phone-numer-from-jid";
|
|
4
|
-
|
|
5
|
-
// Raw response interfaces from API
|
|
6
|
-
export interface GroupResponseRaw {
|
|
7
|
-
id: string;
|
|
8
|
-
subject: string;
|
|
9
|
-
subjectOwner: string;
|
|
10
|
-
subjectTime: string | Date;
|
|
11
|
-
pictureUrl?: string | null;
|
|
12
|
-
size: number;
|
|
13
|
-
creation: string | Date;
|
|
14
|
-
owner: string;
|
|
15
|
-
restrict: boolean;
|
|
16
|
-
announce: boolean;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ParticipantResponseRaw {
|
|
20
|
-
id: string;
|
|
21
|
-
admin?: "admin" | "superadmin" | null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface GroupWithParticipantsResponseRaw extends GroupResponseRaw {
|
|
25
|
-
participants: ParticipantResponseRaw[];
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Transformed response interfaces
|
|
29
|
-
export interface GroupResponse {
|
|
30
|
-
jid: GroupJid;
|
|
31
|
-
name: string;
|
|
32
|
-
pictureUrl?: string;
|
|
33
|
-
size: number;
|
|
34
|
-
subject: {
|
|
35
|
-
owner: Jid;
|
|
36
|
-
time: Date;
|
|
37
|
-
};
|
|
38
|
-
owner: {
|
|
39
|
-
jid: Jid;
|
|
40
|
-
phoneNumber: string;
|
|
41
|
-
};
|
|
42
|
-
createdAt: Date;
|
|
43
|
-
restrict: boolean;
|
|
44
|
-
announce: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface ParticipantResponse {
|
|
48
|
-
id: string;
|
|
49
|
-
role: "admin" | "superadmin" | "member";
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface GroupWithParticipantsResponse extends GroupResponse {
|
|
53
|
-
participants: ParticipantResponse[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Transform functions
|
|
57
|
-
export const GroupResponseSchemaTransform = (
|
|
58
|
-
group: GroupResponseRaw,
|
|
59
|
-
): GroupResponse => ({
|
|
60
|
-
jid: GroupJid(group.id),
|
|
61
|
-
name: group.subject,
|
|
62
|
-
pictureUrl: group.pictureUrl || undefined,
|
|
63
|
-
size: group.size,
|
|
64
|
-
subject: {
|
|
65
|
-
owner: Jid(group.subjectOwner),
|
|
66
|
-
time: new Date(group.subjectTime),
|
|
67
|
-
},
|
|
68
|
-
owner: {
|
|
69
|
-
jid: Jid(group.owner),
|
|
70
|
-
phoneNumber: phoneNumberFromJid(group.owner),
|
|
71
|
-
},
|
|
72
|
-
createdAt: new Date(group.creation),
|
|
73
|
-
restrict: group.restrict,
|
|
74
|
-
announce: group.announce,
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export const ParticipantResponseSchemaTransform = (
|
|
78
|
-
participant: ParticipantResponseRaw,
|
|
79
|
-
): ParticipantResponse => ({
|
|
80
|
-
id: participant.id,
|
|
81
|
-
role: participant.admin || ("member" as const),
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
export const GroupWithParticipantsResponseSchemaTransform = (
|
|
85
|
-
group: GroupWithParticipantsResponseRaw,
|
|
86
|
-
): GroupWithParticipantsResponse => ({
|
|
87
|
-
...GroupResponseSchemaTransform(group),
|
|
88
|
-
participants: group.participants.map(ParticipantResponseSchemaTransform),
|
|
89
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { ChatId, GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface CreateGroupRequest {
|
|
5
|
-
subject: string;
|
|
6
|
-
participants: ChatId[];
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface CreateGroupResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
gid: GroupJid;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type CreateGroupOptions = CreateGroupRequest;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface FetchInviteCodeRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface FetchInviteCodeResponse {
|
|
9
|
-
code: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Backward compatibility aliases
|
|
13
|
-
export type FetchInviteCodeOptions = FetchInviteCodeRequest;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import {
|
|
3
|
-
GroupResponseRaw,
|
|
4
|
-
GroupResponseSchemaTransform,
|
|
5
|
-
GroupWithParticipantsResponseRaw,
|
|
6
|
-
GroupWithParticipantsResponseSchemaTransform,
|
|
7
|
-
GroupResponse,
|
|
8
|
-
GroupWithParticipantsResponse,
|
|
9
|
-
} from "./common";
|
|
10
|
-
|
|
11
|
-
// Transform functions
|
|
12
|
-
export const FindAllGroupsResponseTransform = (
|
|
13
|
-
groups: GroupResponseRaw[],
|
|
14
|
-
): GroupResponse[] => groups.map(GroupResponseSchemaTransform);
|
|
15
|
-
|
|
16
|
-
export const FindAllGroupsWithParticipantsResponseTransform = (
|
|
17
|
-
groups: GroupWithParticipantsResponseRaw[],
|
|
18
|
-
): GroupWithParticipantsResponse[] => groups.map(GroupWithParticipantsResponseSchemaTransform);
|
|
19
|
-
|
|
20
|
-
// Response types
|
|
21
|
-
export type FindAllGroupsResponse = GroupResponse[];
|
|
22
|
-
export type FindAllGroupsWithParticipantsResponse = GroupWithParticipantsResponse[];
|
|
23
|
-
|
|
24
|
-
// Backward compatibility aliases
|
|
25
|
-
export const ResponseSchema = { parse: FindAllGroupsResponseTransform };
|
|
26
|
-
export const ResponseWithParticipantsSchema = { parse: FindAllGroupsWithParticipantsResponseTransform };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import {
|
|
3
|
-
GroupWithParticipantsResponseRaw,
|
|
4
|
-
GroupWithParticipantsResponseSchemaTransform,
|
|
5
|
-
GroupWithParticipantsResponse,
|
|
6
|
-
} from "./common";
|
|
7
|
-
|
|
8
|
-
// Raw response interface from API
|
|
9
|
-
export interface FindGroupByInviteCodeResponseRaw extends GroupWithParticipantsResponseRaw {
|
|
10
|
-
isCommunity: boolean;
|
|
11
|
-
isCommunityAnnounce: boolean;
|
|
12
|
-
joinApprovalMode: boolean;
|
|
13
|
-
memberAddMode: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// Transformed response interface
|
|
17
|
-
export interface FindGroupByInviteCodeResponse extends GroupWithParticipantsResponse {
|
|
18
|
-
isCommunity: boolean;
|
|
19
|
-
isCommunityAnnounce: boolean;
|
|
20
|
-
joinApprovalMode: boolean;
|
|
21
|
-
memberAddMode: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Transform function
|
|
25
|
-
export const FindGroupByInviteCodeResponseTransform = (
|
|
26
|
-
group: FindGroupByInviteCodeResponseRaw,
|
|
27
|
-
): FindGroupByInviteCodeResponse => ({
|
|
28
|
-
...GroupWithParticipantsResponseSchemaTransform({
|
|
29
|
-
...group,
|
|
30
|
-
pictureUrl: null,
|
|
31
|
-
}),
|
|
32
|
-
isCommunity: group.isCommunity,
|
|
33
|
-
isCommunityAnnounce: group.isCommunityAnnounce,
|
|
34
|
-
joinApprovalMode: group.joinApprovalMode,
|
|
35
|
-
memberAddMode: group.memberAddMode,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
// Backward compatibility alias
|
|
39
|
-
export const ResponseSchema = { parse: FindGroupByInviteCodeResponseTransform };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import {
|
|
3
|
-
GroupWithParticipantsResponseSchemaTransform,
|
|
4
|
-
GroupWithParticipantsResponse,
|
|
5
|
-
} from "./common";
|
|
6
|
-
|
|
7
|
-
// Response type (same as GroupWithParticipantsResponse)
|
|
8
|
-
export type FindGroupByJidResponse = GroupWithParticipantsResponse;
|
|
9
|
-
|
|
10
|
-
// Transform function
|
|
11
|
-
export const FindGroupByJidResponseTransform = GroupWithParticipantsResponseSchemaTransform;
|
|
12
|
-
|
|
13
|
-
// Backward compatibility alias
|
|
14
|
-
export const ResponseSchema = { parse: FindGroupByJidResponseTransform };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid, Jid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface FindMembersRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface Member {
|
|
9
|
-
id: Jid;
|
|
10
|
-
admin: string | null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type FindMembersResponse = Member[];
|
|
14
|
-
|
|
15
|
-
// Backward compatibility aliases
|
|
16
|
-
export type FindMembersOptions = FindMembersRequest;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export type { AcceptInviteCodeOptions, AcceptInviteCodeResponse } from "./accept-invite-code";
|
|
2
|
-
export type {
|
|
3
|
-
GroupResponse,
|
|
4
|
-
GroupWithParticipantsResponse,
|
|
5
|
-
ParticipantResponse,
|
|
6
|
-
} from "./common";
|
|
7
|
-
export type { CreateGroupOptions, CreateGroupResponse } from "./create";
|
|
8
|
-
export type { FetchInviteCodeOptions, FetchInviteCodeResponse } from "./fetch-invite-code";
|
|
9
|
-
export type {
|
|
10
|
-
FindAllGroupsResponse,
|
|
11
|
-
FindAllGroupsWithParticipantsResponse,
|
|
12
|
-
} from "./find-all";
|
|
13
|
-
export type { FindGroupByInviteCodeResponse } from "./find-by-invite-code";
|
|
14
|
-
export type { FindGroupByJidResponse } from "./find-by-jid";
|
|
15
|
-
export type { FindMembersOptions, FindMembersResponse } from "./find-members";
|
|
16
|
-
export type { LeaveOptions, LeaveResponse } from "./leave";
|
|
17
|
-
export type { RevokeInviteCodeOptions, RevokeInviteCodeResponse } from "./revoke-invite-code";
|
|
18
|
-
export type { SendGroupInviteOptions, SendGroupInviteResponse } from "./send-group-invite";
|
|
19
|
-
export type { ToggleEphemeralOptions, ToggleEphemeralResponse } from "./toggle-ephemeral";
|
|
20
|
-
export type { UpdateDescriptionOptions, UpdateDescriptionResponse } from "./update-description";
|
|
21
|
-
export type { UpdateMembersOptions, UpdateMembersResponse } from "./update-members";
|
|
22
|
-
export type { UpdatePictureOptions as UpdateGroupPictureOptions, UpdatePictureResponse as UpdateGroupPictureResponse } from "./update-picture";
|
|
23
|
-
export type { UpdateSettingOptions, UpdateSettingResponse } from "./update-setting";
|
|
24
|
-
export type { UpdateSubjectOptions, UpdateSubjectResponse } from "./update-subject";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface LeaveRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface LeaveResponse {
|
|
9
|
-
status: string;
|
|
10
|
-
message: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Backward compatibility aliases
|
|
14
|
-
export type LeaveOptions = LeaveRequest;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface RevokeInviteCodeRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export interface RevokeInviteCodeResponse {
|
|
9
|
-
status: string;
|
|
10
|
-
code: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Backward compatibility aliases
|
|
14
|
-
export type RevokeInviteCodeOptions = RevokeInviteCodeRequest;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid, Jid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface SendGroupInviteRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
participantJid: Jid;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface SendGroupInviteResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type SendGroupInviteOptions = SendGroupInviteRequest;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface ToggleEphemeralRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
duration: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ToggleEphemeralResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type ToggleEphemeralOptions = ToggleEphemeralRequest;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface UpdateDescriptionRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
description: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface UpdateDescriptionResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type UpdateDescriptionOptions = UpdateDescriptionRequest;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid, Jid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface UpdateMembersRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
participants: Jid[];
|
|
7
|
-
action: "add" | "remove" | "promote" | "demote";
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface Participant {
|
|
11
|
-
id: Jid;
|
|
12
|
-
status: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type UpdateMembersResponse = Participant[];
|
|
16
|
-
|
|
17
|
-
// Backward compatibility aliases
|
|
18
|
-
export type UpdateMembersOptions = UpdateMembersRequest;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface UpdatePictureRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
url: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface UpdatePictureResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type UpdatePictureOptions = UpdatePictureRequest;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface UpdateSettingRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
setting: "announcement" | "locked";
|
|
7
|
-
value: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface UpdateSettingResponse {
|
|
11
|
-
status: string;
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Backward compatibility aliases
|
|
16
|
-
export type UpdateSettingOptions = UpdateSettingRequest;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Pure TypeScript interfaces for better IDE support and performance
|
|
2
|
-
import type { GroupJid } from "@/types/tags";
|
|
3
|
-
|
|
4
|
-
export interface UpdateSubjectRequest {
|
|
5
|
-
groupJid: GroupJid;
|
|
6
|
-
subject: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface UpdateSubjectResponse {
|
|
10
|
-
status: string;
|
|
11
|
-
message: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// Backward compatibility aliases
|
|
15
|
-
export type UpdateSubjectOptions = UpdateSubjectRequest;
|