mezon-js 2.13.72 → 2.13.73

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/api/api.ts CHANGED
@@ -3784,6 +3784,8 @@ export interface LogedDevice {
3784
3784
  platform: string;
3785
3785
  ip: string;
3786
3786
  last_active: Date | undefined;
3787
+ location: string;
3788
+ is_current_device: boolean;
3787
3789
  }
3788
3790
 
3789
3791
  function createBaseAccount(): Account {
@@ -38872,6 +38874,8 @@ function createBaseLogedDevice(): LogedDevice {
38872
38874
  platform: "",
38873
38875
  ip: "",
38874
38876
  last_active: undefined,
38877
+ location: "",
38878
+ is_current_device: false,
38875
38879
  };
38876
38880
  }
38877
38881
 
@@ -38898,6 +38902,12 @@ export const LogedDevice = {
38898
38902
  if (message.last_active !== undefined) {
38899
38903
  Timestamp.encode(toTimestamp(message.last_active), writer.uint32(58).fork()).ldelim();
38900
38904
  }
38905
+ if (message.location !== "") {
38906
+ writer.uint32(66).string(message.location);
38907
+ }
38908
+ if (message.is_current_device !== false) {
38909
+ writer.uint32(72).bool(message.is_current_device);
38910
+ }
38901
38911
  return writer;
38902
38912
  },
38903
38913
 
@@ -38957,6 +38967,20 @@ export const LogedDevice = {
38957
38967
 
38958
38968
  message.last_active = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
38959
38969
  continue;
38970
+ case 8:
38971
+ if (tag !== 66) {
38972
+ break;
38973
+ }
38974
+
38975
+ message.location = reader.string();
38976
+ continue;
38977
+ case 9:
38978
+ if (tag !== 72) {
38979
+ break;
38980
+ }
38981
+
38982
+ message.is_current_device = reader.bool();
38983
+ continue;
38960
38984
  }
38961
38985
  if ((tag & 7) === 4 || tag === 0) {
38962
38986
  break;
@@ -38975,6 +38999,8 @@ export const LogedDevice = {
38975
38999
  platform: isSet(object.platform) ? globalThis.String(object.platform) : "",
38976
39000
  ip: isSet(object.ip) ? globalThis.String(object.ip) : "",
38977
39001
  last_active: isSet(object.last_active) ? fromJsonTimestamp(object.last_active) : undefined,
39002
+ location: isSet(object.location) ? globalThis.String(object.location) : "",
39003
+ is_current_device: isSet(object.is_current_device) ? globalThis.Boolean(object.is_current_device) : false,
38978
39004
  };
38979
39005
  },
38980
39006
 
@@ -39001,6 +39027,12 @@ export const LogedDevice = {
39001
39027
  if (message.last_active !== undefined) {
39002
39028
  obj.last_active = message.last_active.toISOString();
39003
39029
  }
39030
+ if (message.location !== "") {
39031
+ obj.location = message.location;
39032
+ }
39033
+ if (message.is_current_device !== false) {
39034
+ obj.is_current_device = message.is_current_device;
39035
+ }
39004
39036
  return obj;
39005
39037
  },
39006
39038
 
@@ -39016,6 +39048,8 @@ export const LogedDevice = {
39016
39048
  message.platform = object.platform ?? "";
39017
39049
  message.ip = object.ip ?? "";
39018
39050
  message.last_active = object.last_active ?? undefined;
39051
+ message.location = object.location ?? "";
39052
+ message.is_current_device = object.is_current_device ?? false;
39019
39053
  return message;
39020
39054
  },
39021
39055
  };
package/api.gen.ts CHANGED
@@ -196,6 +196,10 @@ export interface ApiLogedDevice {
196
196
  platform?: string;
197
197
  //
198
198
  status?: number;
199
+ //
200
+ location?: string;
201
+ //
202
+ is_current?: boolean;
199
203
  }
200
204
 
