mezon-js 2.7.31 → 2.7.32
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +318 -208
- package/client.ts +14 -0
- package/dist/api.gen.d.ts +49 -5
- package/dist/client.d.ts +3 -1
- package/dist/mezon-js.cjs.js +46 -5
- package/dist/mezon-js.esm.mjs +46 -5
- package/package.json +1 -1
package/api.gen.ts
CHANGED
@@ -296,11 +296,11 @@ export interface ApiChannelMessageHeader {
|
|
296
296
|
|
297
297
|
/** A list of channel messages, usually a result of a list operation. */
|
298
298
|
export interface ApiChannelMessageList {
|
299
|
-
|
299
|
+
//
|
300
300
|
last_seen_message?: ApiChannelMessageHeader;
|
301
301
|
//A list of messages.
|
302
302
|
messages?: Array<ApiChannelMessage>;
|
303
|
-
|
303
|
+
}
|
304
304
|
|
305
305
|
/** A list of users belonging to a channel, along with their role. */
|
306
306
|
export interface ApiChannelUserList {
|
@@ -552,6 +552,14 @@ export interface ApiEventManagement {
|
|
552
552
|
user_ids?: Array<string>;
|
553
553
|
}
|
554
554
|
|
555
|
+
/** */
|
556
|
+
export interface ApiFilterParam {
|
557
|
+
//
|
558
|
+
field_name?: string;
|
559
|
+
//
|
560
|
+
field_value?: string;
|
561
|
+
}
|
562
|
+
|
555
563
|
/** A friend of a user. */
|
556
564
|
export interface ApiFriend {
|
557
565
|
//The friend status. one of "Friend.State".
|
@@ -871,6 +879,64 @@ export interface ApiRpc {
|
|
871
879
|
payload?: string;
|
872
880
|
}
|
873
881
|
|
882
|
+
/** */
|
883
|
+
export interface ApiSearchMessageDocument {
|
884
|
+
//
|
885
|
+
attachment?: string;
|
886
|
+
//
|
887
|
+
avatar_url?: string;
|
888
|
+
//The channel ID.
|
889
|
+
channel_id?: string;
|
890
|
+
//
|
891
|
+
channel_label?: string;
|
892
|
+
//
|
893
|
+
channel_type?: number;
|
894
|
+
//The clan ID.
|
895
|
+
clan_id?: string;
|
896
|
+
//
|
897
|
+
clan_name?: string;
|
898
|
+
//
|
899
|
+
content?: string;
|
900
|
+
//
|
901
|
+
create_time?: string;
|
902
|
+
//
|
903
|
+
display_name?: string;
|
904
|
+
//
|
905
|
+
mention?: string;
|
906
|
+
//The message ID.
|
907
|
+
message_id?: string;
|
908
|
+
//
|
909
|
+
reaction?: string;
|
910
|
+
//
|
911
|
+
reference?: string;
|
912
|
+
//The user ID of sender.
|
913
|
+
sender_id?: string;
|
914
|
+
//
|
915
|
+
update_time?: string;
|
916
|
+
//
|
917
|
+
username?: string;
|
918
|
+
}
|
919
|
+
|
920
|
+
/** */
|
921
|
+
export interface ApiSearchMessageRequest {
|
922
|
+
//
|
923
|
+
filters?: Array<ApiFilterParam>;
|
924
|
+
//
|
925
|
+
from?: number;
|
926
|
+
//
|
927
|
+
size?: number;
|
928
|
+
//
|
929
|
+
sorts?: Array<ApiSortParam>;
|
930
|
+
}
|
931
|
+
|
932
|
+
/** */
|
933
|
+
export interface ApiSearchMessageResponse {
|
934
|
+
//List of paged messages.
|
935
|
+
messages?: Array<ApiSearchMessageDocument>;
|
936
|
+
//The total number of messages.
|
937
|
+
total?: number;
|
938
|
+
}
|
939
|
+
|
874
940
|
/** A user's session used to authenticate messages. */
|
875
941
|
export interface ApiSession {
|
876
942
|
//True if the corresponding account was just created, false otherwise.
|
@@ -927,6 +993,14 @@ export interface ApiSetNotificationRequest {
|
|
927
993
|
time_mute?: string;
|
928
994
|
}
|
929
995
|
|
996
|
+
/** */
|
997
|
+
export interface ApiSortParam {
|
998
|
+
//
|
999
|
+
field_name?: string;
|
1000
|
+
//
|
1001
|
+
order?: string;
|
1002
|
+
}
|
1003
|
+
|
930
1004
|
/** An object within the storage engine. */
|
931
1005
|
export interface ApiStorageObject {
|
932
1006
|
//The collection which stores the object.
|
@@ -1033,7 +1107,7 @@ export interface ApiUploadAttachmentRequest {
|
|
1033
1107
|
filename?: string;
|
1034
1108
|
//
|
1035
1109
|
filetype?: string;
|
1036
|
-
|
1110
|
+
//
|
1037
1111
|
height?: number;
|
1038
1112
|
//
|
1039
1113
|
size?: number;
|
@@ -1099,7 +1173,6 @@ export interface ApiVoiceChannelUser {
|
|
1099
1173
|
user_id?: string;
|
1100
1174
|
}
|
1101
1175
|
|
1102
|
-
|
1103
1176
|
/** A list of users belonging to a channel, along with their role. */
|
1104
1177
|
export interface ApiVoiceChannelUserList {
|
1105
1178
|
//
|
@@ -2384,9 +2457,9 @@ export class MezonApi {
|
|
2384
2457
|
/** List a channel's message history. */
|
2385
2458
|
listChannelMessages(bearerToken: string,
|
2386
2459
|
channelId:string,
|
2387
|
-
messageId?:string,
|
2388
|
-
direction?:number,
|
2460
|
+
messageId?:string,
|
2389
2461
|
limit?:number,
|
2462
|
+
direction?:number,
|
2390
2463
|
options: any = {}): Promise<ApiChannelMessageList> {
|
2391
2464
|
|
2392
2465
|
if (channelId === null || channelId === undefined) {
|
@@ -2395,10 +2468,10 @@ export class MezonApi {
|
|
2395
2468
|
const urlPath = "/v2/channel/{channelId}"
|
2396
2469
|
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
2397
2470
|
const queryParams = new Map<string, any>();
|
2398
|
-
queryParams.set("message_id", messageId);
|
2471
|
+
queryParams.set("message_id", messageId);
|
2399
2472
|
queryParams.set("limit", limit);
|
2400
2473
|
queryParams.set("direction", direction);
|
2401
|
-
|
2474
|
+
|
2402
2475
|
let bodyJson : string = "";
|
2403
2476
|
|
2404
2477
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
@@ -2463,48 +2536,48 @@ export class MezonApi {
|
|
2463
2536
|
|
2464
2537
|
/** List all attachment that are part of a channel. */
|
2465
2538
|
listChannelAttachment(bearerToken: string,
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
2486
|
-
|
2487
|
-
|
2488
|
-
|
2489
|
-
|
2490
|
-
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
|
2497
|
-
|
2498
|
-
|
2499
|
-
|
2500
|
-
|
2501
|
-
|
2502
|
-
|
2503
|
-
|
2504
|
-
|
2505
|
-
|
2506
|
-
|
2507
|
-
|
2539
|
+
channelId:string,
|
2540
|
+
clanId?:string,
|
2541
|
+
fileType?:string,
|
2542
|
+
limit?:number,
|
2543
|
+
state?:number,
|
2544
|
+
cursor?:string,
|
2545
|
+
options: any = {}): Promise<ApiChannelAttachmentList> {
|
2546
|
+
|
2547
|
+
if (channelId === null || channelId === undefined) {
|
2548
|
+
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
2549
|
+
}
|
2550
|
+
const urlPath = "/v2/channel/{channelId}/attachment"
|
2551
|
+
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
2552
|
+
const queryParams = new Map<string, any>();
|
2553
|
+
queryParams.set("clan_id", clanId);
|
2554
|
+
queryParams.set("file_type", fileType);
|
2555
|
+
queryParams.set("limit", limit);
|
2556
|
+
queryParams.set("state", state);
|
2557
|
+
queryParams.set("cursor", cursor);
|
2558
|
+
|
2559
|
+
let bodyJson : string = "";
|
2560
|
+
|
2561
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2562
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2563
|
+
if (bearerToken) {
|
2564
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2565
|
+
}
|
2566
|
+
|
2567
|
+
return Promise.race([
|
2568
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2569
|
+
if (response.status == 204) {
|
2570
|
+
return response;
|
2571
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2572
|
+
return response.json();
|
2573
|
+
} else {
|
2574
|
+
throw response;
|
2575
|
+
}
|
2576
|
+
}),
|
2577
|
+
new Promise((_, reject) =>
|
2578
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2579
|
+
),
|
2580
|
+
]);
|
2508
2581
|
}
|
2509
2582
|
|
2510
2583
|
/** Leave a channel the user is a member of. */
|
@@ -2583,13 +2656,13 @@ export class MezonApi {
|
|
2583
2656
|
|
2584
2657
|
/** List all users that are part of a channel. */
|
2585
2658
|
listChannelUsers(bearerToken: string,
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2659
|
+
channelId:string,
|
2660
|
+
clanId?:string,
|
2661
|
+
channelType?:number,
|
2662
|
+
limit?:number,
|
2663
|
+
state?:number,
|
2664
|
+
cursor?:string,
|
2665
|
+
options: any = {}): Promise<ApiChannelUserList> {
|
2593
2666
|
|
2594
2667
|
if (channelId === null || channelId === undefined) {
|
2595
2668
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
@@ -2627,159 +2700,158 @@ export class MezonApi {
|
|
2627
2700
|
]);
|
2628
2701
|
}
|
2629
2702
|
|
2630
|
-
/** List user channels */
|
2631
|
-
listChannelDescs(bearerToken: string,
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
const urlPath = "/v2/channeldesc";
|
2640
|
-
const queryParams = new Map<string, any>();
|
2641
|
-
queryParams.set("limit", limit);
|
2642
|
-
queryParams.set("state", state);
|
2643
|
-
queryParams.set("cursor", cursor);
|
2644
|
-
queryParams.set("clan_id", clanId);
|
2645
|
-
queryParams.set("channel_type", channelType);
|
2703
|
+
/** List user channels */
|
2704
|
+
listChannelDescs(bearerToken: string,
|
2705
|
+
limit?:number,
|
2706
|
+
state?:number,
|
2707
|
+
cursor?:string,
|
2708
|
+
clanId?:string,
|
2709
|
+
channelType?:number,
|
2710
|
+
options: any = {}): Promise<ApiChannelDescList> {
|
2711
|
+
|
2712
|
+
const urlPath = "/v2/channeldesc";
|
2713
|
+
const queryParams = new Map<string, any>();
|
2714
|
+
queryParams.set("limit", limit);
|
2715
|
+
queryParams.set("state", state);
|
2716
|
+
queryParams.set("cursor", cursor);
|
2717
|
+
queryParams.set("clan_id", clanId);
|
2718
|
+
queryParams.set("channel_type", channelType);
|
2646
2719
|
|
2647
|
-
let bodyJson : string = "";
|
2648
|
-
|
2649
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2650
|
-
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2651
|
-
if (bearerToken) {
|
2652
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2653
|
-
}
|
2720
|
+
let bodyJson : string = "";
|
2654
2721
|
|
2655
|
-
|
2656
|
-
|
2657
|
-
if (
|
2658
|
-
|
2659
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2660
|
-
return response.json();
|
2661
|
-
} else {
|
2662
|
-
throw response;
|
2722
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2723
|
+
const fetchOptions = buildFetchOptions("GET", options, bodyJson);
|
2724
|
+
if (bearerToken) {
|
2725
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2663
2726
|
}
|
2664
|
-
}),
|
2665
|
-
new Promise((_, reject) =>
|
2666
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2667
|
-
),
|
2668
|
-
]);
|
2669
|
-
}
|
2670
2727
|
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
|
2684
|
-
|
2685
|
-
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2686
|
-
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2687
|
-
if (bearerToken) {
|
2688
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2728
|
+
return Promise.race([
|
2729
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2730
|
+
if (response.status == 204) {
|
2731
|
+
return response;
|
2732
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2733
|
+
return response.json();
|
2734
|
+
} else {
|
2735
|
+
throw response;
|
2736
|
+
}
|
2737
|
+
}),
|
2738
|
+
new Promise((_, reject) =>
|
2739
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2740
|
+
),
|
2741
|
+
]);
|
2689
2742
|
}
|
2690
2743
|
|
2691
|
-
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2698
|
-
throw response;
|
2744
|
+
/** Create a new channel with the current user as the owner. */
|
2745
|
+
createChannelDesc(bearerToken: string,
|
2746
|
+
body:ApiCreateChannelDescRequest,
|
2747
|
+
options: any = {}): Promise<ApiChannelDescription> {
|
2748
|
+
|
2749
|
+
if (body === null || body === undefined) {
|
2750
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2699
2751
|
}
|
2700
|
-
|
2701
|
-
|
2702
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2703
|
-
),
|
2704
|
-
]);
|
2705
|
-
}
|
2752
|
+
const urlPath = "/v2/channeldesc";
|
2753
|
+
const queryParams = new Map<string, any>();
|
2706
2754
|
|
2755
|
+
let bodyJson : string = "";
|
2756
|
+
bodyJson = JSON.stringify(body || {});
|
2707
2757
|
|
2708
|
-
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2758
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2759
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2760
|
+
if (bearerToken) {
|
2761
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2762
|
+
}
|
2712
2763
|
|
2713
|
-
|
2714
|
-
|
2764
|
+
return Promise.race([
|
2765
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2766
|
+
if (response.status == 204) {
|
2767
|
+
return response;
|
2768
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2769
|
+
return response.json();
|
2770
|
+
} else {
|
2771
|
+
throw response;
|
2772
|
+
}
|
2773
|
+
}),
|
2774
|
+
new Promise((_, reject) =>
|
2775
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2776
|
+
),
|
2777
|
+
]);
|
2715
2778
|
}
|
2716
|
-
const urlPath = "/v2/channeldesc/{channelId}"
|
2717
|
-
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
2718
|
-
const queryParams = new Map<string, any>();
|
2719
2779
|
|
2720
|
-
|
2780
|
+
/** Delete a channel by ID. */
|
2781
|
+
deleteChannelDesc(bearerToken: string,
|
2782
|
+
channelId:string,
|
2783
|
+
options: any = {}): Promise<any> {
|
2784
|
+
|
2785
|
+
if (channelId === null || channelId === undefined) {
|
2786
|
+
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
2787
|
+
}
|
2788
|
+
const urlPath = "/v2/channeldesc/{channelId}"
|
2789
|
+
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
2790
|
+
const queryParams = new Map<string, any>();
|
2721
2791
|
|
2722
|
-
|
2723
|
-
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2724
|
-
if (bearerToken) {
|
2725
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2726
|
-
}
|
2792
|
+
let bodyJson : string = "";
|
2727
2793
|
|
2728
|
-
|
2729
|
-
|
2730
|
-
if (
|
2731
|
-
|
2732
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2733
|
-
return response.json();
|
2734
|
-
} else {
|
2735
|
-
throw response;
|
2794
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2795
|
+
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
2796
|
+
if (bearerToken) {
|
2797
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2736
2798
|
}
|
2737
|
-
}),
|
2738
|
-
new Promise((_, reject) =>
|
2739
|
-
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2740
|
-
),
|
2741
|
-
]);
|
2742
|
-
}
|
2743
|
-
|
2744
|
-
/** Update fields in a given channel. */
|
2745
|
-
updateChannelDesc(bearerToken: string,
|
2746
|
-
channelId:string,
|
2747
|
-
body:{},
|
2748
|
-
options: any = {}): Promise<any> {
|
2749
2799
|
|
2750
|
-
|
2751
|
-
|
2752
|
-
|
2753
|
-
|
2754
|
-
|
2800
|
+
return Promise.race([
|
2801
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2802
|
+
if (response.status == 204) {
|
2803
|
+
return response;
|
2804
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2805
|
+
return response.json();
|
2806
|
+
} else {
|
2807
|
+
throw response;
|
2808
|
+
}
|
2809
|
+
}),
|
2810
|
+
new Promise((_, reject) =>
|
2811
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2812
|
+
),
|
2813
|
+
]);
|
2755
2814
|
}
|
2756
|
-
const urlPath = "/v2/channeldesc/{channelId}"
|
2757
|
-
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
2758
|
-
const queryParams = new Map<string, any>();
|
2759
2815
|
|
2760
|
-
|
2761
|
-
|
2816
|
+
/** Update fields in a given channel. */
|
2817
|
+
updateChannelDesc(bearerToken: string,
|
2818
|
+
channelId:string,
|
2819
|
+
body:{},
|
2820
|
+
options: any = {}): Promise<any> {
|
2821
|
+
|
2822
|
+
if (channelId === null || channelId === undefined) {
|
2823
|
+
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
2824
|
+
}
|
2825
|
+
if (body === null || body === undefined) {
|
2826
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2827
|
+
}
|
2828
|
+
const urlPath = "/v2/channeldesc/{channelId}"
|
2829
|
+
.replace("{channelId}", encodeURIComponent(String(channelId)));
|
2830
|
+
const queryParams = new Map<string, any>();
|
2762
2831
|
|
2763
|
-
|
2764
|
-
|
2765
|
-
if (bearerToken) {
|
2766
|
-
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2767
|
-
}
|
2832
|
+
let bodyJson : string = "";
|
2833
|
+
bodyJson = JSON.stringify(body || {});
|
2768
2834
|
|
2769
|
-
|
2770
|
-
|
2771
|
-
if (
|
2772
|
-
|
2773
|
-
} else if (response.status >= 200 && response.status < 300) {
|
2774
|
-
return response.json();
|
2775
|
-
} else {
|
2776
|
-
throw response;
|
2835
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2836
|
+
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
2837
|
+
if (bearerToken) {
|
2838
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2777
2839
|
}
|
2778
|
-
|
2779
|
-
|
2780
|
-
|
2781
|
-
|
2782
|
-
|
2840
|
+
|
2841
|
+
return Promise.race([
|
2842
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2843
|
+
if (response.status == 204) {
|
2844
|
+
return response;
|
2845
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2846
|
+
return response.json();
|
2847
|
+
} else {
|
2848
|
+
throw response;
|
2849
|
+
}
|
2850
|
+
}),
|
2851
|
+
new Promise((_, reject) =>
|
2852
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2853
|
+
),
|
2854
|
+
]);
|
2783
2855
|
}
|
2784
2856
|
|
2785
2857
|
/** List all users that are part of a channel. */
|
@@ -2946,13 +3018,13 @@ return Promise.race([
|
|
2946
3018
|
if (body === null || body === undefined) {
|
2947
3019
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
2948
3020
|
}
|
2949
|
-
|
3021
|
+
const urlPath = "/v2/clandesc/{clanId}"
|
2950
3022
|
.replace("{clanId}", encodeURIComponent(String(clanId)));
|
2951
3023
|
const queryParams = new Map<string, any>();
|
2952
3024
|
|
2953
3025
|
let bodyJson : string = "";
|
2954
3026
|
bodyJson = JSON.stringify(body || {});
|
2955
|
-
|
3027
|
+
|
2956
3028
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2957
3029
|
const fetchOptions = buildFetchOptions("PUT", options, bodyJson);
|
2958
3030
|
if (bearerToken) {
|
@@ -3160,7 +3232,7 @@ return Promise.race([
|
|
3160
3232
|
]);
|
3161
3233
|
}
|
3162
3234
|
|
3163
|
-
/**
|
3235
|
+
/** regist fcm device token */
|
3164
3236
|
registFCMDeviceToken(bearerToken: string,
|
3165
3237
|
token?:string,
|
3166
3238
|
deviceId?:string,
|
@@ -3197,6 +3269,42 @@ return Promise.race([
|
|
3197
3269
|
]);
|
3198
3270
|
}
|
3199
3271
|
|
3272
|
+
/** Search message from elasticsearch service. */
|
3273
|
+
searchMessage(bearerToken: string,
|
3274
|
+
body:ApiSearchMessageRequest,
|
3275
|
+
options: any = {}): Promise<ApiSearchMessageResponse> {
|
3276
|
+
|
3277
|
+
if (body === null || body === undefined) {
|
3278
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
3279
|
+
}
|
3280
|
+
const urlPath = "/v2/es/search";
|
3281
|
+
const queryParams = new Map<string, any>();
|
3282
|
+
|
3283
|
+
let bodyJson : string = "";
|
3284
|
+
bodyJson = JSON.stringify(body || {});
|
3285
|
+
|
3286
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3287
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
3288
|
+
if (bearerToken) {
|
3289
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
3290
|
+
}
|
3291
|
+
|
3292
|
+
return Promise.race([
|
3293
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
3294
|
+
if (response.status == 204) {
|
3295
|
+
return response;
|
3296
|
+
} else if (response.status >= 200 && response.status < 300) {
|
3297
|
+
return response.json();
|
3298
|
+
} else {
|
3299
|
+
throw response;
|
3300
|
+
}
|
3301
|
+
}),
|
3302
|
+
new Promise((_, reject) =>
|
3303
|
+
setTimeout(reject, this.timeoutMs, "Request timed out.")
|
3304
|
+
),
|
3305
|
+
]);
|
3306
|
+
}
|
3307
|
+
|
3200
3308
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
3201
3309
|
event(bearerToken: string,
|
3202
3310
|
body:ApiEvent,
|
@@ -4547,6 +4655,7 @@ return Promise.race([
|
|
4547
4655
|
/** Delete a role by ID. */
|
4548
4656
|
deleteRole(bearerToken: string,
|
4549
4657
|
roleId:string,
|
4658
|
+
channelId?:string,
|
4550
4659
|
options: any = {}): Promise<any> {
|
4551
4660
|
|
4552
4661
|
if (roleId === null || roleId === undefined) {
|
@@ -4555,6 +4664,7 @@ return Promise.race([
|
|
4555
4664
|
const urlPath = "/v2/roles/{roleId}"
|
4556
4665
|
.replace("{roleId}", encodeURIComponent(String(roleId)));
|
4557
4666
|
const queryParams = new Map<string, any>();
|
4667
|
+
queryParams.set("channel_id", channelId);
|
4558
4668
|
|
4559
4669
|
let bodyJson : string = "";
|
4560
4670
|
|
@@ -5096,7 +5206,7 @@ return Promise.race([
|
|
5096
5206
|
]);
|
5097
5207
|
}
|
5098
5208
|
|
5099
|
-
/**
|
5209
|
+
/** Upload attachment */
|
5100
5210
|
uploadAttachmentFile(bearerToken: string,
|
5101
5211
|
body:ApiUploadAttachmentRequest,
|
5102
5212
|
options: any = {}): Promise<ApiUploadAttachment> {
|
@@ -5205,21 +5315,21 @@ return Promise.race([
|
|
5205
5315
|
]);
|
5206
5316
|
}
|
5207
5317
|
|
5208
|
-
|
5209
|
-
|
5318
|
+
buildFullUrl(basePath: string, fragment: string, queryParams: Map<string, any>) {
|
5319
|
+
let fullPath = basePath + fragment + "?";
|
5210
5320
|
|
5211
|
-
|
5212
|
-
|
5213
|
-
|
5214
|
-
|
5215
|
-
|
5216
|
-
|
5217
|
-
|
5218
|
-
|
5219
|
-
|
5220
|
-
|
5221
|
-
|
5321
|
+
for (let [k, v] of queryParams) {
|
5322
|
+
if (v instanceof Array) {
|
5323
|
+
fullPath += v.reduce((prev: any, curr: any) => {
|
5324
|
+
return prev + encodeURIComponent(k) + "=" + encodeURIComponent(curr) + "&";
|
5325
|
+
}, "");
|
5326
|
+
} else {
|
5327
|
+
if (v != null) {
|
5328
|
+
fullPath += encodeURIComponent(k) + "=" + encodeURIComponent(v) + "&";
|
5329
|
+
}
|
5330
|
+
}
|
5331
|
+
}
|
5222
5332
|
|
5223
|
-
|
5224
|
-
|
5333
|
+
return fullPath;
|
5334
|
+
}
|
5225
5335
|
};
|
package/client.ts
CHANGED
@@ -86,6 +86,8 @@ import {
|
|
86
86
|
ApiSetNotificationRequest,
|
87
87
|
ApiNotifiReactMessage,
|
88
88
|
ApiSetMuteNotificationRequest,
|
89
|
+
ApiSearchMessageRequest,
|
90
|
+
ApiSearchMessageResponse,
|
89
91
|
} from "./api.gen";
|
90
92
|
|
91
93
|
import { Session } from "./session";
|
@@ -2103,6 +2105,18 @@ async deleteNotiReactMessage(session: Session, channel_id: string): Promise<bool
|
|
2103
2105
|
return response !== undefined;
|
2104
2106
|
});
|
2105
2107
|
}
|
2108
|
+
|
2109
|
+
/** query message in elasticsearch */
|
2110
|
+
async searchMessage(session: Session, request: ApiSearchMessageRequest): Promise<ApiSearchMessageResponse> {
|
2111
|
+
if (this.autoRefreshSession && session.refresh_token &&
|
2112
|
+
session.isexpired((Date.now() + this.expiredTimespanMs)/1000)) {
|
2113
|
+
await this.sessionRefresh(session);
|
2114
|
+
}
|
2115
|
+
|
2116
|
+
return this.apiClient.searchMessage(session.token, request).then((response: ApiSearchMessageResponse) => {
|
2117
|
+
return Promise.resolve(response);
|
2118
|
+
});
|
2119
|
+
}
|
2106
2120
|
};
|
2107
2121
|
|
2108
2122
|
|
package/dist/api.gen.d.ts
CHANGED
@@ -315,6 +315,11 @@ export interface ApiEventManagement {
|
|
315
315
|
title?: string;
|
316
316
|
user_ids?: Array<string>;
|
317
317
|
}
|
318
|
+
/** */
|
319
|
+
export interface ApiFilterParam {
|
320
|
+
field_name?: string;
|
321
|
+
field_value?: string;
|
322
|
+
}
|
318
323
|
/** A friend of a user. */
|
319
324
|
export interface ApiFriend {
|
320
325
|
state?: number;
|
@@ -501,6 +506,38 @@ export interface ApiRpc {
|
|
501
506
|
id?: string;
|
502
507
|
payload?: string;
|
503
508
|
}
|
509
|
+
/** */
|
510
|
+
export interface ApiSearchMessageDocument {
|
511
|
+
attachment?: string;
|
512
|
+
avatar_url?: string;
|
513
|
+
channel_id?: string;
|
514
|
+
channel_label?: string;
|
515
|
+
channel_type?: number;
|
516
|
+
clan_id?: string;
|
517
|
+
clan_name?: string;
|
518
|
+
content?: string;
|
519
|
+
create_time?: string;
|
520
|
+
display_name?: string;
|
521
|
+
mention?: string;
|
522
|
+
message_id?: string;
|
523
|
+
reaction?: string;
|
524
|
+
reference?: string;
|
525
|
+
sender_id?: string;
|
526
|
+
update_time?: string;
|
527
|
+
username?: string;
|
528
|
+
}
|
529
|
+
/** */
|
530
|
+
export interface ApiSearchMessageRequest {
|
531
|
+
filters?: Array<ApiFilterParam>;
|
532
|
+
from?: number;
|
533
|
+
size?: number;
|
534
|
+
sorts?: Array<ApiSortParam>;
|
535
|
+
}
|
536
|
+
/** */
|
537
|
+
export interface ApiSearchMessageResponse {
|
538
|
+
messages?: Array<ApiSearchMessageDocument>;
|
539
|
+
total?: number;
|
540
|
+
}
|
504
541
|
/** A user's session used to authenticate messages. */
|
505
542
|
export interface ApiSession {
|
506
543
|
created?: boolean;
|
@@ -535,6 +572,11 @@ export interface ApiSetNotificationRequest {
|
|
535
572
|
notification_type?: string;
|
536
573
|
time_mute?: string;
|
537
574
|
}
|
575
|
+
/** */
|
576
|
+
export interface ApiSortParam {
|
577
|
+
field_name?: string;
|
578
|
+
order?: string;
|
579
|
+
}
|
538
580
|
/** An object within the storage engine. */
|
539
581
|
export interface ApiStorageObject {
|
540
582
|
collection?: string;
|
@@ -734,7 +776,7 @@ export declare class MezonApi {
|
|
734
776
|
/** */
|
735
777
|
listCategoryDescs(bearerToken: string, clanId: string, creatorId?: string, categoryName?: string, categoryId?: string, options?: any): Promise<ApiCategoryDescList>;
|
736
778
|
/** List a channel's message history. */
|
737
|
-
listChannelMessages(bearerToken: string, channelId: string, messageId?: string,
|
779
|
+
listChannelMessages(bearerToken: string, channelId: string, messageId?: string, limit?: number, direction?: number, options?: any): Promise<ApiChannelMessageList>;
|
738
780
|
/** Add users to a channel. */
|
739
781
|
addChannelUsers(bearerToken: string, channelId: string, userIds?: Array<string>, options?: any): Promise<any>;
|
740
782
|
/** List all attachment that are part of a channel. */
|
@@ -744,7 +786,7 @@ export declare class MezonApi {
|
|
744
786
|
/** Kick a set of users from a channel. */
|
745
787
|
removeChannelUsers(bearerToken: string, channelId: string, userIds?: Array<string>, options?: any): Promise<any>;
|
746
788
|
/** List all users that are part of a channel. */
|
747
|
-
listChannelUsers(bearerToken: string,
|
789
|
+
listChannelUsers(bearerToken: string, channelId: string, clanId?: string, channelType?: number, limit?: number, state?: number, cursor?: string, options?: any): Promise<ApiChannelUserList>;
|
748
790
|
/** List user channels */
|
749
791
|
listChannelDescs(bearerToken: string, limit?: number, state?: number, cursor?: string, clanId?: string, channelType?: number, options?: any): Promise<ApiChannelDescList>;
|
750
792
|
/** Create a new channel with the current user as the owner. */
|
@@ -773,8 +815,10 @@ export declare class MezonApi {
|
|
773
815
|
createCategoryDesc(bearerToken: string, body: ApiCreateCategoryDescRequest, options?: any): Promise<ApiCategoryDesc>;
|
774
816
|
/** */
|
775
817
|
deleteCategoryDesc(bearerToken: string, creatorId: string, options?: any): Promise<any>;
|
776
|
-
/**
|
818
|
+
/** regist fcm device token */
|
777
819
|
registFCMDeviceToken(bearerToken: string, token?: string, deviceId?: string, platform?: string, options?: any): Promise<any>;
|
820
|
+
/** Search message from elasticsearch service. */
|
821
|
+
searchMessage(bearerToken: string, body: ApiSearchMessageRequest, options?: any): Promise<ApiSearchMessageResponse>;
|
778
822
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
779
823
|
event(bearerToken: string, body: ApiEvent, options?: any): Promise<any>;
|
780
824
|
/** List user events */
|
@@ -852,7 +896,7 @@ export declare class MezonApi {
|
|
852
896
|
/** Update a role when Delete a role by ID. */
|
853
897
|
updateRoleDelete(bearerToken: string, roleId: string, body: {}, options?: any): Promise<any>;
|
854
898
|
/** Delete a role by ID. */
|
855
|
-
deleteRole(bearerToken: string, roleId: string, options?: any): Promise<any>;
|
899
|
+
deleteRole(bearerToken: string, roleId: string, channelId?: string, options?: any): Promise<any>;
|
856
900
|
/** Update fields in a given role. */
|
857
901
|
updateRole(bearerToken: string, roleId: string, body: {}, options?: any): Promise<any>;
|
858
902
|
/** List role permissions */
|
@@ -879,7 +923,7 @@ export declare class MezonApi {
|
|
879
923
|
updateCategory(bearerToken: string, body: ApiUpdateCategoryDescRequest, options?: any): Promise<any>;
|
880
924
|
/** */
|
881
925
|
updateUserProfileByClan(bearerToken: string, clanId: string, body: {}, options?: any): Promise<any>;
|
882
|
-
/**
|
926
|
+
/** Upload attachment */
|
883
927
|
uploadAttachmentFile(bearerToken: string, body: ApiUploadAttachmentRequest, options?: any): Promise<ApiUploadAttachment>;
|
884
928
|
/** Fetch zero or more users by ID and/or username. */
|
885
929
|
getUsers(bearerToken: string, ids?: Array<string>, usernames?: Array<string>, facebookIds?: Array<string>, options?: any): Promise<ApiUsers>;
|
package/dist/client.d.ts
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest } from "./api.gen";
|
16
|
+
import { ApiAccount, ApiAccountCustom, ApiAccountDevice, ApiAccountEmail, ApiAccountFacebook, ApiAccountFacebookInstantGame, ApiAccountGoogle, ApiAccountGameCenter, ApiAccountSteam, ApiChannelDescList, ApiChannelDescription, ApiCreateChannelDescRequest, ApiDeleteRoleRequest, ApiClanDescList, ApiCreateClanDescRequest, ApiClanDesc, ApiCategoryDesc, ApiCategoryDescList, ApiRoleList, ApiPermissionList, ApiRoleUserList, ApiRole, ApiCreateRoleRequest, ApiAddRoleChannelDescRequest, ApiCreateCategoryDescRequest, ApiUpdateCategoryDescRequest, ApiDeleteStorageObjectsRequest, ApiEvent, ApiReadStorageObjectsRequest, ApiStorageObjectAcks, ApiUpdateAccountRequest, ApiAccountApple, ApiLinkSteamRequest, ApiClanDescProfile, ApiClanProfile, ApiChannelUserList, ApiClanUserList, ApiLinkInviteUserRequest, ApiUpdateEventRequest, ApiLinkInviteUser, ApiInviteUserRes, ApiUploadAttachmentRequest, ApiUploadAttachment, ApiMessageReaction, ApiMessageMention, ApiMessageAttachment, ApiMessageRef, ApiChannelMessageHeader, ApiVoiceChannelUserList, ApiChannelAttachmentList, ApiCreateEventRequest, ApiEventManagement, ApiEventList, ApiDeleteEventRequest, ApiNotificationChannelCategoySettingsList, ApiNotificationSetting, ApiSetDefaultNotificationRequest, ApiNotificationUserChannel, ApiSetNotificationRequest, ApiNotifiReactMessage, ApiSetMuteNotificationRequest, ApiSearchMessageRequest, ApiSearchMessageResponse } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
18
|
import { Socket } from "./socket";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
@@ -563,4 +563,6 @@ export declare class Client {
|
|
563
563
|
/** */
|
564
564
|
getNotificationReactMessage(session: Session, channelId: string): Promise<ApiNotifiReactMessage>;
|
565
565
|
deleteNotiReactMessage(session: Session, channel_id: string): Promise<boolean>;
|
566
|
+
/** query message in elasticsearch */
|
567
|
+
searchMessage(session: Session, request: ApiSearchMessageRequest): Promise<ApiSearchMessageResponse>;
|
566
568
|
}
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -1640,7 +1640,7 @@ var MezonApi = class {
|
|
1640
1640
|
]);
|
1641
1641
|
}
|
1642
1642
|
/** List a channel's message history. */
|
1643
|
-
listChannelMessages(bearerToken, channelId, messageId,
|
1643
|
+
listChannelMessages(bearerToken, channelId, messageId, limit, direction, options = {}) {
|
1644
1644
|
if (channelId === null || channelId === void 0) {
|
1645
1645
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
1646
1646
|
}
|
@@ -1790,7 +1790,7 @@ var MezonApi = class {
|
|
1790
1790
|
]);
|
1791
1791
|
}
|
1792
1792
|
/** List all users that are part of a channel. */
|
1793
|
-
listChannelUsers(bearerToken,
|
1793
|
+
listChannelUsers(bearerToken, channelId, clanId, channelType, limit, state, cursor, options = {}) {
|
1794
1794
|
if (channelId === null || channelId === void 0) {
|
1795
1795
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
1796
1796
|
}
|
@@ -2234,7 +2234,7 @@ var MezonApi = class {
|
|
2234
2234
|
)
|
2235
2235
|
]);
|
2236
2236
|
}
|
2237
|
-
/**
|
2237
|
+
/** regist fcm device token */
|
2238
2238
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
2239
2239
|
const urlPath = "/v2/devicetoken";
|
2240
2240
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -2262,6 +2262,35 @@ var MezonApi = class {
|
|
2262
2262
|
)
|
2263
2263
|
]);
|
2264
2264
|
}
|
2265
|
+
/** Search message from elasticsearch service. */
|
2266
|
+
searchMessage(bearerToken, body, options = {}) {
|
2267
|
+
if (body === null || body === void 0) {
|
2268
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2269
|
+
}
|
2270
|
+
const urlPath = "/v2/es/search";
|
2271
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2272
|
+
let bodyJson = "";
|
2273
|
+
bodyJson = JSON.stringify(body || {});
|
2274
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2275
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2276
|
+
if (bearerToken) {
|
2277
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2278
|
+
}
|
2279
|
+
return Promise.race([
|
2280
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2281
|
+
if (response.status == 204) {
|
2282
|
+
return response;
|
2283
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2284
|
+
return response.json();
|
2285
|
+
} else {
|
2286
|
+
throw response;
|
2287
|
+
}
|
2288
|
+
}),
|
2289
|
+
new Promise(
|
2290
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2291
|
+
)
|
2292
|
+
]);
|
2293
|
+
}
|
2265
2294
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
2266
2295
|
event(bearerToken, body, options = {}) {
|
2267
2296
|
if (body === null || body === void 0) {
|
@@ -3325,12 +3354,13 @@ var MezonApi = class {
|
|
3325
3354
|
]);
|
3326
3355
|
}
|
3327
3356
|
/** Delete a role by ID. */
|
3328
|
-
deleteRole(bearerToken, roleId, options = {}) {
|
3357
|
+
deleteRole(bearerToken, roleId, channelId, options = {}) {
|
3329
3358
|
if (roleId === null || roleId === void 0) {
|
3330
3359
|
throw new Error("'roleId' is a required parameter but is null or undefined.");
|
3331
3360
|
}
|
3332
3361
|
const urlPath = "/v2/roles/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
|
3333
3362
|
const queryParams = /* @__PURE__ */ new Map();
|
3363
|
+
queryParams.set("channel_id", channelId);
|
3334
3364
|
let bodyJson = "";
|
3335
3365
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3336
3366
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -3752,7 +3782,7 @@ var MezonApi = class {
|
|
3752
3782
|
)
|
3753
3783
|
]);
|
3754
3784
|
}
|
3755
|
-
/**
|
3785
|
+
/** Upload attachment */
|
3756
3786
|
uploadAttachmentFile(bearerToken, body, options = {}) {
|
3757
3787
|
if (body === null || body === void 0) {
|
3758
3788
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
@@ -5979,4 +6009,15 @@ var Client = class {
|
|
5979
6009
|
});
|
5980
6010
|
});
|
5981
6011
|
}
|
6012
|
+
/** query message in elasticsearch */
|
6013
|
+
searchMessage(session, request) {
|
6014
|
+
return __async(this, null, function* () {
|
6015
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
6016
|
+
yield this.sessionRefresh(session);
|
6017
|
+
}
|
6018
|
+
return this.apiClient.searchMessage(session.token, request).then((response) => {
|
6019
|
+
return Promise.resolve(response);
|
6020
|
+
});
|
6021
|
+
});
|
6022
|
+
}
|
5982
6023
|
};
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -1611,7 +1611,7 @@ var MezonApi = class {
|
|
1611
1611
|
]);
|
1612
1612
|
}
|
1613
1613
|
/** List a channel's message history. */
|
1614
|
-
listChannelMessages(bearerToken, channelId, messageId,
|
1614
|
+
listChannelMessages(bearerToken, channelId, messageId, limit, direction, options = {}) {
|
1615
1615
|
if (channelId === null || channelId === void 0) {
|
1616
1616
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
1617
1617
|
}
|
@@ -1761,7 +1761,7 @@ var MezonApi = class {
|
|
1761
1761
|
]);
|
1762
1762
|
}
|
1763
1763
|
/** List all users that are part of a channel. */
|
1764
|
-
listChannelUsers(bearerToken,
|
1764
|
+
listChannelUsers(bearerToken, channelId, clanId, channelType, limit, state, cursor, options = {}) {
|
1765
1765
|
if (channelId === null || channelId === void 0) {
|
1766
1766
|
throw new Error("'channelId' is a required parameter but is null or undefined.");
|
1767
1767
|
}
|
@@ -2205,7 +2205,7 @@ var MezonApi = class {
|
|
2205
2205
|
)
|
2206
2206
|
]);
|
2207
2207
|
}
|
2208
|
-
/**
|
2208
|
+
/** regist fcm device token */
|
2209
2209
|
registFCMDeviceToken(bearerToken, token, deviceId, platform, options = {}) {
|
2210
2210
|
const urlPath = "/v2/devicetoken";
|
2211
2211
|
const queryParams = /* @__PURE__ */ new Map();
|
@@ -2233,6 +2233,35 @@ var MezonApi = class {
|
|
2233
2233
|
)
|
2234
2234
|
]);
|
2235
2235
|
}
|
2236
|
+
/** Search message from elasticsearch service. */
|
2237
|
+
searchMessage(bearerToken, body, options = {}) {
|
2238
|
+
if (body === null || body === void 0) {
|
2239
|
+
throw new Error("'body' is a required parameter but is null or undefined.");
|
2240
|
+
}
|
2241
|
+
const urlPath = "/v2/es/search";
|
2242
|
+
const queryParams = /* @__PURE__ */ new Map();
|
2243
|
+
let bodyJson = "";
|
2244
|
+
bodyJson = JSON.stringify(body || {});
|
2245
|
+
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
2246
|
+
const fetchOptions = buildFetchOptions("POST", options, bodyJson);
|
2247
|
+
if (bearerToken) {
|
2248
|
+
fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
|
2249
|
+
}
|
2250
|
+
return Promise.race([
|
2251
|
+
fetch(fullUrl, fetchOptions).then((response) => {
|
2252
|
+
if (response.status == 204) {
|
2253
|
+
return response;
|
2254
|
+
} else if (response.status >= 200 && response.status < 300) {
|
2255
|
+
return response.json();
|
2256
|
+
} else {
|
2257
|
+
throw response;
|
2258
|
+
}
|
2259
|
+
}),
|
2260
|
+
new Promise(
|
2261
|
+
(_, reject) => setTimeout(reject, this.timeoutMs, "Request timed out.")
|
2262
|
+
)
|
2263
|
+
]);
|
2264
|
+
}
|
2236
2265
|
/** Submit an event for processing in the server's registered runtime custom events handler. */
|
2237
2266
|
event(bearerToken, body, options = {}) {
|
2238
2267
|
if (body === null || body === void 0) {
|
@@ -3296,12 +3325,13 @@ var MezonApi = class {
|
|
3296
3325
|
]);
|
3297
3326
|
}
|
3298
3327
|
/** Delete a role by ID. */
|
3299
|
-
deleteRole(bearerToken, roleId, options = {}) {
|
3328
|
+
deleteRole(bearerToken, roleId, channelId, options = {}) {
|
3300
3329
|
if (roleId === null || roleId === void 0) {
|
3301
3330
|
throw new Error("'roleId' is a required parameter but is null or undefined.");
|
3302
3331
|
}
|
3303
3332
|
const urlPath = "/v2/roles/{roleId}".replace("{roleId}", encodeURIComponent(String(roleId)));
|
3304
3333
|
const queryParams = /* @__PURE__ */ new Map();
|
3334
|
+
queryParams.set("channel_id", channelId);
|
3305
3335
|
let bodyJson = "";
|
3306
3336
|
const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
|
3307
3337
|
const fetchOptions = buildFetchOptions("DELETE", options, bodyJson);
|
@@ -3723,7 +3753,7 @@ var MezonApi = class {
|
|
3723
3753
|
)
|
3724
3754
|
]);
|
3725
3755
|
}
|
3726
|
-
/**
|
3756
|
+
/** Upload attachment */
|
3727
3757
|
uploadAttachmentFile(bearerToken, body, options = {}) {
|
3728
3758
|
if (body === null || body === void 0) {
|
3729
3759
|
throw new Error("'body' is a required parameter but is null or undefined.");
|
@@ -5950,6 +5980,17 @@ var Client = class {
|
|
5950
5980
|
});
|
5951
5981
|
});
|
5952
5982
|
}
|
5983
|
+
/** query message in elasticsearch */
|
5984
|
+
searchMessage(session, request) {
|
5985
|
+
return __async(this, null, function* () {
|
5986
|
+
if (this.autoRefreshSession && session.refresh_token && session.isexpired((Date.now() + this.expiredTimespanMs) / 1e3)) {
|
5987
|
+
yield this.sessionRefresh(session);
|
5988
|
+
}
|
5989
|
+
return this.apiClient.searchMessage(session.token, request).then((response) => {
|
5990
|
+
return Promise.resolve(response);
|
5991
|
+
});
|
5992
|
+
});
|
5993
|
+
}
|
5953
5994
|
};
|
5954
5995
|
export {
|
5955
5996
|
ChannelStreamMode,
|