@sendbird/sendbird-platform-sdk-typescript 2.1.1 → 2.1.5
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/.openapi-generator/FILES +5 -0
- package/apis/UserApi.ts +462 -0
- package/index.ts +1 -1
- package/models/CreateUserMetadataRequest.ts +35 -0
- package/models/ObjectSerializer.ts +16 -0
- package/models/UpdatePushPreferencesRequest.ts +8 -0
- package/models/UpdatePushPreferencesRequestDndSchedulesInner.ts +46 -0
- package/models/UpdatePushPreferencesRequestDndSchedulesInnerTimeWindowsInner.ts +56 -0
- package/models/UpdatePushPreferencesResponse.ts +8 -0
- package/models/UpdateSpecificUserMetadataRequest.ts +35 -0
- package/models/UpdateUserMetadataRequest.ts +42 -0
- package/models/ViewPushPreferencesResponse.ts +8 -0
- package/models/all.ts +5 -0
- package/package.json +1 -1
- package/tests/integration/user.test.ts +384 -0
- package/types/ObjectParamAPI.ts +185 -0
- package/types/ObservableAPI.ts +161 -0
- package/types/PromiseAPI.ts +77 -0
- /package/models/{SendbirdFile.ts → SendBirdFile.ts} +0 -0
- /package/models/{SendbirdMember.ts → SendBirdMember.ts} +0 -0
- /package/models/{SendbirdParentMessageInfo.ts → SendBirdParentMessageInfo.ts} +0 -0
|
@@ -110,6 +110,155 @@ describe("User API", () => {
|
|
|
110
110
|
expect(typeof response.timezone).toBe("string");
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
+
it("call updatePushPreferences with dndSchedules and verify response", async () => {
|
|
114
|
+
// 1) 사전 초기화
|
|
115
|
+
await userApi.updatePushPreferences({
|
|
116
|
+
apiToken: API_TOKEN,
|
|
117
|
+
userId: MASTER_USER_ID,
|
|
118
|
+
updatePushPreferencesRequest: { dndSchedules: [] },
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// 2) dndSchedules 설정 (자정을 넘기는 윈도우 포함)
|
|
122
|
+
// 서버는 자정 넘는 윈도우를 자동 분할:
|
|
123
|
+
// monday 22:00~07:00 → monday 22:00~23:59 + tuesday 00:00~07:00
|
|
124
|
+
// friday 23:30~06:00 → friday 23:30~23:59 + saturday 00:00~06:00
|
|
125
|
+
const response = await userApi.updatePushPreferences({
|
|
126
|
+
apiToken: API_TOKEN,
|
|
127
|
+
userId: MASTER_USER_ID,
|
|
128
|
+
updatePushPreferencesRequest: {
|
|
129
|
+
dndSchedules: [
|
|
130
|
+
{
|
|
131
|
+
dayOfWeek: "monday",
|
|
132
|
+
timeWindows: [
|
|
133
|
+
{ startHour: 22, startMin: 0, endHour: 7, endMin: 0 },
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
dayOfWeek: "friday",
|
|
138
|
+
timeWindows: [
|
|
139
|
+
{ startHour: 23, startMin: 30, endHour: 6, endMin: 0 },
|
|
140
|
+
{ startHour: 12, startMin: 0, endHour: 13, endMin: 0 },
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// 3) 응답 검증 - 서버가 자정 넘는 윈도우를 분할하므로 4개 스케줄 반환
|
|
148
|
+
expect(response).toHaveProperty("dndSchedules");
|
|
149
|
+
expect(Array.isArray(response.dndSchedules)).toBe(true);
|
|
150
|
+
expect(response.dndSchedules!.length).toBe(4);
|
|
151
|
+
|
|
152
|
+
// monday: 22:00~23:59 (분할된 앞부분)
|
|
153
|
+
const monday = response.dndSchedules!.find((s) => s.dayOfWeek === "monday");
|
|
154
|
+
expect(monday).toBeDefined();
|
|
155
|
+
expect(monday!.timeWindows![0].startHour).toBe(22);
|
|
156
|
+
expect(monday!.timeWindows![0].endHour).toBe(23);
|
|
157
|
+
expect(monday!.timeWindows![0].endMin).toBe(59);
|
|
158
|
+
|
|
159
|
+
// tuesday: 00:00~07:00 (분할된 뒷부분)
|
|
160
|
+
const tuesday = response.dndSchedules!.find((s) => s.dayOfWeek === "tuesday");
|
|
161
|
+
expect(tuesday).toBeDefined();
|
|
162
|
+
expect(tuesday!.timeWindows![0].startHour).toBe(0);
|
|
163
|
+
expect(tuesday!.timeWindows![0].endHour).toBe(7);
|
|
164
|
+
|
|
165
|
+
// friday: 23:30~23:59 (분할), 12:00~13:00 (그대로)
|
|
166
|
+
const friday = response.dndSchedules!.find((s) => s.dayOfWeek === "friday");
|
|
167
|
+
expect(friday).toBeDefined();
|
|
168
|
+
expect(friday!.timeWindows!.length).toBe(2);
|
|
169
|
+
|
|
170
|
+
// saturday: 00:00~06:00 (friday 23:30~06:00의 분할된 뒷부분)
|
|
171
|
+
const saturday = response.dndSchedules!.find((s) => s.dayOfWeek === "saturday");
|
|
172
|
+
expect(saturday).toBeDefined();
|
|
173
|
+
expect(saturday!.timeWindows![0].startHour).toBe(0);
|
|
174
|
+
expect(saturday!.timeWindows![0].endHour).toBe(6);
|
|
175
|
+
|
|
176
|
+
// 4) GET으로 재확인
|
|
177
|
+
const view = await userApi.viewPushPreferences({
|
|
178
|
+
apiToken: API_TOKEN,
|
|
179
|
+
userId: MASTER_USER_ID,
|
|
180
|
+
});
|
|
181
|
+
expect(view).toHaveProperty("dndSchedules");
|
|
182
|
+
expect(Array.isArray(view.dndSchedules)).toBe(true);
|
|
183
|
+
expect(view.dndSchedules!.length).toBe(4);
|
|
184
|
+
|
|
185
|
+
// 5) 원상 복원
|
|
186
|
+
await userApi.updatePushPreferences({
|
|
187
|
+
apiToken: API_TOKEN,
|
|
188
|
+
userId: MASTER_USER_ID,
|
|
189
|
+
updatePushPreferencesRequest: {
|
|
190
|
+
dndSchedules: [],
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it("call updatePushPreferences with single day dndSchedule", async () => {
|
|
196
|
+
// 단일 요일 설정
|
|
197
|
+
const response = await userApi.updatePushPreferences({
|
|
198
|
+
apiToken: API_TOKEN,
|
|
199
|
+
userId: MASTER_USER_ID,
|
|
200
|
+
updatePushPreferencesRequest: {
|
|
201
|
+
dndSchedules: [
|
|
202
|
+
{
|
|
203
|
+
dayOfWeek: "wednesday",
|
|
204
|
+
timeWindows: [
|
|
205
|
+
{ startHour: 0, startMin: 0, endHour: 6, endMin: 30 },
|
|
206
|
+
],
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
expect(response).toHaveProperty("dndSchedules");
|
|
213
|
+
expect(response.dndSchedules!.length).toBe(1);
|
|
214
|
+
expect(response.dndSchedules![0].dayOfWeek).toBe("wednesday");
|
|
215
|
+
expect(response.dndSchedules![0].timeWindows!.length).toBe(1);
|
|
216
|
+
expect(response.dndSchedules![0].timeWindows![0].startHour).toBe(0);
|
|
217
|
+
expect(response.dndSchedules![0].timeWindows![0].startMin).toBe(0);
|
|
218
|
+
expect(response.dndSchedules![0].timeWindows![0].endHour).toBe(6);
|
|
219
|
+
expect(response.dndSchedules![0].timeWindows![0].endMin).toBe(30);
|
|
220
|
+
|
|
221
|
+
// 정리
|
|
222
|
+
await userApi.updatePushPreferences({
|
|
223
|
+
apiToken: API_TOKEN,
|
|
224
|
+
userId: MASTER_USER_ID,
|
|
225
|
+
updatePushPreferencesRequest: {
|
|
226
|
+
dndSchedules: [],
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("call updatePushPreferences with empty dndSchedules to clear", async () => {
|
|
232
|
+
// 먼저 스케줄 설정
|
|
233
|
+
await userApi.updatePushPreferences({
|
|
234
|
+
apiToken: API_TOKEN,
|
|
235
|
+
userId: MASTER_USER_ID,
|
|
236
|
+
updatePushPreferencesRequest: {
|
|
237
|
+
dndSchedules: [
|
|
238
|
+
{
|
|
239
|
+
dayOfWeek: "sunday",
|
|
240
|
+
timeWindows: [
|
|
241
|
+
{ startHour: 22, startMin: 0, endHour: 8, endMin: 0 },
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// 빈 배열로 초기화
|
|
249
|
+
const response = await userApi.updatePushPreferences({
|
|
250
|
+
apiToken: API_TOKEN,
|
|
251
|
+
userId: MASTER_USER_ID,
|
|
252
|
+
updatePushPreferencesRequest: {
|
|
253
|
+
dndSchedules: [],
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
expect(response).toHaveProperty("dndSchedules");
|
|
258
|
+
expect(Array.isArray(response.dndSchedules)).toBe(true);
|
|
259
|
+
expect(response.dndSchedules!.length).toBe(0);
|
|
260
|
+
});
|
|
261
|
+
|
|
113
262
|
it("call removeARegistrationOrDeviceTokenWhenUnregisteringASpecificToken after addARegistrationOrDeviceToken", async () => {
|
|
114
263
|
const TOKEN_TYPE = "GCM";
|
|
115
264
|
const TEST_GCM_TOKEN = "dummy-token-123";
|
|
@@ -570,4 +719,239 @@ describe("User API", () => {
|
|
|
570
719
|
|
|
571
720
|
expect(deleteAUserResponse).toBeDefined();
|
|
572
721
|
});
|
|
722
|
+
|
|
723
|
+
it("call createUserMetadata", async () => {
|
|
724
|
+
const TEST_METADATA_KEY = "create_metadata_key";
|
|
725
|
+
const TEST_METADATA_VALUE = "test_value";
|
|
726
|
+
|
|
727
|
+
try {
|
|
728
|
+
await userApi.deleteUserAllMetadata({
|
|
729
|
+
userId: MASTER_USER_ID,
|
|
730
|
+
apiToken: API_TOKEN,
|
|
731
|
+
});
|
|
732
|
+
} catch (e) {
|
|
733
|
+
console.warn("ignoring error deleting metadata:", e);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
const createMetadataResponse = await userApi.createUserMetadata({
|
|
737
|
+
userId: MASTER_USER_ID,
|
|
738
|
+
apiToken: API_TOKEN,
|
|
739
|
+
createUserMetadataRequest: {
|
|
740
|
+
metadata: {
|
|
741
|
+
[TEST_METADATA_KEY]: TEST_METADATA_VALUE,
|
|
742
|
+
},
|
|
743
|
+
},
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
expect(createMetadataResponse).toBeDefined();
|
|
747
|
+
expect(typeof createMetadataResponse).toBe("object");
|
|
748
|
+
expect(createMetadataResponse).toHaveProperty(TEST_METADATA_KEY);
|
|
749
|
+
expect(createMetadataResponse[TEST_METADATA_KEY]).toBe(
|
|
750
|
+
TEST_METADATA_VALUE
|
|
751
|
+
);
|
|
752
|
+
});
|
|
753
|
+
it("call deleteUserMetadata", async () => {
|
|
754
|
+
const TEST_METADATA_KEY = "create_metadata_key";
|
|
755
|
+
const TEST_METADATA_VALUE = "test_value";
|
|
756
|
+
|
|
757
|
+
try {
|
|
758
|
+
await userApi.deleteUserAllMetadata({
|
|
759
|
+
userId: MASTER_USER_ID,
|
|
760
|
+
apiToken: API_TOKEN,
|
|
761
|
+
});
|
|
762
|
+
} catch (e) {
|
|
763
|
+
console.warn("ignoring error deleting metadata:", e);
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
await userApi.createUserMetadata({
|
|
767
|
+
userId: MASTER_USER_ID,
|
|
768
|
+
apiToken: API_TOKEN,
|
|
769
|
+
createUserMetadataRequest: {
|
|
770
|
+
metadata: {
|
|
771
|
+
[TEST_METADATA_KEY]: TEST_METADATA_VALUE,
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
try {
|
|
777
|
+
await userApi.deleteUserAllMetadata({
|
|
778
|
+
userId: MASTER_USER_ID,
|
|
779
|
+
apiToken: API_TOKEN,
|
|
780
|
+
});
|
|
781
|
+
} catch (e) {
|
|
782
|
+
fail(`error deleting metadata: ${e}`);
|
|
783
|
+
}
|
|
784
|
+
});
|
|
785
|
+
it("call updateUserMetadata", async () => {
|
|
786
|
+
const TEST_METADATA_KEY = "create_metadata_key";
|
|
787
|
+
const TEST_METADATA_VALUE = "test_value";
|
|
788
|
+
|
|
789
|
+
try {
|
|
790
|
+
await userApi.deleteUserAllMetadata({
|
|
791
|
+
userId: MASTER_USER_ID,
|
|
792
|
+
apiToken: API_TOKEN,
|
|
793
|
+
});
|
|
794
|
+
} catch (e) {
|
|
795
|
+
console.warn("ignoring error deleting metadata:", e);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
await userApi.createUserMetadata({
|
|
799
|
+
userId: MASTER_USER_ID,
|
|
800
|
+
apiToken: API_TOKEN,
|
|
801
|
+
createUserMetadataRequest: {
|
|
802
|
+
metadata: {
|
|
803
|
+
[TEST_METADATA_KEY]: TEST_METADATA_VALUE,
|
|
804
|
+
},
|
|
805
|
+
},
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
const UPDATED_METADATA_VALUE = "updated_test_value";
|
|
809
|
+
|
|
810
|
+
const updateMetadataResponse = await userApi.updateUserMetadata({
|
|
811
|
+
userId: MASTER_USER_ID,
|
|
812
|
+
apiToken: API_TOKEN,
|
|
813
|
+
updateUserMetadataRequest: {
|
|
814
|
+
metadata: {
|
|
815
|
+
[TEST_METADATA_KEY]: UPDATED_METADATA_VALUE,
|
|
816
|
+
},
|
|
817
|
+
},
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
expect(updateMetadataResponse).toBeDefined();
|
|
821
|
+
expect(typeof updateMetadataResponse).toBe("object");
|
|
822
|
+
expect(updateMetadataResponse).toHaveProperty(TEST_METADATA_KEY);
|
|
823
|
+
expect(updateMetadataResponse[TEST_METADATA_KEY]).toBe(
|
|
824
|
+
UPDATED_METADATA_VALUE
|
|
825
|
+
);
|
|
826
|
+
});
|
|
827
|
+
it("call Get Specific UserMetadata", async () => {
|
|
828
|
+
const TEST_METADATA_KEY = "create_metadata_key";
|
|
829
|
+
const TEST_METADATA_VALUE = "test_value";
|
|
830
|
+
const TEST_METADATA_KEY_1 = "create_metadata_key_1";
|
|
831
|
+
const TEST_METADATA_VALUE_1 = "test_value_1";
|
|
832
|
+
|
|
833
|
+
try {
|
|
834
|
+
await userApi.deleteUserAllMetadata({
|
|
835
|
+
userId: MASTER_USER_ID,
|
|
836
|
+
apiToken: API_TOKEN,
|
|
837
|
+
});
|
|
838
|
+
} catch (e) {
|
|
839
|
+
console.warn("ignoring error deleting metadata:", e);
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
await userApi.createUserMetadata({
|
|
843
|
+
userId: MASTER_USER_ID,
|
|
844
|
+
apiToken: API_TOKEN,
|
|
845
|
+
createUserMetadataRequest: {
|
|
846
|
+
metadata: {
|
|
847
|
+
[TEST_METADATA_KEY]: TEST_METADATA_VALUE,
|
|
848
|
+
[TEST_METADATA_KEY_1]: TEST_METADATA_VALUE_1,
|
|
849
|
+
},
|
|
850
|
+
},
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
const getSpecificMetadataResponse = await userApi.viewSpecificUserMetadata({
|
|
854
|
+
userId: MASTER_USER_ID,
|
|
855
|
+
apiToken: API_TOKEN,
|
|
856
|
+
key: TEST_METADATA_KEY_1,
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
expect(getSpecificMetadataResponse).toBeDefined();
|
|
860
|
+
expect(typeof getSpecificMetadataResponse).toBe("object");
|
|
861
|
+
expect(getSpecificMetadataResponse).toHaveProperty(TEST_METADATA_KEY_1);
|
|
862
|
+
expect(getSpecificMetadataResponse[TEST_METADATA_KEY_1]).toBe(
|
|
863
|
+
TEST_METADATA_VALUE_1
|
|
864
|
+
);
|
|
865
|
+
});
|
|
866
|
+
it("call Update Specific UserMetadata", async () => {
|
|
867
|
+
const TEST_METADATA_KEY = "create_metadata_key";
|
|
868
|
+
const TEST_METADATA_VALUE = "test_value";
|
|
869
|
+
const TEST_METADATA_KEY_1 = "create_metadata_key_1";
|
|
870
|
+
const TEST_METADATA_VALUE_1 = "test_value_1";
|
|
871
|
+
|
|
872
|
+
try {
|
|
873
|
+
await userApi.deleteUserAllMetadata({
|
|
874
|
+
userId: MASTER_USER_ID,
|
|
875
|
+
apiToken: API_TOKEN,
|
|
876
|
+
});
|
|
877
|
+
} catch (e) {
|
|
878
|
+
console.warn("ignoring error deleting metadata:", e);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
await userApi.createUserMetadata({
|
|
882
|
+
userId: MASTER_USER_ID,
|
|
883
|
+
apiToken: API_TOKEN,
|
|
884
|
+
createUserMetadataRequest: {
|
|
885
|
+
metadata: {
|
|
886
|
+
[TEST_METADATA_KEY]: TEST_METADATA_VALUE,
|
|
887
|
+
[TEST_METADATA_KEY_1]: TEST_METADATA_VALUE_1,
|
|
888
|
+
},
|
|
889
|
+
},
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
const UPDATED_METADATA_VALUE_1 = "updated_test_value_1";
|
|
893
|
+
const updateSpecificMetadataResponse = await userApi.updateSpecificUserMetadata({
|
|
894
|
+
userId: MASTER_USER_ID,
|
|
895
|
+
apiToken: API_TOKEN,
|
|
896
|
+
key: TEST_METADATA_KEY_1,
|
|
897
|
+
updateSpecificUserMetadataRequest: {
|
|
898
|
+
value: UPDATED_METADATA_VALUE_1,
|
|
899
|
+
},
|
|
900
|
+
});
|
|
901
|
+
|
|
902
|
+
expect(updateSpecificMetadataResponse).toBeDefined();
|
|
903
|
+
expect(typeof updateSpecificMetadataResponse).toBe("object");
|
|
904
|
+
expect(updateSpecificMetadataResponse).toHaveProperty(TEST_METADATA_KEY_1);
|
|
905
|
+
expect(updateSpecificMetadataResponse[TEST_METADATA_KEY_1]).toBe(
|
|
906
|
+
UPDATED_METADATA_VALUE_1
|
|
907
|
+
);
|
|
908
|
+
});
|
|
909
|
+
it("call Delete Specific UserMetadata", async () => {
|
|
910
|
+
const TEST_METADATA_KEY = "create_metadata_key";
|
|
911
|
+
const TEST_METADATA_VALUE = "test_value";
|
|
912
|
+
const TEST_METADATA_KEY_1 = "create_metadata_key_1";
|
|
913
|
+
const TEST_METADATA_VALUE_1 = "test_value_1";
|
|
914
|
+
|
|
915
|
+
try {
|
|
916
|
+
await userApi.deleteUserAllMetadata({
|
|
917
|
+
userId: MASTER_USER_ID,
|
|
918
|
+
apiToken: API_TOKEN,
|
|
919
|
+
});
|
|
920
|
+
} catch (e) {
|
|
921
|
+
console.warn("ignoring error deleting metadata:", e);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
await userApi.createUserMetadata({
|
|
925
|
+
userId: MASTER_USER_ID,
|
|
926
|
+
apiToken: API_TOKEN,
|
|
927
|
+
createUserMetadataRequest: {
|
|
928
|
+
metadata: {
|
|
929
|
+
[TEST_METADATA_KEY]: TEST_METADATA_VALUE,
|
|
930
|
+
[TEST_METADATA_KEY_1]: TEST_METADATA_VALUE_1,
|
|
931
|
+
},
|
|
932
|
+
},
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
try {
|
|
936
|
+
await userApi.deleteSpecificUserMetadata({
|
|
937
|
+
userId: MASTER_USER_ID,
|
|
938
|
+
apiToken: API_TOKEN,
|
|
939
|
+
key: TEST_METADATA_KEY_1,
|
|
940
|
+
});
|
|
941
|
+
} catch (e) {
|
|
942
|
+
fail(`error deleting specific metadata: ${e}`);
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
try {
|
|
946
|
+
await userApi.viewSpecificUserMetadata({
|
|
947
|
+
userId: MASTER_USER_ID,
|
|
948
|
+
apiToken: API_TOKEN,
|
|
949
|
+
key: TEST_METADATA_KEY_1,
|
|
950
|
+
});
|
|
951
|
+
} catch (e) {
|
|
952
|
+
const errorBody = JSON.parse((e as any).body);
|
|
953
|
+
expect(errorBody).toBeDefined();
|
|
954
|
+
expect(errorBody['code']).toBe(400201);
|
|
955
|
+
}
|
|
956
|
+
});
|
|
573
957
|
});
|
package/types/ObjectParamAPI.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { CreateAChannelMetadataResponse } from '../models/CreateAChannelMetadata
|
|
|
20
20
|
import { CreateAGroupChannelRequest } from '../models/CreateAGroupChannelRequest';
|
|
21
21
|
import { CreateAUserRequest } from '../models/CreateAUserRequest';
|
|
22
22
|
import { CreateAnOpenChannelRequest } from '../models/CreateAnOpenChannelRequest';
|
|
23
|
+
import { CreateUserMetadataRequest } from '../models/CreateUserMetadataRequest';
|
|
23
24
|
import { CreateUserTokenRequest } from '../models/CreateUserTokenRequest';
|
|
24
25
|
import { CreateUserTokenResponse } from '../models/CreateUserTokenResponse';
|
|
25
26
|
import { FreezeAGroupChannelRequest } from '../models/FreezeAGroupChannelRequest';
|
|
@@ -117,7 +118,11 @@ import { UpdateExtraDataInAMessageResponse } from '../models/UpdateExtraDataInAM
|
|
|
117
118
|
import { UpdatePushPreferencesForAChannelRequest } from '../models/UpdatePushPreferencesForAChannelRequest';
|
|
118
119
|
import { UpdatePushPreferencesForAChannelResponse } from '../models/UpdatePushPreferencesForAChannelResponse';
|
|
119
120
|
import { UpdatePushPreferencesRequest } from '../models/UpdatePushPreferencesRequest';
|
|
121
|
+
import { UpdatePushPreferencesRequestDndSchedulesInner } from '../models/UpdatePushPreferencesRequestDndSchedulesInner';
|
|
122
|
+
import { UpdatePushPreferencesRequestDndSchedulesInnerTimeWindowsInner } from '../models/UpdatePushPreferencesRequestDndSchedulesInnerTimeWindowsInner';
|
|
120
123
|
import { UpdatePushPreferencesResponse } from '../models/UpdatePushPreferencesResponse';
|
|
124
|
+
import { UpdateSpecificUserMetadataRequest } from '../models/UpdateSpecificUserMetadataRequest';
|
|
125
|
+
import { UpdateUserMetadataRequest } from '../models/UpdateUserMetadataRequest';
|
|
121
126
|
import { ViewBotByIdResponse } from '../models/ViewBotByIdResponse';
|
|
122
127
|
import { ViewBotByIdResponseBot } from '../models/ViewBotByIdResponseBot';
|
|
123
128
|
import { ViewCountPreferenceOfAChannelResponse } from '../models/ViewCountPreferenceOfAChannelResponse';
|
|
@@ -2756,6 +2761,27 @@ export interface UserApiCreateAUserRequest {
|
|
|
2756
2761
|
createAUserRequest?: CreateAUserRequest
|
|
2757
2762
|
}
|
|
2758
2763
|
|
|
2764
|
+
export interface UserApiCreateUserMetadataRequest {
|
|
2765
|
+
/**
|
|
2766
|
+
* (Required)
|
|
2767
|
+
* @type string
|
|
2768
|
+
* @memberof UserApicreateUserMetadata
|
|
2769
|
+
*/
|
|
2770
|
+
userId: string
|
|
2771
|
+
/**
|
|
2772
|
+
*
|
|
2773
|
+
* @type string
|
|
2774
|
+
* @memberof UserApicreateUserMetadata
|
|
2775
|
+
*/
|
|
2776
|
+
apiToken?: string
|
|
2777
|
+
/**
|
|
2778
|
+
*
|
|
2779
|
+
* @type CreateUserMetadataRequest
|
|
2780
|
+
* @memberof UserApicreateUserMetadata
|
|
2781
|
+
*/
|
|
2782
|
+
createUserMetadataRequest?: CreateUserMetadataRequest
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2759
2785
|
export interface UserApiCreateUserTokenRequest {
|
|
2760
2786
|
/**
|
|
2761
2787
|
* (Required)
|
|
@@ -2792,6 +2818,42 @@ export interface UserApiDeleteAUserRequest {
|
|
|
2792
2818
|
apiToken?: string
|
|
2793
2819
|
}
|
|
2794
2820
|
|
|
2821
|
+
export interface UserApiDeleteSpecificUserMetadataRequest {
|
|
2822
|
+
/**
|
|
2823
|
+
* (Required)
|
|
2824
|
+
* @type string
|
|
2825
|
+
* @memberof UserApideleteSpecificUserMetadata
|
|
2826
|
+
*/
|
|
2827
|
+
userId: string
|
|
2828
|
+
/**
|
|
2829
|
+
*
|
|
2830
|
+
* @type string
|
|
2831
|
+
* @memberof UserApideleteSpecificUserMetadata
|
|
2832
|
+
*/
|
|
2833
|
+
key: string
|
|
2834
|
+
/**
|
|
2835
|
+
*
|
|
2836
|
+
* @type string
|
|
2837
|
+
* @memberof UserApideleteSpecificUserMetadata
|
|
2838
|
+
*/
|
|
2839
|
+
apiToken?: string
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
export interface UserApiDeleteUserAllMetadataRequest {
|
|
2843
|
+
/**
|
|
2844
|
+
* (Required)
|
|
2845
|
+
* @type string
|
|
2846
|
+
* @memberof UserApideleteUserAllMetadata
|
|
2847
|
+
*/
|
|
2848
|
+
userId: string
|
|
2849
|
+
/**
|
|
2850
|
+
*
|
|
2851
|
+
* @type string
|
|
2852
|
+
* @memberof UserApideleteUserAllMetadata
|
|
2853
|
+
*/
|
|
2854
|
+
apiToken?: string
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2795
2857
|
export interface UserApiGetChannelInvitationPreferenceRequest {
|
|
2796
2858
|
/**
|
|
2797
2859
|
* (Required)
|
|
@@ -3395,6 +3457,54 @@ export interface UserApiUpdatePushPreferencesForAChannelRequest {
|
|
|
3395
3457
|
updatePushPreferencesForAChannelRequest?: UpdatePushPreferencesForAChannelRequest
|
|
3396
3458
|
}
|
|
3397
3459
|
|
|
3460
|
+
export interface UserApiUpdateSpecificUserMetadataRequest {
|
|
3461
|
+
/**
|
|
3462
|
+
* (Required)
|
|
3463
|
+
* @type string
|
|
3464
|
+
* @memberof UserApiupdateSpecificUserMetadata
|
|
3465
|
+
*/
|
|
3466
|
+
userId: string
|
|
3467
|
+
/**
|
|
3468
|
+
*
|
|
3469
|
+
* @type string
|
|
3470
|
+
* @memberof UserApiupdateSpecificUserMetadata
|
|
3471
|
+
*/
|
|
3472
|
+
key: string
|
|
3473
|
+
/**
|
|
3474
|
+
*
|
|
3475
|
+
* @type string
|
|
3476
|
+
* @memberof UserApiupdateSpecificUserMetadata
|
|
3477
|
+
*/
|
|
3478
|
+
apiToken?: string
|
|
3479
|
+
/**
|
|
3480
|
+
*
|
|
3481
|
+
* @type UpdateSpecificUserMetadataRequest
|
|
3482
|
+
* @memberof UserApiupdateSpecificUserMetadata
|
|
3483
|
+
*/
|
|
3484
|
+
updateSpecificUserMetadataRequest?: UpdateSpecificUserMetadataRequest
|
|
3485
|
+
}
|
|
3486
|
+
|
|
3487
|
+
export interface UserApiUpdateUserMetadataRequest {
|
|
3488
|
+
/**
|
|
3489
|
+
* (Required)
|
|
3490
|
+
* @type string
|
|
3491
|
+
* @memberof UserApiupdateUserMetadata
|
|
3492
|
+
*/
|
|
3493
|
+
userId: string
|
|
3494
|
+
/**
|
|
3495
|
+
*
|
|
3496
|
+
* @type string
|
|
3497
|
+
* @memberof UserApiupdateUserMetadata
|
|
3498
|
+
*/
|
|
3499
|
+
apiToken?: string
|
|
3500
|
+
/**
|
|
3501
|
+
*
|
|
3502
|
+
* @type UpdateUserMetadataRequest
|
|
3503
|
+
* @memberof UserApiupdateUserMetadata
|
|
3504
|
+
*/
|
|
3505
|
+
updateUserMetadataRequest?: UpdateUserMetadataRequest
|
|
3506
|
+
}
|
|
3507
|
+
|
|
3398
3508
|
export interface UserApiViewAUserRequest {
|
|
3399
3509
|
/**
|
|
3400
3510
|
* (Required)
|
|
@@ -3539,6 +3649,27 @@ export interface UserApiViewPushPreferencesForAChannelRequest {
|
|
|
3539
3649
|
apiToken?: string
|
|
3540
3650
|
}
|
|
3541
3651
|
|
|
3652
|
+
export interface UserApiViewSpecificUserMetadataRequest {
|
|
3653
|
+
/**
|
|
3654
|
+
* (Required)
|
|
3655
|
+
* @type string
|
|
3656
|
+
* @memberof UserApiviewSpecificUserMetadata
|
|
3657
|
+
*/
|
|
3658
|
+
userId: string
|
|
3659
|
+
/**
|
|
3660
|
+
*
|
|
3661
|
+
* @type string
|
|
3662
|
+
* @memberof UserApiviewSpecificUserMetadata
|
|
3663
|
+
*/
|
|
3664
|
+
key: string
|
|
3665
|
+
/**
|
|
3666
|
+
*
|
|
3667
|
+
* @type string
|
|
3668
|
+
* @memberof UserApiviewSpecificUserMetadata
|
|
3669
|
+
*/
|
|
3670
|
+
apiToken?: string
|
|
3671
|
+
}
|
|
3672
|
+
|
|
3542
3673
|
export interface UserApiViewWhoOwnsARegistrationOrDeviceTokenRequest {
|
|
3543
3674
|
/**
|
|
3544
3675
|
* (Required)
|
|
@@ -3594,6 +3725,15 @@ export class ObjectUserApi {
|
|
|
3594
3725
|
return this.api.createAUser(param.apiToken, param.createAUserRequest, options).toPromise();
|
|
3595
3726
|
}
|
|
3596
3727
|
|
|
3728
|
+
/**
|
|
3729
|
+
* ## Create metadata When creating new items of the user metadata. https://sendbird.com/docs/chat/platform-api/v3/user/managing-metadata/user-create-metadata
|
|
3730
|
+
* Create user metadata
|
|
3731
|
+
* @param param the request object
|
|
3732
|
+
*/
|
|
3733
|
+
public createUserMetadata(param: UserApiCreateUserMetadataRequest, options?: Configuration): Promise<any> {
|
|
3734
|
+
return this.api.createUserMetadata(param.userId, param.apiToken, param.createUserMetadataRequest, options).toPromise();
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3597
3737
|
/**
|
|
3598
3738
|
* ## Create user token This action issues a session token for user authentication. Session tokens provide an efficient stateless authentication method by not storing the tokens in the Sendbird database, and thus improving the server's performance. See [access token vs. session token](https://sendbird.com/docs/chat/platform-api/v3/user/creating-users/create-a-user#2-access-token-vs-session-token) to learn more about authenticating users. > **Note**: The endpoint `/users/{user_id}` is deprecated. Use `/users/{user_id}/token` for greater efficiency. https://sendbird.com/docs/chat/platform-api/v3/user/managing-session-tokens/issue-a-session-token#1-issue-a-session-token
|
|
3599
3739
|
* Create user token
|
|
@@ -3612,6 +3752,24 @@ export class ObjectUserApi {
|
|
|
3612
3752
|
return this.api.deleteAUser(param.userId, param.apiToken, options).toPromise();
|
|
3613
3753
|
}
|
|
3614
3754
|
|
|
3755
|
+
/**
|
|
3756
|
+
* ## Delete metadata https://sendbird.com/docs/chat/platform-api/v3/user/managing-metadata/user-delete-metadata
|
|
3757
|
+
* Delete user metadata
|
|
3758
|
+
* @param param the request object
|
|
3759
|
+
*/
|
|
3760
|
+
public deleteSpecificUserMetadata(param: UserApiDeleteSpecificUserMetadataRequest, options?: Configuration): Promise<any> {
|
|
3761
|
+
return this.api.deleteSpecificUserMetadata(param.userId, param.key, param.apiToken, options).toPromise();
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
/**
|
|
3765
|
+
* ## Delete metadata You can delete a specific or all metadata of a user. Metadata stores additional user information such as their preference settings. https://sendbird.com/docs/chat/platform-api/v3/user/managing-metadata/user-delete-metadata
|
|
3766
|
+
* Delete user metadata
|
|
3767
|
+
* @param param the request object
|
|
3768
|
+
*/
|
|
3769
|
+
public deleteUserAllMetadata(param: UserApiDeleteUserAllMetadataRequest, options?: Configuration): Promise<any> {
|
|
3770
|
+
return this.api.deleteUserAllMetadata(param.userId, param.apiToken, options).toPromise();
|
|
3771
|
+
}
|
|
3772
|
+
|
|
3615
3773
|
/**
|
|
3616
3774
|
* ## Get channel invitation preference This action retrieves a user's [group channel](https://sendbird.com/docs/chat/platform-api/v3/channel/channel-overview#2-channel-types-3-group-channel) invitation preference. Users are subject to both user-specific and application-wide invitation preferences. Of the two, the invitation preference set for a specific user takes precedence over [the default channel invitation preference](https://sendbird.com/docs/chat/platform-api/v3/channel/setting-up-channels/get-default-invitation-preference). [https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/get-channel-invitation-preference#1-get-channel-invitation-preference](https://sendbird.com/docs/chat/platform-api/v3/channel/managing-a-channel/get-channel-invitation-preference#1-get-channel-invitation-preference)
|
|
3617
3775
|
* Get channel invitation preference
|
|
@@ -3747,6 +3905,24 @@ export class ObjectUserApi {
|
|
|
3747
3905
|
return this.api.updatePushPreferencesForAChannel(param.userId, param.channelUrl, param.apiToken, param.updatePushPreferencesForAChannelRequest, options).toPromise();
|
|
3748
3906
|
}
|
|
3749
3907
|
|
|
3908
|
+
/**
|
|
3909
|
+
* ## Update metadata https://sendbird.com/docs/chat/platform-api/v3/user/managing-metadata/user-update-metadata
|
|
3910
|
+
* Update specific user metadata
|
|
3911
|
+
* @param param the request object
|
|
3912
|
+
*/
|
|
3913
|
+
public updateSpecificUserMetadata(param: UserApiUpdateSpecificUserMetadataRequest, options?: Configuration): Promise<any> {
|
|
3914
|
+
return this.api.updateSpecificUserMetadata(param.userId, param.key, param.apiToken, param.updateSpecificUserMetadataRequest, options).toPromise();
|
|
3915
|
+
}
|
|
3916
|
+
|
|
3917
|
+
/**
|
|
3918
|
+
* ## Update metadata When updating existing items of the user metadata by their keys or adding new items to the metadata https://sendbird.com/docs/chat/platform-api/v3/user/managing-metadata/user-update-metadata
|
|
3919
|
+
* Update user metadata
|
|
3920
|
+
* @param param the request object
|
|
3921
|
+
*/
|
|
3922
|
+
public updateUserMetadata(param: UserApiUpdateUserMetadataRequest, options?: Configuration): Promise<any> {
|
|
3923
|
+
return this.api.updateUserMetadata(param.userId, param.apiToken, param.updateUserMetadataRequest, options).toPromise();
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3750
3926
|
/**
|
|
3751
3927
|
* ## View a user You can retrieve information about a user using this API. https://sendbird.com/docs/chat/platform-api/v3/user/listing-users/get-a-user#1-get-a-user `user_id` Type: string Description: Specifies the unique ID of the user to retrieve.
|
|
3752
3928
|
* View a user
|
|
@@ -3801,6 +3977,15 @@ export class ObjectUserApi {
|
|
|
3801
3977
|
return this.api.viewPushPreferencesForAChannel(param.userId, param.channelUrl, param.apiToken, options).toPromise();
|
|
3802
3978
|
}
|
|
3803
3979
|
|
|
3980
|
+
/**
|
|
3981
|
+
* ## Get metadata https://sendbird.com/docs/chat/platform-api/v3/user/managing-metadata/user-get-metadata
|
|
3982
|
+
* Get specific user metadata
|
|
3983
|
+
* @param param the request object
|
|
3984
|
+
*/
|
|
3985
|
+
public viewSpecificUserMetadata(param: UserApiViewSpecificUserMetadataRequest, options?: Configuration): Promise<any> {
|
|
3986
|
+
return this.api.viewSpecificUserMetadata(param.userId, param.key, param.apiToken, options).toPromise();
|
|
3987
|
+
}
|
|
3988
|
+
|
|
3804
3989
|
/**
|
|
3805
3990
|
* ## View who owns a registration or device token Retrieves a user who owns a FCM registration token, HMS device token, or APNs device token. You can pass one of two values in `token_type`: `gcm`, `huawei`, or `apns`, depending on which push service you are using. https://sendbird.com/docs/chat/v3/platform-api/guides/user#2-view-who-owns-a-registration-or-device-token ----------------------------
|
|
3806
3991
|
* View who owns a registration or device token
|