201
205
  /** */
@@ -2918,36 +2922,6 @@ export interface ApiVoiceChannelUserList {
2918
2922
  voice_channel_users?: Array<ApiVoiceChannelUser>;
2919
2923
  }
2920
2924
 
2921
- /** */
2922
- export interface ApiStoreWalletKeyRequest {
2923
- //
2924
- address?: string;
2925
- //
2926
- enc_privkey?: string;
2927
- }
2928
-
2929
- /** */
2930
- export interface ApiWalletLedger {
2931
- //
2932
- create_time?: string;
2933
- //
2934
- id?: string;
2935
- //
2936
- transaction_id?: string;
2937
- //
2938
- user_id?: string;
2939
- //
2940
- value?: number;
2941
- }
2942
-
2943
- /** */
2944
- export interface ApiWalletLedgerList {
2945
- //
2946
- count?: number;
2947
- //
2948
- wallet_ledger?: Array<ApiWalletLedger>;
2949
- }
2950
-
2951
2925
  /** */
2952
2926
  export interface ApiWebhook {
2953
2927
  //
@@ -4105,28 +4079,33 @@ export class MezonApi {
4105
4079
  const urlPath = "/v2/account/session/refresh";
4106
4080
  const queryParams = new Map<string, any>();
4107
4081
 
4108
- let bodyJson: string = "";
4109
- bodyJson = JSON.stringify(body || {});
4110
-
4082
+ const bodyWriter = tsproto.SessionRefreshRequest.encode(
4083
+ tsproto.SessionRefreshRequest.fromPartial(body)
4084
+ );
4085
+ const encodedBody = bodyWriter.finish();
4111
4086
  const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
4112
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
4087
+ const fetchOptions = buildFetchOptions("POST", options, '');
4088
+ fetchOptions.body = encodedBody;
4113
4089
  if (basicAuthUsername) {
4114
4090
  fetchOptions.headers["Authorization"] =
4115
4091
  "Basic " + encode(basicAuthUsername + ":" + basicAuthPassword);
4116
4092
  }
4093
+ fetchOptions.headers["Content-Type"] = "application/x-protobuf";
4094
+ fetchOptions.headers["Accept"] = "application/x-protobuf";
4117
4095
 
4118
4096
  return Promise.race([
4119
- fetch(fullUrl, fetchOptions).then((response) => {
4097
+ fetch(fullUrl, fetchOptions).then(async (response) => {
4120
4098
  if (response.status == 204) {
4121
- return response;
4099
+ return {} as ApiSession;
4122
4100
  } else if (response.status >= 200 && response.status < 300) {
4123
- return response.json();
4101
+ const buffer = await response.arrayBuffer();
4102
+ return tsproto.Session.decode(new Uint8Array(buffer)) as unknown as ApiSession;
4124
4103
  } else {
4125
4104
  throw response;
4126
4105
  }
4127
4106
  }),
4128
- new Promise((_, reject) =>
4129
- setTimeout(reject, this.timeoutMs, "Request timed out.")
4107
+ new Promise<never>((_, reject) =>
4108
+ setTimeout(() => reject(new Error("Request timed out.")), this.timeoutMs)
4130
4109
  ),
4131
4110
  ]);
4132
4111
  }
@@ -6215,19 +6194,21 @@ export class MezonApi {
6215
6194
  if (bearerToken) {
6216
6195
  fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
6217
6196
  }
6197
+ fetchOptions.headers["Accept"] = "application/x-protobuf";
6218
6198
 
6219
6199
  return Promise.race([
6220
- fetch(fullUrl, fetchOptions).then((response) => {
6200
+ fetch(fullUrl, fetchOptions).then(async (response) => {
6221
6201
  if (response.status == 204) {
6222
- return response;
6202
+ return {} as ApiRegistFcmDeviceTokenResponse;
6223
6203
  } else if (response.status >= 200 && response.status < 300) {
6224
- return response.json();
6204
+ const buffer = await response.arrayBuffer();
6205
+ return tsproto.RegistFcmDeviceTokenResponse.decode(new Uint8Array(buffer)) as unknown as ApiRegistFcmDeviceTokenResponse;
6225
6206
  } else {
6226
6207
  throw response;
6227
6208
  }
6228
6209
  }),
6229
- new Promise((_, reject) =>
6230
- setTimeout(reject, this.timeoutMs, "Request timed out.")
6210
+ new Promise<never>((_, reject) =>
6211
+ setTimeout(() => reject(new Error("Request timed out.")), this.timeoutMs)
6231
6212
  ),
6232
6213
  ]);
6233
6214
  }
@@ -9967,42 +9948,6 @@ export class MezonApi {
9967
9948
  ]);
9968
9949
  }
9969
9950
 
9970
- /** Store wallet key */
9971
- storeWalletKey(bearerToken: string,
9972
- body:ApiStoreWalletKeyRequest,
9973
- options: any = {}): Promise<any> {
9974
-
9975
- if (body === null || body === undefined) {
9976
- throw new Error("'body' is a required parameter but is null or undefined.");
9977
- }
9978
- const urlPath = "/v2/wallet/key";
9979
- const queryParams = new Map<string, any>();
9980
-
9981
- let bodyJson : string = "";
9982
- bodyJson = JSON.stringify(body || {});
9983
-
9984
- const fullUrl = this.buildFullUrl(this.basePath, urlPath, queryParams);
9985
- const fetchOptions = buildFetchOptions("POST", options, bodyJson);
9986
- if (bearerToken) {
9987
- fetchOptions.headers["Authorization"] = "Bearer " + bearerToken;
9988
- }
9989
-
9990
- return Promise.race([
9991
- fetch(fullUrl, fetchOptions).then((response) => {
9992
- if (response.status == 204) {
9993
- return response;
9994
- } else if (response.status >= 200 && response.status < 300) {
9995
- return response.json();
9996
- } else {
9997
- throw response;
9998
- }
9999
- }),
10000
- new Promise((_, reject) =>
10001
- setTimeout(reject, this.timeoutMs, "Request timed out.")
10002
- ),
10003
- ]);
10004
- }
10005
-
10006
9951
  /** create webhook */
10007
9952
  generateWebhook(
10008
9953
  bearerToken: string,
package/dist/api/api.d.ts CHANGED
@@ -3117,6 +3117,8 @@ export interface LogedDevice {
3117
3117
  platform: string;
3118
3118
  ip: string;
3119
3119
  last_active: Date | undefined;
3120
+ location: string;
3121
+ is_current_device: boolean;
3120
3122
  }
3121
3123
  export declare const Account: {
3122
3124
  encode(message: Account, writer?: _m0.Writer): _m0.Writer;
@@ -23772,6 +23774,8 @@ export declare const LogedDeviceList: {
23772
23774
  platform?: string | undefined;
23773
23775
  ip?: string | undefined;
23774
23776
  last_active?: Date | undefined;
23777
+ location?: string | undefined;
23778
+ is_current_device?: boolean | undefined;
23775
23779
  }[] | undefined;
23776
23780
  } & {
23777
23781
  devices?: ({
@@ -23782,6 +23786,8 @@ export declare const LogedDeviceList: {
23782
23786
  platform?: string | undefined;
23783
23787
  ip?: string | undefined;
23784
23788
  last_active?: Date | undefined;
23789
+ location?: string | undefined;
23790
+ is_current_device?: boolean | undefined;
23785
23791
  }[] & ({
23786
23792
  device_id?: string | undefined;
23787
23793
  device_name?: string | undefined;
@@ -23790,6 +23796,8 @@ export declare const LogedDeviceList: {
23790
23796
  platform?: string | undefined;
23791
23797
  ip?: string | undefined;
23792
23798
  last_active?: Date | undefined;
23799
+ location?: string | undefined;
23800
+ is_current_device?: boolean | undefined;
23793
23801
  } & {
23794
23802
  device_id?: string | undefined;
23795
23803
  device_name?: string | undefined;
@@ -23798,6 +23806,8 @@ export declare const LogedDeviceList: {
23798
23806
  platform?: string | undefined;
23799
23807
  ip?: string | undefined;
23800
23808
  last_active?: Date | undefined;
23809
+ location?: string | undefined;
23810
+ is_current_device?: boolean | undefined;
23801
23811
  } & { [K in Exclude<keyof I["devices"][number], keyof LogedDevice>]: never; })[] & { [K_1 in Exclude<keyof I["devices"], keyof {
23802
23812
  device_id?: string | undefined;
23803
23813
  device_name?: string | undefined;
@@ -23806,6 +23816,8 @@ export declare const LogedDeviceList: {
23806
23816
  platform?: string | undefined;
23807
23817
  ip?: string | undefined;
23808
23818
  last_active?: Date | undefined;
23819
+ location?: string | undefined;
23820
+ is_current_device?: boolean | undefined;
23809
23821
  }[]>]: never; }) | undefined;
23810
23822
  } & { [K_2 in Exclude<keyof I, "devices">]: never; }>(base?: I | undefined): LogedDeviceList;
23811
23823
  fromPartial<I_1 extends {
@@ -23817,6 +23829,8 @@ export declare const LogedDeviceList: {
23817
23829
  platform?: string | undefined;
23818
23830
  ip?: string | undefined;
23819
23831
  last_active?: Date | undefined;
23832
+ location?: string | undefined;
23833
+ is_current_device?: boolean | undefined;
23820
23834
  }[] | undefined;
23821
23835
  } & {
23822
23836
  devices?: ({
@@ -23827,6 +23841,8 @@ export declare const LogedDeviceList: {
23827
23841
  platform?: string | undefined;
23828
23842
  ip?: string | undefined;
23829
23843
  last_active?: Date | undefined;
23844
+ location?: string | undefined;
23845
+ is_current_device?: boolean | undefined;
23830
23846
  }[] & ({
23831
23847
  device_id?: string | undefined;
23832
23848
  device_name?: string | undefined;
@@ -23835,6 +23851,8 @@ export declare const LogedDeviceList: {
23835
23851
  platform?: string | undefined;
23836
23852
  ip?: string | undefined;
23837
23853
  last_active?: Date | undefined;
23854
+ location?: string | undefined;
23855
+ is_current_device?: boolean | undefined;
23838
23856
  } & {
23839
23857
  device_id?: string | undefined;
23840
23858
  device_name?: string | undefined;
@@ -23843,6 +23861,8 @@ export declare const LogedDeviceList: {
23843
23861
  platform?: string | undefined;
23844
23862
  ip?: string | undefined;
23845
23863
  last_active?: Date | undefined;
23864
+ location?: string | undefined;
23865
+ is_current_device?: boolean | undefined;
23846
23866
  } & { [K_3 in Exclude<keyof I_1["devices"][number], keyof LogedDevice>]: never; })[] & { [K_4 in Exclude<keyof I_1["devices"], keyof {
23847
23867
  device_id?: string | undefined;
23848
23868
  device_name?: string | undefined;
@@ -23851,6 +23871,8 @@ export declare const LogedDeviceList: {
23851
23871
  platform?: string | undefined;
23852
23872
  ip?: string | undefined;
23853
23873
  last_active?: Date | undefined;
23874
+ location?: string | undefined;
23875
+ is_current_device?: boolean | undefined;
23854
23876
  }[]>]: never; }) | undefined;
23855
23877
  } & { [K_5 in Exclude<keyof I_1, "devices">]: never; }>(object: I_1): LogedDeviceList;
23856
23878
  };
@@ -23867,6 +23889,8 @@ export declare const LogedDevice: {
23867
23889
  platform?: string | undefined;
23868
23890
  ip?: string | undefined;
23869
23891
  last_active?: Date | undefined;
23892
+ location?: string | undefined;
23893
+ is_current_device?: boolean | undefined;
23870
23894
  } & {
23871
23895
  device_id?: string | undefined;
23872
23896
  device_name?: string | undefined;
@@ -23875,6 +23899,8 @@ export declare const LogedDevice: {
23875
23899
  platform?: string | undefined;
23876
23900
  ip?: string | undefined;
23877
23901
  last_active?: Date | undefined;
23902
+ location?: string | undefined;
23903
+ is_current_device?: boolean | undefined;
23878
23904
  } & { [K in Exclude<keyof I, keyof LogedDevice>]: never; }>(base?: I | undefined): LogedDevice;
23879
23905
  fromPartial<I_1 extends {
23880
23906
  device_id?: string | undefined;
@@ -23884,6 +23910,8 @@ export declare const LogedDevice: {
23884
23910
  platform?: string | undefined;
23885
23911
  ip?: string | undefined;
23886
23912
  last_active?: Date | undefined;
23913
+ location?: string | undefined;
23914
+ is_current_device?: boolean | undefined;
23887
23915
  } & {
23888
23916
  device_id?: string | undefined;
23889
23917
  device_name?: string | undefined;
@@ -23892,6 +23920,8 @@ export declare const LogedDevice: {
23892
23920
  platform?: string | undefined;
23893
23921
  ip?: string | undefined;
23894
23922
  last_active?: Date | undefined;
23923
+ location?: string | undefined;
23924
+ is_current_device?: boolean | undefined;
23895
23925
  } & { [K_1 in Exclude<keyof I_1, keyof LogedDevice>]: never; }>(object: I_1): LogedDevice;
23896
23926
  };
23897
23927
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
package/dist/api.gen.d.ts CHANGED
@@ -112,6 +112,8 @@ export interface ApiLogedDevice {
112
112
  login_at?: string;
113
113
  platform?: string;
114
114
  status?: number;
115
+ location?: string;
116
+ is_current?: boolean;
115
117
  }
116
118
  /** */
117
119
  export interface ApiLogedDeviceList {
@@ -1668,24 +1670,6 @@ export interface ApiVoiceChannelUserList {
1668
1670
  voice_channel_users?: Array<ApiVoiceChannelUser>;
1669
1671
  }
1670
1672
  /** */
1671
- export interface ApiStoreWalletKeyRequest {
1672
- address?: string;
1673
- enc_privkey?: string;
1674
- }
1675
- /** */
1676
- export interface ApiWalletLedger {
1677
- create_time?: string;
1678
- id?: string;
1679
- transaction_id?: string;
1680
- user_id?: string;
1681
- value?: number;
1682
- }
1683
- /** */
1684
- export interface ApiWalletLedgerList {
1685
- count?: number;
1686
- wallet_ledger?: Array<ApiWalletLedger>;
1687
- }
1688
- /** */
1689
1673
  export interface ApiWebhook {
1690
1674
  active?: number;
1691
1675
  avatar?: string;
@@ -2320,8 +2304,6 @@ export declare class MezonApi {
2320
2304
  getUserStatus(bearerToken: string, options?: any): Promise<ApiUserStatus>;
2321
2305
  /** Update user status */
2322
2306
  updateUserStatus(bearerToken: string, body: ApiUserStatusUpdate, options?: any): Promise<any>;
2323
- /** Store wallet key */
2324
- storeWalletKey(bearerToken: string, body: ApiStoreWalletKeyRequest, options?: any): Promise<any>;
2325
2307
  /** create webhook */
2326
2308
  generateWebhook(bearerToken: string, body: ApiWebhookCreateRequest, options?: any): Promise<any>;
2327
2309
  /** update webhook name by id */