@appwrite.io/console 18.4.0-rc.1 → 18.4.0

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/cjs/sdk.js CHANGED
@@ -669,7 +669,7 @@ class Client {
669
669
  'x-sdk-name': 'Console',
670
670
  'x-sdk-platform': 'console',
671
671
  'x-sdk-language': 'web',
672
- 'x-sdk-version': '18.4.0-rc.1',
672
+ 'x-sdk-version': '18.4.0',
673
673
  'X-Appwrite-Response-Format': '2.3.0',
674
674
  };
675
675
  this.realtime = {
@@ -1522,6 +1522,29 @@ class Client {
1522
1522
  }
1523
1523
  Client.CHUNK_SIZE = 1024 * 1024 * 5;
1524
1524
 
1525
+ class Service {
1526
+ constructor(client) {
1527
+ this.client = client;
1528
+ }
1529
+ static flatten(data, prefix = '') {
1530
+ let output = {};
1531
+ for (const [key, value] of Object.entries(data)) {
1532
+ const finalKey = prefix ? prefix + '[' + key + ']' : key;
1533
+ if (Array.isArray(value)) {
1534
+ output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
1535
+ }
1536
+ else {
1537
+ output[finalKey] = value;
1538
+ }
1539
+ }
1540
+ return output;
1541
+ }
1542
+ }
1543
+ /**
1544
+ * The size for chunked uploads in bytes.
1545
+ */
1546
+ Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
1547
+
1525
1548
  class Account {
1526
1549
  constructor(client) {
1527
1550
  this.client = client;
@@ -2998,27 +3021,19 @@ class Account {
2998
3021
  else {
2999
3022
  params = {
3000
3023
  passkeyId: paramsOrFirst,
3001
- challengeId: rest[0],
3002
- credential: rest[1],
3024
+ credential: rest[0],
3003
3025
  };
3004
3026
  }
3005
3027
  const passkeyId = params.passkeyId;
3006
- const challengeId = params.challengeId;
3007
3028
  const credential = params.credential;
3008
3029
  if (typeof passkeyId === 'undefined' || passkeyId === '') {
3009
3030
  throw new AppwriteException('Missing required parameter: "passkeyId"');
3010
3031
  }
3011
- if (typeof challengeId === 'undefined') {
3012
- throw new AppwriteException('Missing required parameter: "challengeId"');
3013
- }
3014
3032
  if (typeof credential === 'undefined') {
3015
3033
  throw new AppwriteException('Missing required parameter: "credential"');
3016
3034
  }
3017
3035
  const apiPath = '/account/passkeys/{passkeyId}/verification'.replace('{passkeyId}', encodeURIComponent(String(passkeyId)));
3018
3036
  const apiPayload = {};
3019
- if (typeof challengeId !== 'undefined') {
3020
- apiPayload['challengeId'] = challengeId;
3021
- }
3022
3037
  if (typeof credential !== 'undefined') {
3023
3038
  apiPayload['credential'] = credential;
3024
3039
  }
@@ -3773,7 +3788,7 @@ class Account {
3773
3788
  }
3774
3789
  const uri = new URL(this.client.config.endpoint + apiPath);
3775
3790
  apiPayload['project'] = this.client.config.project;
3776
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
3791
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
3777
3792
  uri.searchParams.append(key, value);
3778
3793
  }
3779
3794
  if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
@@ -4182,7 +4197,7 @@ class Account {
4182
4197
  }
4183
4198
  const uri = new URL(this.client.config.endpoint + apiPath);
4184
4199
  apiPayload['project'] = this.client.config.project;
4185
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
4200
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
4186
4201
  uri.searchParams.append(key, value);
4187
4202
  }
4188
4203
  if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
@@ -4593,135 +4608,6 @@ class Activities {
4593
4608
  }
4594
4609
  }
4595
4610
 
4596
- class Admin {
4597
- constructor(client) {
4598
- this.client = client;
4599
- }
4600
- /**
4601
- * Delete everything cached from the platform database in the region serving the request.
4602
- *
4603
- * @throws {AppwriteException}
4604
- * @returns {Promise<{}>}
4605
- */
4606
- deletePlatformCache() {
4607
- const apiPath = '/admin/cache/platform';
4608
- const apiPayload = {};
4609
- const uri = new URL(this.client.config.endpoint + apiPath);
4610
- const apiHeaders = {
4611
- 'X-Appwrite-Project': this.client.config.project,
4612
- 'content-type': 'application/json',
4613
- accept: 'application/json',
4614
- };
4615
- return this.client.call('delete', uri, apiHeaders, apiPayload);
4616
- }
4617
- deletePlatformResourceCache(paramsOrFirst, ...rest) {
4618
- let params;
4619
- if (paramsOrFirst &&
4620
- typeof paramsOrFirst === 'object' &&
4621
- !Array.isArray(paramsOrFirst) &&
4622
- ('resourceType' in paramsOrFirst || 'resourceId' in paramsOrFirst)) {
4623
- params = (paramsOrFirst || {});
4624
- }
4625
- else {
4626
- params = {
4627
- resourceType: paramsOrFirst,
4628
- resourceId: rest[0],
4629
- };
4630
- }
4631
- const resourceType = params.resourceType;
4632
- const resourceId = params.resourceId;
4633
- if (typeof resourceType === 'undefined') {
4634
- throw new AppwriteException('Missing required parameter: "resourceType"');
4635
- }
4636
- const apiPath = '/admin/cache/platform/resources';
4637
- const apiPayload = {};
4638
- if (typeof resourceType !== 'undefined') {
4639
- apiPayload['resourceType'] = resourceType;
4640
- }
4641
- if (typeof resourceId !== 'undefined') {
4642
- apiPayload['resourceId'] = resourceId;
4643
- }
4644
- const uri = new URL(this.client.config.endpoint + apiPath);
4645
- const apiHeaders = {
4646
- 'X-Appwrite-Project': this.client.config.project,
4647
- 'content-type': 'application/json',
4648
- accept: 'application/json',
4649
- };
4650
- return this.client.call('delete', uri, apiHeaders, apiPayload);
4651
- }
4652
- deleteProjectCache(paramsOrFirst) {
4653
- let params;
4654
- if (paramsOrFirst &&
4655
- typeof paramsOrFirst === 'object' &&
4656
- !Array.isArray(paramsOrFirst)) {
4657
- params = (paramsOrFirst || {});
4658
- }
4659
- else {
4660
- params = {
4661
- projectId: paramsOrFirst,
4662
- };
4663
- }
4664
- const projectId = params.projectId;
4665
- if (typeof projectId === 'undefined') {
4666
- throw new AppwriteException('Missing required parameter: "projectId"');
4667
- }
4668
- const apiPath = '/admin/cache/project';
4669
- const apiPayload = {};
4670
- if (typeof projectId !== 'undefined') {
4671
- apiPayload['projectId'] = projectId;
4672
- }
4673
- const uri = new URL(this.client.config.endpoint + apiPath);
4674
- const apiHeaders = {
4675
- 'X-Appwrite-Project': this.client.config.project,
4676
- 'content-type': 'application/json',
4677
- accept: 'application/json',
4678
- };
4679
- return this.client.call('delete', uri, apiHeaders, apiPayload);
4680
- }
4681
- deleteProjectResourceCache(paramsOrFirst, ...rest) {
4682
- let params;
4683
- if (paramsOrFirst &&
4684
- typeof paramsOrFirst === 'object' &&
4685
- !Array.isArray(paramsOrFirst)) {
4686
- params = (paramsOrFirst || {});
4687
- }
4688
- else {
4689
- params = {
4690
- projectId: paramsOrFirst,
4691
- resourceType: rest[0],
4692
- resourceId: rest[1],
4693
- };
4694
- }
4695
- const projectId = params.projectId;
4696
- const resourceType = params.resourceType;
4697
- const resourceId = params.resourceId;
4698
- if (typeof projectId === 'undefined') {
4699
- throw new AppwriteException('Missing required parameter: "projectId"');
4700
- }
4701
- if (typeof resourceType === 'undefined') {
4702
- throw new AppwriteException('Missing required parameter: "resourceType"');
4703
- }
4704
- const apiPath = '/admin/cache/project/resources';
4705
- const apiPayload = {};
4706
- if (typeof projectId !== 'undefined') {
4707
- apiPayload['projectId'] = projectId;
4708
- }
4709
- if (typeof resourceType !== 'undefined') {
4710
- apiPayload['resourceType'] = resourceType;
4711
- }
4712
- if (typeof resourceId !== 'undefined') {
4713
- apiPayload['resourceId'] = resourceId;
4714
- }
4715
- const uri = new URL(this.client.config.endpoint + apiPath);
4716
- const apiHeaders = {
4717
- 'X-Appwrite-Project': this.client.config.project,
4718
- 'content-type': 'application/json',
4719
- accept: 'application/json',
4720
- };
4721
- return this.client.call('delete', uri, apiHeaders, apiPayload);
4722
- }
4723
- }
4724
-
4725
4611
  class Affiliates {
4726
4612
  constructor(client) {
4727
4613
  this.client = client;
@@ -4933,369 +4819,6 @@ class Affiliates {
4933
4819
  }
4934
4820
  }
4935
4821
 
4936
- class Analytics {
4937
- constructor(client) {
4938
- this.client = client;
4939
- }
4940
- listProperties(paramsOrFirst, ...rest) {
4941
- let params;
4942
- if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
4943
- (paramsOrFirst &&
4944
- typeof paramsOrFirst === 'object' &&
4945
- !Array.isArray(paramsOrFirst))) {
4946
- params = (paramsOrFirst || {});
4947
- }
4948
- else {
4949
- params = {
4950
- queries: paramsOrFirst,
4951
- search: rest[0],
4952
- total: rest[1],
4953
- };
4954
- }
4955
- const queries = params.queries;
4956
- const search = params.search;
4957
- const total = params.total;
4958
- const apiPath = '/analytics/properties';
4959
- const apiPayload = {};
4960
- if (typeof queries !== 'undefined') {
4961
- apiPayload['queries'] = queries;
4962
- }
4963
- if (typeof search !== 'undefined') {
4964
- apiPayload['search'] = search;
4965
- }
4966
- if (typeof total !== 'undefined') {
4967
- apiPayload['total'] = total;
4968
- }
4969
- const uri = new URL(this.client.config.endpoint + apiPath);
4970
- const apiHeaders = {
4971
- 'X-Appwrite-Project': this.client.config.project,
4972
- accept: 'application/json',
4973
- };
4974
- return this.client.call('get', uri, apiHeaders, apiPayload);
4975
- }
4976
- createProperty(paramsOrFirst, ...rest) {
4977
- let params;
4978
- if (paramsOrFirst &&
4979
- typeof paramsOrFirst === 'object' &&
4980
- !Array.isArray(paramsOrFirst)) {
4981
- params = (paramsOrFirst || {});
4982
- }
4983
- else {
4984
- params = {
4985
- propertyId: paramsOrFirst,
4986
- name: rest[0],
4987
- domain: rest[1],
4988
- timezone: rest[2],
4989
- enabled: rest[3],
4990
- xpublic: rest[4],
4991
- allowedOrigins: rest[5],
4992
- };
4993
- }
4994
- const propertyId = params.propertyId;
4995
- const name = params.name;
4996
- const domain = params.domain;
4997
- const timezone = params.timezone;
4998
- const enabled = params.enabled;
4999
- const xpublic = params.xpublic;
5000
- const allowedOrigins = params.allowedOrigins;
5001
- if (typeof propertyId === 'undefined') {
5002
- throw new AppwriteException('Missing required parameter: "propertyId"');
5003
- }
5004
- if (typeof name === 'undefined') {
5005
- throw new AppwriteException('Missing required parameter: "name"');
5006
- }
5007
- const apiPath = '/analytics/properties';
5008
- const apiPayload = {};
5009
- if (typeof propertyId !== 'undefined') {
5010
- apiPayload['propertyId'] = propertyId;
5011
- }
5012
- if (typeof name !== 'undefined') {
5013
- apiPayload['name'] = name;
5014
- }
5015
- if (typeof domain !== 'undefined') {
5016
- apiPayload['domain'] = domain;
5017
- }
5018
- if (typeof timezone !== 'undefined') {
5019
- apiPayload['timezone'] = timezone;
5020
- }
5021
- if (typeof enabled !== 'undefined') {
5022
- apiPayload['enabled'] = enabled;
5023
- }
5024
- if (typeof xpublic !== 'undefined') {
5025
- apiPayload['public'] = xpublic;
5026
- }
5027
- if (typeof allowedOrigins !== 'undefined') {
5028
- apiPayload['allowedOrigins'] = allowedOrigins;
5029
- }
5030
- const uri = new URL(this.client.config.endpoint + apiPath);
5031
- const apiHeaders = {
5032
- 'X-Appwrite-Project': this.client.config.project,
5033
- 'content-type': 'application/json',
5034
- accept: 'application/json',
5035
- };
5036
- return this.client.call('post', uri, apiHeaders, apiPayload);
5037
- }
5038
- getProperty(paramsOrFirst) {
5039
- let params;
5040
- if (paramsOrFirst &&
5041
- typeof paramsOrFirst === 'object' &&
5042
- !Array.isArray(paramsOrFirst)) {
5043
- params = (paramsOrFirst || {});
5044
- }
5045
- else {
5046
- params = {
5047
- propertyId: paramsOrFirst,
5048
- };
5049
- }
5050
- const propertyId = params.propertyId;
5051
- if (typeof propertyId === 'undefined' || propertyId === '') {
5052
- throw new AppwriteException('Missing required parameter: "propertyId"');
5053
- }
5054
- const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
5055
- const apiPayload = {};
5056
- const uri = new URL(this.client.config.endpoint + apiPath);
5057
- const apiHeaders = {
5058
- 'X-Appwrite-Project': this.client.config.project,
5059
- accept: 'application/json',
5060
- };
5061
- return this.client.call('get', uri, apiHeaders, apiPayload);
5062
- }
5063
- updateProperty(paramsOrFirst, ...rest) {
5064
- let params;
5065
- if (paramsOrFirst &&
5066
- typeof paramsOrFirst === 'object' &&
5067
- !Array.isArray(paramsOrFirst)) {
5068
- params = (paramsOrFirst || {});
5069
- }
5070
- else {
5071
- params = {
5072
- propertyId: paramsOrFirst,
5073
- name: rest[0],
5074
- domain: rest[1],
5075
- timezone: rest[2],
5076
- enabled: rest[3],
5077
- xpublic: rest[4],
5078
- allowedOrigins: rest[5],
5079
- };
5080
- }
5081
- const propertyId = params.propertyId;
5082
- const name = params.name;
5083
- const domain = params.domain;
5084
- const timezone = params.timezone;
5085
- const enabled = params.enabled;
5086
- const xpublic = params.xpublic;
5087
- const allowedOrigins = params.allowedOrigins;
5088
- if (typeof propertyId === 'undefined' || propertyId === '') {
5089
- throw new AppwriteException('Missing required parameter: "propertyId"');
5090
- }
5091
- const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
5092
- const apiPayload = {};
5093
- if (typeof name !== 'undefined') {
5094
- apiPayload['name'] = name;
5095
- }
5096
- if (typeof domain !== 'undefined') {
5097
- apiPayload['domain'] = domain;
5098
- }
5099
- if (typeof timezone !== 'undefined') {
5100
- apiPayload['timezone'] = timezone;
5101
- }
5102
- if (typeof enabled !== 'undefined') {
5103
- apiPayload['enabled'] = enabled;
5104
- }
5105
- if (typeof xpublic !== 'undefined') {
5106
- apiPayload['public'] = xpublic;
5107
- }
5108
- if (typeof allowedOrigins !== 'undefined') {
5109
- apiPayload['allowedOrigins'] = allowedOrigins;
5110
- }
5111
- const uri = new URL(this.client.config.endpoint + apiPath);
5112
- const apiHeaders = {
5113
- 'X-Appwrite-Project': this.client.config.project,
5114
- 'content-type': 'application/json',
5115
- accept: 'application/json',
5116
- };
5117
- return this.client.call('patch', uri, apiHeaders, apiPayload);
5118
- }
5119
- deleteProperty(paramsOrFirst) {
5120
- let params;
5121
- if (paramsOrFirst &&
5122
- typeof paramsOrFirst === 'object' &&
5123
- !Array.isArray(paramsOrFirst)) {
5124
- params = (paramsOrFirst || {});
5125
- }
5126
- else {
5127
- params = {
5128
- propertyId: paramsOrFirst,
5129
- };
5130
- }
5131
- const propertyId = params.propertyId;
5132
- if (typeof propertyId === 'undefined' || propertyId === '') {
5133
- throw new AppwriteException('Missing required parameter: "propertyId"');
5134
- }
5135
- const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
5136
- const apiPayload = {};
5137
- const uri = new URL(this.client.config.endpoint + apiPath);
5138
- const apiHeaders = {
5139
- 'X-Appwrite-Project': this.client.config.project,
5140
- 'content-type': 'application/json',
5141
- accept: 'application/json',
5142
- };
5143
- return this.client.call('delete', uri, apiHeaders, apiPayload);
5144
- }
5145
- createEvent(paramsOrFirst, ...rest) {
5146
- let params;
5147
- if (paramsOrFirst &&
5148
- typeof paramsOrFirst === 'object' &&
5149
- !Array.isArray(paramsOrFirst)) {
5150
- params = (paramsOrFirst || {});
5151
- }
5152
- else {
5153
- params = {
5154
- propertyId: paramsOrFirst,
5155
- name: rest[0],
5156
- url: rest[1],
5157
- domain: rest[2],
5158
- referrer: rest[3],
5159
- screenWidth: rest[4],
5160
- sessionHash: rest[5],
5161
- scrollDepth: rest[6],
5162
- engagementTime: rest[7],
5163
- props: rest[8],
5164
- userId: rest[9],
5165
- ip: rest[10],
5166
- userAgent: rest[11],
5167
- };
5168
- }
5169
- const propertyId = params.propertyId;
5170
- const name = params.name;
5171
- const url = params.url;
5172
- const domain = params.domain;
5173
- const referrer = params.referrer;
5174
- const screenWidth = params.screenWidth;
5175
- const sessionHash = params.sessionHash;
5176
- const scrollDepth = params.scrollDepth;
5177
- const engagementTime = params.engagementTime;
5178
- const props = params.props;
5179
- const userId = params.userId;
5180
- const ip = params.ip;
5181
- const userAgent = params.userAgent;
5182
- if (typeof propertyId === 'undefined' || propertyId === '') {
5183
- throw new AppwriteException('Missing required parameter: "propertyId"');
5184
- }
5185
- if (typeof name === 'undefined') {
5186
- throw new AppwriteException('Missing required parameter: "name"');
5187
- }
5188
- if (typeof url === 'undefined') {
5189
- throw new AppwriteException('Missing required parameter: "url"');
5190
- }
5191
- const apiPath = '/analytics/properties/{propertyId}/events'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
5192
- const apiPayload = {};
5193
- if (typeof name !== 'undefined') {
5194
- apiPayload['name'] = name;
5195
- }
5196
- if (typeof url !== 'undefined') {
5197
- apiPayload['url'] = url;
5198
- }
5199
- if (typeof domain !== 'undefined') {
5200
- apiPayload['domain'] = domain;
5201
- }
5202
- if (typeof referrer !== 'undefined') {
5203
- apiPayload['referrer'] = referrer;
5204
- }
5205
- if (typeof screenWidth !== 'undefined') {
5206
- apiPayload['screenWidth'] = screenWidth;
5207
- }
5208
- if (typeof sessionHash !== 'undefined') {
5209
- apiPayload['sessionHash'] = sessionHash;
5210
- }
5211
- if (typeof scrollDepth !== 'undefined') {
5212
- apiPayload['scrollDepth'] = scrollDepth;
5213
- }
5214
- if (typeof engagementTime !== 'undefined') {
5215
- apiPayload['engagementTime'] = engagementTime;
5216
- }
5217
- if (typeof props !== 'undefined') {
5218
- apiPayload['props'] = props;
5219
- }
5220
- if (typeof userId !== 'undefined') {
5221
- apiPayload['userId'] = userId;
5222
- }
5223
- if (typeof ip !== 'undefined') {
5224
- apiPayload['ip'] = ip;
5225
- }
5226
- if (typeof userAgent !== 'undefined') {
5227
- apiPayload['userAgent'] = userAgent;
5228
- }
5229
- const uri = new URL(this.client.config.endpoint + apiPath);
5230
- const apiHeaders = {
5231
- 'X-Appwrite-Project': this.client.config.project,
5232
- 'content-type': 'application/json',
5233
- accept: 'application/json',
5234
- };
5235
- return this.client.call('post', uri, apiHeaders, apiPayload);
5236
- }
5237
- listMetrics(paramsOrFirst, ...rest) {
5238
- let params;
5239
- if (paramsOrFirst &&
5240
- typeof paramsOrFirst === 'object' &&
5241
- !Array.isArray(paramsOrFirst)) {
5242
- params = (paramsOrFirst || {});
5243
- }
5244
- else {
5245
- params = {
5246
- propertyId: paramsOrFirst,
5247
- queries: rest[0],
5248
- interval: rest[1],
5249
- dimensions: rest[2],
5250
- dateRange: rest[3],
5251
- startAt: rest[4],
5252
- endAt: rest[5],
5253
- limit: rest[6],
5254
- };
5255
- }
5256
- const propertyId = params.propertyId;
5257
- const queries = params.queries;
5258
- const interval = params.interval;
5259
- const dimensions = params.dimensions;
5260
- const dateRange = params.dateRange;
5261
- const startAt = params.startAt;
5262
- const endAt = params.endAt;
5263
- const limit = params.limit;
5264
- if (typeof propertyId === 'undefined' || propertyId === '') {
5265
- throw new AppwriteException('Missing required parameter: "propertyId"');
5266
- }
5267
- const apiPath = '/analytics/properties/{propertyId}/metrics'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
5268
- const apiPayload = {};
5269
- if (typeof queries !== 'undefined') {
5270
- apiPayload['queries'] = queries;
5271
- }
5272
- if (typeof interval !== 'undefined') {
5273
- apiPayload['interval'] = interval;
5274
- }
5275
- if (typeof dimensions !== 'undefined') {
5276
- apiPayload['dimensions'] = dimensions;
5277
- }
5278
- if (typeof dateRange !== 'undefined') {
5279
- apiPayload['dateRange'] = dateRange;
5280
- }
5281
- if (typeof startAt !== 'undefined') {
5282
- apiPayload['startAt'] = startAt;
5283
- }
5284
- if (typeof endAt !== 'undefined') {
5285
- apiPayload['endAt'] = endAt;
5286
- }
5287
- if (typeof limit !== 'undefined') {
5288
- apiPayload['limit'] = limit;
5289
- }
5290
- const uri = new URL(this.client.config.endpoint + apiPath);
5291
- const apiHeaders = {
5292
- 'X-Appwrite-Project': this.client.config.project,
5293
- accept: 'application/json',
5294
- };
5295
- return this.client.call('get', uri, apiHeaders, apiPayload);
5296
- }
5297
- }
5298
-
5299
4822
  class Apps {
5300
4823
  constructor(client) {
5301
4824
  this.client = client;
@@ -6188,7 +5711,7 @@ class Avatars {
6188
5711
  const uri = new URL(this.client.config.endpoint + apiPath);
6189
5712
  apiPayload['project'] = this.client.config.project;
6190
5713
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6191
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5714
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6192
5715
  uri.searchParams.append(key, value);
6193
5716
  }
6194
5717
  return uri.toString();
@@ -6233,7 +5756,7 @@ class Avatars {
6233
5756
  const uri = new URL(this.client.config.endpoint + apiPath);
6234
5757
  apiPayload['project'] = this.client.config.project;
6235
5758
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6236
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5759
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6237
5760
  uri.searchParams.append(key, value);
6238
5761
  }
6239
5762
  return uri.toString();
@@ -6262,7 +5785,7 @@ class Avatars {
6262
5785
  const uri = new URL(this.client.config.endpoint + apiPath);
6263
5786
  apiPayload['project'] = this.client.config.project;
6264
5787
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6265
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5788
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6266
5789
  uri.searchParams.append(key, value);
6267
5790
  }
6268
5791
  return uri.toString();
@@ -6307,7 +5830,7 @@ class Avatars {
6307
5830
  const uri = new URL(this.client.config.endpoint + apiPath);
6308
5831
  apiPayload['project'] = this.client.config.project;
6309
5832
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6310
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5833
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6311
5834
  uri.searchParams.append(key, value);
6312
5835
  }
6313
5836
  return uri.toString();
@@ -6346,7 +5869,7 @@ class Avatars {
6346
5869
  const uri = new URL(this.client.config.endpoint + apiPath);
6347
5870
  apiPayload['project'] = this.client.config.project;
6348
5871
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6349
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5872
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6350
5873
  uri.searchParams.append(key, value);
6351
5874
  }
6352
5875
  return uri.toString();
@@ -6388,7 +5911,7 @@ class Avatars {
6388
5911
  const uri = new URL(this.client.config.endpoint + apiPath);
6389
5912
  apiPayload['project'] = this.client.config.project;
6390
5913
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6391
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5914
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6392
5915
  uri.searchParams.append(key, value);
6393
5916
  }
6394
5917
  return uri.toString();
@@ -6450,7 +5973,7 @@ class Avatars {
6450
5973
  const uri = new URL(this.client.config.endpoint + apiPath);
6451
5974
  apiPayload['project'] = this.client.config.project;
6452
5975
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6453
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
5976
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6454
5977
  uri.searchParams.append(key, value);
6455
5978
  }
6456
5979
  return uri.toString();
@@ -6544,7 +6067,7 @@ class Avatars {
6544
6067
  const uri = new URL(this.client.config.endpoint + apiPath);
6545
6068
  apiPayload['project'] = this.client.config.project;
6546
6069
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6547
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
6070
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6548
6071
  uri.searchParams.append(key, value);
6549
6072
  }
6550
6073
  return uri.toString();
@@ -6668,7 +6191,7 @@ class Avatars {
6668
6191
  const uri = new URL(this.client.config.endpoint + apiPath);
6669
6192
  apiPayload['project'] = this.client.config.project;
6670
6193
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
6671
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
6194
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
6672
6195
  uri.searchParams.append(key, value);
6673
6196
  }
6674
6197
  return uri.toString();
@@ -16254,7 +15777,7 @@ class Functions {
16254
15777
  const uri = new URL(this.client.config.endpoint + apiPath);
16255
15778
  apiPayload['project'] = this.client.config.project;
16256
15779
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
16257
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
15780
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
16258
15781
  uri.searchParams.append(key, value);
16259
15782
  }
16260
15783
  return uri.toString();
@@ -26893,7 +26416,7 @@ class Organizations {
26893
26416
  const uri = new URL(this.client.config.endpoint + apiPath);
26894
26417
  apiPayload['project'] = this.client.config.project;
26895
26418
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
26896
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
26419
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
26897
26420
  uri.searchParams.append(key, value);
26898
26421
  }
26899
26422
  return uri.toString();
@@ -27000,7 +26523,7 @@ class Organizations {
27000
26523
  const uri = new URL(this.client.config.endpoint + apiPath);
27001
26524
  apiPayload['project'] = this.client.config.project;
27002
26525
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
27003
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
26526
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
27004
26527
  uri.searchParams.append(key, value);
27005
26528
  }
27006
26529
  return uri.toString();
@@ -32496,30 +32019,27 @@ class Project {
32496
32019
  };
32497
32020
  return this.client.call('patch', uri, apiHeaders, apiPayload);
32498
32021
  }
32499
- updatePasskeyPolicy(paramsOrFirst, ...rest) {
32022
+ updatePasskeyPolicy(paramsOrFirst) {
32500
32023
  let params;
32501
- if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
32502
- (paramsOrFirst &&
32503
- typeof paramsOrFirst === 'object' &&
32504
- !Array.isArray(paramsOrFirst))) {
32024
+ if (paramsOrFirst &&
32025
+ typeof paramsOrFirst === 'object' &&
32026
+ !Array.isArray(paramsOrFirst)) {
32505
32027
  params = (paramsOrFirst || {});
32506
32028
  }
32507
32029
  else {
32508
32030
  params = {
32509
32031
  rpId: paramsOrFirst,
32510
- origins: rest[0],
32511
32032
  };
32512
32033
  }
32513
32034
  const rpId = params.rpId;
32514
- const origins = params.origins;
32035
+ if (typeof rpId === 'undefined') {
32036
+ throw new AppwriteException('Missing required parameter: "rpId"');
32037
+ }
32515
32038
  const apiPath = '/project/policies/passkey';
32516
32039
  const apiPayload = {};
32517
32040
  if (typeof rpId !== 'undefined') {
32518
32041
  apiPayload['rpId'] = rpId;
32519
32042
  }
32520
- if (typeof origins !== 'undefined') {
32521
- apiPayload['origins'] = origins;
32522
- }
32523
32043
  const uri = new URL(this.client.config.endpoint + apiPath);
32524
32044
  const apiHeaders = {
32525
32045
  'X-Appwrite-Project': this.client.config.project,
@@ -35218,7 +34738,7 @@ class Sites {
35218
34738
  const uri = new URL(this.client.config.endpoint + apiPath);
35219
34739
  apiPayload['project'] = this.client.config.project;
35220
34740
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
35221
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
34741
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
35222
34742
  uri.searchParams.append(key, value);
35223
34743
  }
35224
34744
  return uri.toString();
@@ -36049,7 +35569,7 @@ class Storage {
36049
35569
  const uri = new URL(this.client.config.endpoint + apiPath);
36050
35570
  apiPayload['project'] = this.client.config.project;
36051
35571
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
36052
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
35572
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
36053
35573
  uri.searchParams.append(key, value);
36054
35574
  }
36055
35575
  return uri.toString();
@@ -36142,7 +35662,7 @@ class Storage {
36142
35662
  const uri = new URL(this.client.config.endpoint + apiPath);
36143
35663
  apiPayload['project'] = this.client.config.project;
36144
35664
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
36145
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
35665
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
36146
35666
  uri.searchParams.append(key, value);
36147
35667
  }
36148
35668
  return uri.toString();
@@ -36180,7 +35700,7 @@ class Storage {
36180
35700
  const uri = new URL(this.client.config.endpoint + apiPath);
36181
35701
  apiPayload['project'] = this.client.config.project;
36182
35702
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
36183
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
35703
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
36184
35704
  uri.searchParams.append(key, value);
36185
35705
  }
36186
35706
  return uri.toString();
@@ -42558,6 +42078,47 @@ class Users {
42558
42078
  };
42559
42079
  return this.client.call('get', uri, apiHeaders, apiPayload);
42560
42080
  }
42081
+ updatePasskey(paramsOrFirst, ...rest) {
42082
+ let params;
42083
+ if (paramsOrFirst &&
42084
+ typeof paramsOrFirst === 'object' &&
42085
+ !Array.isArray(paramsOrFirst)) {
42086
+ params = (paramsOrFirst || {});
42087
+ }
42088
+ else {
42089
+ params = {
42090
+ userId: paramsOrFirst,
42091
+ passkeyId: rest[0],
42092
+ name: rest[1],
42093
+ };
42094
+ }
42095
+ const userId = params.userId;
42096
+ const passkeyId = params.passkeyId;
42097
+ const name = params.name;
42098
+ if (typeof userId === 'undefined' || userId === '') {
42099
+ throw new AppwriteException('Missing required parameter: "userId"');
42100
+ }
42101
+ if (typeof passkeyId === 'undefined' || passkeyId === '') {
42102
+ throw new AppwriteException('Missing required parameter: "passkeyId"');
42103
+ }
42104
+ if (typeof name === 'undefined') {
42105
+ throw new AppwriteException('Missing required parameter: "name"');
42106
+ }
42107
+ const apiPath = '/users/{userId}/passkeys/{passkeyId}'
42108
+ .replace('{userId}', encodeURIComponent(String(userId)))
42109
+ .replace('{passkeyId}', encodeURIComponent(String(passkeyId)));
42110
+ const apiPayload = {};
42111
+ if (typeof name !== 'undefined') {
42112
+ apiPayload['name'] = name;
42113
+ }
42114
+ const uri = new URL(this.client.config.endpoint + apiPath);
42115
+ const apiHeaders = {
42116
+ 'X-Appwrite-Project': this.client.config.project,
42117
+ 'content-type': 'application/json',
42118
+ accept: 'application/json',
42119
+ };
42120
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
42121
+ }
42561
42122
  deletePasskey(paramsOrFirst, ...rest) {
42562
42123
  let params;
42563
42124
  if (paramsOrFirst &&
@@ -45097,11 +44658,11 @@ class VectorsDB {
45097
44658
  }
45098
44659
  }
45099
44660
 
45100
- class Videos {
44661
+ class Waf {
45101
44662
  constructor(client) {
45102
44663
  this.client = client;
45103
44664
  }
45104
- list(paramsOrFirst, ...rest) {
44665
+ listRules(paramsOrFirst, ...rest) {
45105
44666
  let params;
45106
44667
  if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
45107
44668
  (paramsOrFirst &&
@@ -45119,7 +44680,7 @@ class Videos {
45119
44680
  const queries = params.queries;
45120
44681
  const search = params.search;
45121
44682
  const total = params.total;
45122
- const apiPath = '/videos';
44683
+ const apiPath = '/waf/rules';
45123
44684
  const apiPayload = {};
45124
44685
  if (typeof queries !== 'undefined') {
45125
44686
  apiPayload['queries'] = queries;
@@ -45137,7 +44698,7 @@ class Videos {
45137
44698
  };
45138
44699
  return this.client.call('get', uri, apiHeaders, apiPayload);
45139
44700
  }
45140
- create(paramsOrFirst, ...rest) {
44701
+ createBypassRule(paramsOrFirst, ...rest) {
45141
44702
  let params;
45142
44703
  if (paramsOrFirst &&
45143
44704
  typeof paramsOrFirst === 'object' &&
@@ -45146,31 +44707,59 @@ class Videos {
45146
44707
  }
45147
44708
  else {
45148
44709
  params = {
45149
- bucketId: paramsOrFirst,
45150
- fileId: rest[0],
44710
+ ruleId: paramsOrFirst,
44711
+ resourceType: rest[0],
45151
44712
  name: rest[1],
44713
+ resourceId: rest[2],
44714
+ description: rest[3],
44715
+ priority: rest[4],
44716
+ enabled: rest[5],
44717
+ conditions: rest[6],
45152
44718
  };
45153
44719
  }
45154
- const bucketId = params.bucketId;
45155
- const fileId = params.fileId;
44720
+ const ruleId = params.ruleId;
44721
+ const resourceType = params.resourceType;
45156
44722
  const name = params.name;
45157
- if (typeof bucketId === 'undefined') {
45158
- throw new AppwriteException('Missing required parameter: "bucketId"');
44723
+ const resourceId = params.resourceId;
44724
+ const description = params.description;
44725
+ const priority = params.priority;
44726
+ const enabled = params.enabled;
44727
+ const conditions = params.conditions;
44728
+ if (typeof ruleId === 'undefined') {
44729
+ throw new AppwriteException('Missing required parameter: "ruleId"');
45159
44730
  }
45160
- if (typeof fileId === 'undefined') {
45161
- throw new AppwriteException('Missing required parameter: "fileId"');
44731
+ if (typeof resourceType === 'undefined') {
44732
+ throw new AppwriteException('Missing required parameter: "resourceType"');
44733
+ }
44734
+ if (typeof name === 'undefined') {
44735
+ throw new AppwriteException('Missing required parameter: "name"');
45162
44736
  }
45163
- const apiPath = '/videos';
44737
+ const apiPath = '/waf/rules/bypass';
45164
44738
  const apiPayload = {};
45165
- if (typeof bucketId !== 'undefined') {
45166
- apiPayload['bucketId'] = bucketId;
44739
+ if (typeof ruleId !== 'undefined') {
44740
+ apiPayload['ruleId'] = ruleId;
45167
44741
  }
45168
- if (typeof fileId !== 'undefined') {
45169
- apiPayload['fileId'] = fileId;
44742
+ if (typeof resourceType !== 'undefined') {
44743
+ apiPayload['resourceType'] = resourceType;
44744
+ }
44745
+ if (typeof resourceId !== 'undefined') {
44746
+ apiPayload['resourceId'] = resourceId;
45170
44747
  }
45171
44748
  if (typeof name !== 'undefined') {
45172
44749
  apiPayload['name'] = name;
45173
44750
  }
44751
+ if (typeof description !== 'undefined') {
44752
+ apiPayload['description'] = description;
44753
+ }
44754
+ if (typeof priority !== 'undefined') {
44755
+ apiPayload['priority'] = priority;
44756
+ }
44757
+ if (typeof enabled !== 'undefined') {
44758
+ apiPayload['enabled'] = enabled;
44759
+ }
44760
+ if (typeof conditions !== 'undefined') {
44761
+ apiPayload['conditions'] = conditions;
44762
+ }
45174
44763
  const uri = new URL(this.client.config.endpoint + apiPath);
45175
44764
  const apiHeaders = {
45176
44765
  'X-Appwrite-Project': this.client.config.project,
@@ -45179,33 +44768,68 @@ class Videos {
45179
44768
  };
45180
44769
  return this.client.call('post', uri, apiHeaders, apiPayload);
45181
44770
  }
45182
- listProfiles(paramsOrFirst) {
44771
+ updateBypassRule(paramsOrFirst, ...rest) {
45183
44772
  let params;
45184
- if (typeof paramsOrFirst === 'undefined' ||
45185
- (paramsOrFirst &&
45186
- typeof paramsOrFirst === 'object' &&
45187
- !Array.isArray(paramsOrFirst))) {
44773
+ if (paramsOrFirst &&
44774
+ typeof paramsOrFirst === 'object' &&
44775
+ !Array.isArray(paramsOrFirst)) {
45188
44776
  params = (paramsOrFirst || {});
45189
44777
  }
45190
44778
  else {
45191
44779
  params = {
45192
- search: paramsOrFirst,
44780
+ ruleId: paramsOrFirst,
44781
+ resourceType: rest[0],
44782
+ resourceId: rest[1],
44783
+ name: rest[2],
44784
+ description: rest[3],
44785
+ priority: rest[4],
44786
+ enabled: rest[5],
44787
+ conditions: rest[6],
45193
44788
  };
45194
44789
  }
45195
- const search = params.search;
45196
- const apiPath = '/videos/profiles';
44790
+ const ruleId = params.ruleId;
44791
+ const resourceType = params.resourceType;
44792
+ const resourceId = params.resourceId;
44793
+ const name = params.name;
44794
+ const description = params.description;
44795
+ const priority = params.priority;
44796
+ const enabled = params.enabled;
44797
+ const conditions = params.conditions;
44798
+ if (typeof ruleId === 'undefined' || ruleId === '') {
44799
+ throw new AppwriteException('Missing required parameter: "ruleId"');
44800
+ }
44801
+ const apiPath = '/waf/rules/bypass/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
45197
44802
  const apiPayload = {};
45198
- if (typeof search !== 'undefined') {
45199
- apiPayload['search'] = search;
44803
+ if (typeof resourceType !== 'undefined') {
44804
+ apiPayload['resourceType'] = resourceType;
44805
+ }
44806
+ if (typeof resourceId !== 'undefined') {
44807
+ apiPayload['resourceId'] = resourceId;
44808
+ }
44809
+ if (typeof name !== 'undefined') {
44810
+ apiPayload['name'] = name;
44811
+ }
44812
+ if (typeof description !== 'undefined') {
44813
+ apiPayload['description'] = description;
44814
+ }
44815
+ if (typeof priority !== 'undefined') {
44816
+ apiPayload['priority'] = priority;
44817
+ }
44818
+ if (typeof enabled !== 'undefined') {
44819
+ apiPayload['enabled'] = enabled;
44820
+ }
44821
+ if (typeof conditions !== 'undefined') {
44822
+ apiPayload['conditions'] = conditions;
45200
44823
  }
45201
44824
  const uri = new URL(this.client.config.endpoint + apiPath);
45202
44825
  const apiHeaders = {
45203
44826
  'X-Appwrite-Project': this.client.config.project,
44827
+ 'content-type': 'application/json',
45204
44828
  accept: 'application/json',
45205
44829
  };
45206
- return this.client.call('get', uri, apiHeaders, apiPayload);
44830
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
45207
44831
  }
45208
- createProfile(paramsOrFirst, ...rest) {
44832
+ createChallengeRule(paramsOrFirst, ...rest) {
45209
44833
  let params;
45210
44834
  if (paramsOrFirst &&
45211
44835
  typeof paramsOrFirst === 'object' &&
@@ -45214,49 +44838,73 @@ class Videos {
45214
44838
  }
45215
44839
  else {
45216
44840
  params = {
45217
- name: paramsOrFirst,
45218
- videoBitRate: rest[0],
45219
- audioBitRate: rest[1],
45220
- width: rest[2],
45221
- height: rest[3],
44841
+ ruleId: paramsOrFirst,
44842
+ resourceType: rest[0],
44843
+ name: rest[1],
44844
+ resourceId: rest[2],
44845
+ description: rest[3],
44846
+ challengeType: rest[4],
44847
+ priority: rest[5],
44848
+ enabled: rest[6],
44849
+ conditions: rest[7],
44850
+ difficulty: rest[8],
44851
+ ttl: rest[9],
45222
44852
  };
45223
44853
  }
44854
+ const ruleId = params.ruleId;
44855
+ const resourceType = params.resourceType;
45224
44856
  const name = params.name;
45225
- const videoBitRate = params.videoBitRate;
45226
- const audioBitRate = params.audioBitRate;
45227
- const width = params.width;
45228
- const height = params.height;
44857
+ const resourceId = params.resourceId;
44858
+ const description = params.description;
44859
+ const challengeType = params.challengeType;
44860
+ const priority = params.priority;
44861
+ const enabled = params.enabled;
44862
+ const conditions = params.conditions;
44863
+ const difficulty = params.difficulty;
44864
+ const ttl = params.ttl;
44865
+ if (typeof ruleId === 'undefined') {
44866
+ throw new AppwriteException('Missing required parameter: "ruleId"');
44867
+ }
44868
+ if (typeof resourceType === 'undefined') {
44869
+ throw new AppwriteException('Missing required parameter: "resourceType"');
44870
+ }
45229
44871
  if (typeof name === 'undefined') {
45230
44872
  throw new AppwriteException('Missing required parameter: "name"');
45231
44873
  }
45232
- if (typeof videoBitRate === 'undefined') {
45233
- throw new AppwriteException('Missing required parameter: "videoBitRate"');
45234
- }
45235
- if (typeof audioBitRate === 'undefined') {
45236
- throw new AppwriteException('Missing required parameter: "audioBitRate"');
44874
+ const apiPath = '/waf/rules/challenge';
44875
+ const apiPayload = {};
44876
+ if (typeof ruleId !== 'undefined') {
44877
+ apiPayload['ruleId'] = ruleId;
45237
44878
  }
45238
- if (typeof width === 'undefined') {
45239
- throw new AppwriteException('Missing required parameter: "width"');
44879
+ if (typeof resourceType !== 'undefined') {
44880
+ apiPayload['resourceType'] = resourceType;
45240
44881
  }
45241
- if (typeof height === 'undefined') {
45242
- throw new AppwriteException('Missing required parameter: "height"');
44882
+ if (typeof resourceId !== 'undefined') {
44883
+ apiPayload['resourceId'] = resourceId;
45243
44884
  }
45244
- const apiPath = '/videos/profiles';
45245
- const apiPayload = {};
45246
44885
  if (typeof name !== 'undefined') {
45247
44886
  apiPayload['name'] = name;
45248
44887
  }
45249
- if (typeof videoBitRate !== 'undefined') {
45250
- apiPayload['videoBitRate'] = videoBitRate;
44888
+ if (typeof description !== 'undefined') {
44889
+ apiPayload['description'] = description;
44890
+ }
44891
+ if (typeof challengeType !== 'undefined') {
44892
+ apiPayload['challengeType'] = challengeType;
44893
+ }
44894
+ if (typeof priority !== 'undefined') {
44895
+ apiPayload['priority'] = priority;
45251
44896
  }
45252
- if (typeof audioBitRate !== 'undefined') {
45253
- apiPayload['audioBitRate'] = audioBitRate;
44897
+ if (typeof enabled !== 'undefined') {
44898
+ apiPayload['enabled'] = enabled;
45254
44899
  }
45255
- if (typeof width !== 'undefined') {
45256
- apiPayload['width'] = width;
44900
+ if (typeof conditions !== 'undefined') {
44901
+ apiPayload['conditions'] = conditions;
45257
44902
  }
45258
- if (typeof height !== 'undefined') {
45259
- apiPayload['height'] = height;
44903
+ if (typeof difficulty !== 'undefined') {
44904
+ apiPayload['difficulty'] = difficulty;
44905
+ }
44906
+ if (typeof ttl !== 'undefined') {
44907
+ apiPayload['ttl'] = ttl;
45260
44908
  }
45261
44909
  const uri = new URL(this.client.config.endpoint + apiPath);
45262
44910
  const apiHeaders = {
@@ -45266,7 +44914,7 @@ class Videos {
45266
44914
  };
45267
44915
  return this.client.call('post', uri, apiHeaders, apiPayload);
45268
44916
  }
45269
- getProfile(paramsOrFirst) {
44917
+ updateChallengeRule(paramsOrFirst, ...rest) {
45270
44918
  let params;
45271
44919
  if (paramsOrFirst &&
45272
44920
  typeof paramsOrFirst === 'object' &&
@@ -45275,23 +44923,74 @@ class Videos {
45275
44923
  }
45276
44924
  else {
45277
44925
  params = {
45278
- profileId: paramsOrFirst,
44926
+ ruleId: paramsOrFirst,
44927
+ resourceType: rest[0],
44928
+ resourceId: rest[1],
44929
+ name: rest[2],
44930
+ description: rest[3],
44931
+ challengeType: rest[4],
44932
+ priority: rest[5],
44933
+ enabled: rest[6],
44934
+ conditions: rest[7],
44935
+ difficulty: rest[8],
44936
+ ttl: rest[9],
45279
44937
  };
45280
44938
  }
45281
- const profileId = params.profileId;
45282
- if (typeof profileId === 'undefined' || profileId === '') {
45283
- throw new AppwriteException('Missing required parameter: "profileId"');
44939
+ const ruleId = params.ruleId;
44940
+ const resourceType = params.resourceType;
44941
+ const resourceId = params.resourceId;
44942
+ const name = params.name;
44943
+ const description = params.description;
44944
+ const challengeType = params.challengeType;
44945
+ const priority = params.priority;
44946
+ const enabled = params.enabled;
44947
+ const conditions = params.conditions;
44948
+ const difficulty = params.difficulty;
44949
+ const ttl = params.ttl;
44950
+ if (typeof ruleId === 'undefined' || ruleId === '') {
44951
+ throw new AppwriteException('Missing required parameter: "ruleId"');
45284
44952
  }
45285
- const apiPath = '/videos/profiles/{profileId}'.replace('{profileId}', encodeURIComponent(String(profileId)));
44953
+ const apiPath = '/waf/rules/challenge/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
45286
44954
  const apiPayload = {};
44955
+ if (typeof resourceType !== 'undefined') {
44956
+ apiPayload['resourceType'] = resourceType;
44957
+ }
44958
+ if (typeof resourceId !== 'undefined') {
44959
+ apiPayload['resourceId'] = resourceId;
44960
+ }
44961
+ if (typeof name !== 'undefined') {
44962
+ apiPayload['name'] = name;
44963
+ }
44964
+ if (typeof description !== 'undefined') {
44965
+ apiPayload['description'] = description;
44966
+ }
44967
+ if (typeof challengeType !== 'undefined') {
44968
+ apiPayload['challengeType'] = challengeType;
44969
+ }
44970
+ if (typeof priority !== 'undefined') {
44971
+ apiPayload['priority'] = priority;
44972
+ }
44973
+ if (typeof enabled !== 'undefined') {
44974
+ apiPayload['enabled'] = enabled;
44975
+ }
44976
+ if (typeof conditions !== 'undefined') {
44977
+ apiPayload['conditions'] = conditions;
44978
+ }
44979
+ if (typeof difficulty !== 'undefined') {
44980
+ apiPayload['difficulty'] = difficulty;
44981
+ }
44982
+ if (typeof ttl !== 'undefined') {
44983
+ apiPayload['ttl'] = ttl;
44984
+ }
45287
44985
  const uri = new URL(this.client.config.endpoint + apiPath);
45288
44986
  const apiHeaders = {
45289
44987
  'X-Appwrite-Project': this.client.config.project,
44988
+ 'content-type': 'application/json',
45290
44989
  accept: 'application/json',
45291
44990
  };
45292
- return this.client.call('get', uri, apiHeaders, apiPayload);
44991
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
45293
44992
  }
45294
- updateProfile(paramsOrFirst, ...rest) {
44993
+ createDenyRule(paramsOrFirst, ...rest) {
45295
44994
  let params;
45296
44995
  if (paramsOrFirst &&
45297
44996
  typeof paramsOrFirst === 'object' &&
@@ -45300,54 +44999,58 @@ class Videos {
45300
44999
  }
45301
45000
  else {
45302
45001
  params = {
45303
- profileId: paramsOrFirst,
45304
- name: rest[0],
45305
- videoBitRate: rest[1],
45306
- audioBitRate: rest[2],
45307
- width: rest[3],
45308
- height: rest[4],
45002
+ ruleId: paramsOrFirst,
45003
+ resourceType: rest[0],
45004
+ name: rest[1],
45005
+ resourceId: rest[2],
45006
+ description: rest[3],
45007
+ priority: rest[4],
45008
+ enabled: rest[5],
45009
+ conditions: rest[6],
45309
45010
  };
45310
45011
  }
45311
- const profileId = params.profileId;
45012
+ const ruleId = params.ruleId;
45013
+ const resourceType = params.resourceType;
45312
45014
  const name = params.name;
45313
- const videoBitRate = params.videoBitRate;
45314
- const audioBitRate = params.audioBitRate;
45315
- const width = params.width;
45316
- const height = params.height;
45317
- if (typeof profileId === 'undefined' || profileId === '') {
45318
- throw new AppwriteException('Missing required parameter: "profileId"');
45015
+ const resourceId = params.resourceId;
45016
+ const description = params.description;
45017
+ const priority = params.priority;
45018
+ const enabled = params.enabled;
45019
+ const conditions = params.conditions;
45020
+ if (typeof ruleId === 'undefined') {
45021
+ throw new AppwriteException('Missing required parameter: "ruleId"');
45022
+ }
45023
+ if (typeof resourceType === 'undefined') {
45024
+ throw new AppwriteException('Missing required parameter: "resourceType"');
45319
45025
  }
45320
45026
  if (typeof name === 'undefined') {
45321
45027
  throw new AppwriteException('Missing required parameter: "name"');
45322
45028
  }
45323
- if (typeof videoBitRate === 'undefined') {
45324
- throw new AppwriteException('Missing required parameter: "videoBitRate"');
45325
- }
45326
- if (typeof audioBitRate === 'undefined') {
45327
- throw new AppwriteException('Missing required parameter: "audioBitRate"');
45029
+ const apiPath = '/waf/rules/deny';
45030
+ const apiPayload = {};
45031
+ if (typeof ruleId !== 'undefined') {
45032
+ apiPayload['ruleId'] = ruleId;
45328
45033
  }
45329
- if (typeof width === 'undefined') {
45330
- throw new AppwriteException('Missing required parameter: "width"');
45034
+ if (typeof resourceType !== 'undefined') {
45035
+ apiPayload['resourceType'] = resourceType;
45331
45036
  }
45332
- if (typeof height === 'undefined') {
45333
- throw new AppwriteException('Missing required parameter: "height"');
45037
+ if (typeof resourceId !== 'undefined') {
45038
+ apiPayload['resourceId'] = resourceId;
45334
45039
  }
45335
- const apiPath = '/videos/profiles/{profileId}'.replace('{profileId}', encodeURIComponent(String(profileId)));
45336
- const apiPayload = {};
45337
45040
  if (typeof name !== 'undefined') {
45338
45041
  apiPayload['name'] = name;
45339
45042
  }
45340
- if (typeof videoBitRate !== 'undefined') {
45341
- apiPayload['videoBitRate'] = videoBitRate;
45043
+ if (typeof description !== 'undefined') {
45044
+ apiPayload['description'] = description;
45342
45045
  }
45343
- if (typeof audioBitRate !== 'undefined') {
45344
- apiPayload['audioBitRate'] = audioBitRate;
45046
+ if (typeof priority !== 'undefined') {
45047
+ apiPayload['priority'] = priority;
45345
45048
  }
45346
- if (typeof width !== 'undefined') {
45347
- apiPayload['width'] = width;
45049
+ if (typeof enabled !== 'undefined') {
45050
+ apiPayload['enabled'] = enabled;
45348
45051
  }
45349
- if (typeof height !== 'undefined') {
45350
- apiPayload['height'] = height;
45052
+ if (typeof conditions !== 'undefined') {
45053
+ apiPayload['conditions'] = conditions;
45351
45054
  }
45352
45055
  const uri = new URL(this.client.config.endpoint + apiPath);
45353
45056
  const apiHeaders = {
@@ -45355,9 +45058,9 @@ class Videos {
45355
45058
  'content-type': 'application/json',
45356
45059
  accept: 'application/json',
45357
45060
  };
45358
- return this.client.call('patch', uri, apiHeaders, apiPayload);
45061
+ return this.client.call('post', uri, apiHeaders, apiPayload);
45359
45062
  }
45360
- deleteProfile(paramsOrFirst) {
45063
+ updateDenyRule(paramsOrFirst, ...rest) {
45361
45064
  let params;
45362
45065
  if (paramsOrFirst &&
45363
45066
  typeof paramsOrFirst === 'object' &&
@@ -45366,49 +45069,59 @@ class Videos {
45366
45069
  }
45367
45070
  else {
45368
45071
  params = {
45369
- profileId: paramsOrFirst,
45072
+ ruleId: paramsOrFirst,
45073
+ resourceType: rest[0],
45074
+ resourceId: rest[1],
45075
+ name: rest[2],
45076
+ description: rest[3],
45077
+ priority: rest[4],
45078
+ enabled: rest[5],
45079
+ conditions: rest[6],
45370
45080
  };
45371
45081
  }
45372
- const profileId = params.profileId;
45373
- if (typeof profileId === 'undefined' || profileId === '') {
45374
- throw new AppwriteException('Missing required parameter: "profileId"');
45082
+ const ruleId = params.ruleId;
45083
+ const resourceType = params.resourceType;
45084
+ const resourceId = params.resourceId;
45085
+ const name = params.name;
45086
+ const description = params.description;
45087
+ const priority = params.priority;
45088
+ const enabled = params.enabled;
45089
+ const conditions = params.conditions;
45090
+ if (typeof ruleId === 'undefined' || ruleId === '') {
45091
+ throw new AppwriteException('Missing required parameter: "ruleId"');
45375
45092
  }
45376
- const apiPath = '/videos/profiles/{profileId}'.replace('{profileId}', encodeURIComponent(String(profileId)));
45093
+ const apiPath = '/waf/rules/deny/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
45377
45094
  const apiPayload = {};
45378
- const uri = new URL(this.client.config.endpoint + apiPath);
45379
- const apiHeaders = {
45380
- 'X-Appwrite-Project': this.client.config.project,
45381
- 'content-type': 'application/json',
45382
- accept: 'application/json',
45383
- };
45384
- return this.client.call('delete', uri, apiHeaders, apiPayload);
45385
- }
45386
- get(paramsOrFirst) {
45387
- let params;
45388
- if (paramsOrFirst &&
45389
- typeof paramsOrFirst === 'object' &&
45390
- !Array.isArray(paramsOrFirst)) {
45391
- params = (paramsOrFirst || {});
45095
+ if (typeof resourceType !== 'undefined') {
45096
+ apiPayload['resourceType'] = resourceType;
45392
45097
  }
45393
- else {
45394
- params = {
45395
- videoId: paramsOrFirst,
45396
- };
45098
+ if (typeof resourceId !== 'undefined') {
45099
+ apiPayload['resourceId'] = resourceId;
45397
45100
  }
45398
- const videoId = params.videoId;
45399
- if (typeof videoId === 'undefined' || videoId === '') {
45400
- throw new AppwriteException('Missing required parameter: "videoId"');
45101
+ if (typeof name !== 'undefined') {
45102
+ apiPayload['name'] = name;
45103
+ }
45104
+ if (typeof description !== 'undefined') {
45105
+ apiPayload['description'] = description;
45106
+ }
45107
+ if (typeof priority !== 'undefined') {
45108
+ apiPayload['priority'] = priority;
45109
+ }
45110
+ if (typeof enabled !== 'undefined') {
45111
+ apiPayload['enabled'] = enabled;
45112
+ }
45113
+ if (typeof conditions !== 'undefined') {
45114
+ apiPayload['conditions'] = conditions;
45401
45115
  }
45402
- const apiPath = '/videos/{videoId}'.replace('{videoId}', encodeURIComponent(String(videoId)));
45403
- const apiPayload = {};
45404
45116
  const uri = new URL(this.client.config.endpoint + apiPath);
45405
45117
  const apiHeaders = {
45406
45118
  'X-Appwrite-Project': this.client.config.project,
45119
+ 'content-type': 'application/json',
45407
45120
  accept: 'application/json',
45408
45121
  };
45409
- return this.client.call('get', uri, apiHeaders, apiPayload);
45122
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
45410
45123
  }
45411
- update(paramsOrFirst, ...rest) {
45124
+ createRateLimitRule(paramsOrFirst, ...rest) {
45412
45125
  let params;
45413
45126
  if (paramsOrFirst &&
45414
45127
  typeof paramsOrFirst === 'object' &&
@@ -45417,58 +45130,99 @@ class Videos {
45417
45130
  }
45418
45131
  else {
45419
45132
  params = {
45420
- videoId: paramsOrFirst,
45421
- name: rest[0],
45133
+ ruleId: paramsOrFirst,
45134
+ resourceType: rest[0],
45135
+ name: rest[1],
45136
+ limit: rest[2],
45137
+ interval: rest[3],
45138
+ resourceId: rest[4],
45139
+ description: rest[5],
45140
+ key: rest[6],
45141
+ strategy: rest[7],
45142
+ maxBucketSize: rest[8],
45143
+ priority: rest[9],
45144
+ enabled: rest[10],
45145
+ conditions: rest[11],
45422
45146
  };
45423
45147
  }
45424
- const videoId = params.videoId;
45148
+ const ruleId = params.ruleId;
45149
+ const resourceType = params.resourceType;
45425
45150
  const name = params.name;
45426
- if (typeof videoId === 'undefined' || videoId === '') {
45427
- throw new AppwriteException('Missing required parameter: "videoId"');
45151
+ const limit = params.limit;
45152
+ const interval = params.interval;
45153
+ const resourceId = params.resourceId;
45154
+ const description = params.description;
45155
+ const key = params.key;
45156
+ const strategy = params.strategy;
45157
+ const maxBucketSize = params.maxBucketSize;
45158
+ const priority = params.priority;
45159
+ const enabled = params.enabled;
45160
+ const conditions = params.conditions;
45161
+ if (typeof ruleId === 'undefined') {
45162
+ throw new AppwriteException('Missing required parameter: "ruleId"');
45163
+ }
45164
+ if (typeof resourceType === 'undefined') {
45165
+ throw new AppwriteException('Missing required parameter: "resourceType"');
45428
45166
  }
45429
45167
  if (typeof name === 'undefined') {
45430
45168
  throw new AppwriteException('Missing required parameter: "name"');
45431
45169
  }
45432
- const apiPath = '/videos/{videoId}'.replace('{videoId}', encodeURIComponent(String(videoId)));
45170
+ if (typeof limit === 'undefined') {
45171
+ throw new AppwriteException('Missing required parameter: "limit"');
45172
+ }
45173
+ if (typeof interval === 'undefined') {
45174
+ throw new AppwriteException('Missing required parameter: "interval"');
45175
+ }
45176
+ const apiPath = '/waf/rules/rate-limit';
45433
45177
  const apiPayload = {};
45178
+ if (typeof ruleId !== 'undefined') {
45179
+ apiPayload['ruleId'] = ruleId;
45180
+ }
45181
+ if (typeof resourceType !== 'undefined') {
45182
+ apiPayload['resourceType'] = resourceType;
45183
+ }
45184
+ if (typeof resourceId !== 'undefined') {
45185
+ apiPayload['resourceId'] = resourceId;
45186
+ }
45434
45187
  if (typeof name !== 'undefined') {
45435
45188
  apiPayload['name'] = name;
45436
45189
  }
45437
- const uri = new URL(this.client.config.endpoint + apiPath);
45438
- const apiHeaders = {
45439
- 'X-Appwrite-Project': this.client.config.project,
45440
- 'content-type': 'application/json',
45441
- accept: 'application/json',
45442
- };
45443
- return this.client.call('put', uri, apiHeaders, apiPayload);
45444
- }
45445
- delete(paramsOrFirst) {
45446
- let params;
45447
- if (paramsOrFirst &&
45448
- typeof paramsOrFirst === 'object' &&
45449
- !Array.isArray(paramsOrFirst)) {
45450
- params = (paramsOrFirst || {});
45190
+ if (typeof description !== 'undefined') {
45191
+ apiPayload['description'] = description;
45451
45192
  }
45452
- else {
45453
- params = {
45454
- videoId: paramsOrFirst,
45455
- };
45193
+ if (typeof limit !== 'undefined') {
45194
+ apiPayload['limit'] = limit;
45456
45195
  }
45457
- const videoId = params.videoId;
45458
- if (typeof videoId === 'undefined' || videoId === '') {
45459
- throw new AppwriteException('Missing required parameter: "videoId"');
45196
+ if (typeof interval !== 'undefined') {
45197
+ apiPayload['interval'] = interval;
45198
+ }
45199
+ if (typeof key !== 'undefined') {
45200
+ apiPayload['key'] = key;
45201
+ }
45202
+ if (typeof strategy !== 'undefined') {
45203
+ apiPayload['strategy'] = strategy;
45204
+ }
45205
+ if (typeof maxBucketSize !== 'undefined') {
45206
+ apiPayload['maxBucketSize'] = maxBucketSize;
45207
+ }
45208
+ if (typeof priority !== 'undefined') {
45209
+ apiPayload['priority'] = priority;
45210
+ }
45211
+ if (typeof enabled !== 'undefined') {
45212
+ apiPayload['enabled'] = enabled;
45213
+ }
45214
+ if (typeof conditions !== 'undefined') {
45215
+ apiPayload['conditions'] = conditions;
45460
45216
  }
45461
- const apiPath = '/videos/{videoId}'.replace('{videoId}', encodeURIComponent(String(videoId)));
45462
- const apiPayload = {};
45463
45217
  const uri = new URL(this.client.config.endpoint + apiPath);
45464
45218
  const apiHeaders = {
45465
45219
  'X-Appwrite-Project': this.client.config.project,
45466
45220
  'content-type': 'application/json',
45467
45221
  accept: 'application/json',
45468
45222
  };
45469
- return this.client.call('delete', uri, apiHeaders, apiPayload);
45223
+ return this.client.call('post', uri, apiHeaders, apiPayload);
45470
45224
  }
45471
- getCmafHlsManifest(paramsOrFirst) {
45225
+ updateRateLimitRule(paramsOrFirst, ...rest) {
45472
45226
  let params;
45473
45227
  if (paramsOrFirst &&
45474
45228
  typeof paramsOrFirst === 'object' &&
@@ -45477,1359 +45231,36 @@ class Videos {
45477
45231
  }
45478
45232
  else {
45479
45233
  params = {
45480
- videoId: paramsOrFirst,
45234
+ ruleId: paramsOrFirst,
45235
+ resourceType: rest[0],
45236
+ resourceId: rest[1],
45237
+ name: rest[2],
45238
+ description: rest[3],
45239
+ limit: rest[4],
45240
+ interval: rest[5],
45241
+ key: rest[6],
45242
+ maxBucketSize: rest[7],
45243
+ priority: rest[8],
45244
+ enabled: rest[9],
45245
+ conditions: rest[10],
45481
45246
  };
45482
45247
  }
45483
- const videoId = params.videoId;
45484
- if (typeof videoId === 'undefined' || videoId === '') {
45485
- throw new AppwriteException('Missing required parameter: "videoId"');
45248
+ const ruleId = params.ruleId;
45249
+ const resourceType = params.resourceType;
45250
+ const resourceId = params.resourceId;
45251
+ const name = params.name;
45252
+ const description = params.description;
45253
+ const limit = params.limit;
45254
+ const interval = params.interval;
45255
+ const key = params.key;
45256
+ const maxBucketSize = params.maxBucketSize;
45257
+ const priority = params.priority;
45258
+ const enabled = params.enabled;
45259
+ const conditions = params.conditions;
45260
+ if (typeof ruleId === 'undefined' || ruleId === '') {
45261
+ throw new AppwriteException('Missing required parameter: "ruleId"');
45486
45262
  }
45487
- const apiPath = '/videos/{videoId}/outputs/cmaf/master.m3u8'.replace('{videoId}', encodeURIComponent(String(videoId)));
45488
- const apiPayload = {};
45489
- const uri = new URL(this.client.config.endpoint + apiPath);
45490
- apiPayload['project'] = this.client.config.project;
45491
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45492
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45493
- uri.searchParams.append(key, value);
45494
- }
45495
- return uri.toString();
45496
- }
45497
- getCmafDashManifest(paramsOrFirst) {
45498
- let params;
45499
- if (paramsOrFirst &&
45500
- typeof paramsOrFirst === 'object' &&
45501
- !Array.isArray(paramsOrFirst)) {
45502
- params = (paramsOrFirst || {});
45503
- }
45504
- else {
45505
- params = {
45506
- videoId: paramsOrFirst,
45507
- };
45508
- }
45509
- const videoId = params.videoId;
45510
- if (typeof videoId === 'undefined' || videoId === '') {
45511
- throw new AppwriteException('Missing required parameter: "videoId"');
45512
- }
45513
- const apiPath = '/videos/{videoId}/outputs/cmaf/master.mpd'.replace('{videoId}', encodeURIComponent(String(videoId)));
45514
- const apiPayload = {};
45515
- const uri = new URL(this.client.config.endpoint + apiPath);
45516
- apiPayload['project'] = this.client.config.project;
45517
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45518
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45519
- uri.searchParams.append(key, value);
45520
- }
45521
- return uri.toString();
45522
- }
45523
- getCmafStreamManifest(paramsOrFirst, ...rest) {
45524
- let params;
45525
- if (paramsOrFirst &&
45526
- typeof paramsOrFirst === 'object' &&
45527
- !Array.isArray(paramsOrFirst)) {
45528
- params = (paramsOrFirst || {});
45529
- }
45530
- else {
45531
- params = {
45532
- videoId: paramsOrFirst,
45533
- renditionId: rest[0],
45534
- streamId: rest[1],
45535
- };
45536
- }
45537
- const videoId = params.videoId;
45538
- const renditionId = params.renditionId;
45539
- const streamId = params.streamId;
45540
- if (typeof videoId === 'undefined' || videoId === '') {
45541
- throw new AppwriteException('Missing required parameter: "videoId"');
45542
- }
45543
- if (typeof renditionId === 'undefined' || renditionId === '') {
45544
- throw new AppwriteException('Missing required parameter: "renditionId"');
45545
- }
45546
- if (typeof streamId === 'undefined') {
45547
- throw new AppwriteException('Missing required parameter: "streamId"');
45548
- }
45549
- const apiPath = '/videos/{videoId}/outputs/cmaf/renditions/{renditionId}/streams/{streamId}/playlist.m3u8'
45550
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45551
- .replace('{renditionId}', encodeURIComponent(String(renditionId)))
45552
- .replace('{streamId}', encodeURIComponent(String(streamId)));
45553
- const apiPayload = {};
45554
- const uri = new URL(this.client.config.endpoint + apiPath);
45555
- apiPayload['project'] = this.client.config.project;
45556
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45557
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45558
- uri.searchParams.append(key, value);
45559
- }
45560
- return uri.toString();
45561
- }
45562
- getDashManifest(paramsOrFirst) {
45563
- let params;
45564
- if (paramsOrFirst &&
45565
- typeof paramsOrFirst === 'object' &&
45566
- !Array.isArray(paramsOrFirst)) {
45567
- params = (paramsOrFirst || {});
45568
- }
45569
- else {
45570
- params = {
45571
- videoId: paramsOrFirst,
45572
- };
45573
- }
45574
- const videoId = params.videoId;
45575
- if (typeof videoId === 'undefined' || videoId === '') {
45576
- throw new AppwriteException('Missing required parameter: "videoId"');
45577
- }
45578
- const apiPath = '/videos/{videoId}/outputs/dash/master.mpd'.replace('{videoId}', encodeURIComponent(String(videoId)));
45579
- const apiPayload = {};
45580
- const uri = new URL(this.client.config.endpoint + apiPath);
45581
- apiPayload['project'] = this.client.config.project;
45582
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45583
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45584
- uri.searchParams.append(key, value);
45585
- }
45586
- return uri.toString();
45587
- }
45588
- getHlsManifest(paramsOrFirst) {
45589
- let params;
45590
- if (paramsOrFirst &&
45591
- typeof paramsOrFirst === 'object' &&
45592
- !Array.isArray(paramsOrFirst)) {
45593
- params = (paramsOrFirst || {});
45594
- }
45595
- else {
45596
- params = {
45597
- videoId: paramsOrFirst,
45598
- };
45599
- }
45600
- const videoId = params.videoId;
45601
- if (typeof videoId === 'undefined' || videoId === '') {
45602
- throw new AppwriteException('Missing required parameter: "videoId"');
45603
- }
45604
- const apiPath = '/videos/{videoId}/outputs/hls/master.m3u8'.replace('{videoId}', encodeURIComponent(String(videoId)));
45605
- const apiPayload = {};
45606
- const uri = new URL(this.client.config.endpoint + apiPath);
45607
- apiPayload['project'] = this.client.config.project;
45608
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45609
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45610
- uri.searchParams.append(key, value);
45611
- }
45612
- return uri.toString();
45613
- }
45614
- getStreamManifest(paramsOrFirst, ...rest) {
45615
- let params;
45616
- if (paramsOrFirst &&
45617
- typeof paramsOrFirst === 'object' &&
45618
- !Array.isArray(paramsOrFirst)) {
45619
- params = (paramsOrFirst || {});
45620
- }
45621
- else {
45622
- params = {
45623
- videoId: paramsOrFirst,
45624
- renditionId: rest[0],
45625
- streamId: rest[1],
45626
- };
45627
- }
45628
- const videoId = params.videoId;
45629
- const renditionId = params.renditionId;
45630
- const streamId = params.streamId;
45631
- if (typeof videoId === 'undefined' || videoId === '') {
45632
- throw new AppwriteException('Missing required parameter: "videoId"');
45633
- }
45634
- if (typeof renditionId === 'undefined' || renditionId === '') {
45635
- throw new AppwriteException('Missing required parameter: "renditionId"');
45636
- }
45637
- if (typeof streamId === 'undefined') {
45638
- throw new AppwriteException('Missing required parameter: "streamId"');
45639
- }
45640
- const apiPath = '/videos/{videoId}/outputs/hls/renditions/{renditionId}/streams/{streamId}/playlist.m3u8'
45641
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45642
- .replace('{renditionId}', encodeURIComponent(String(renditionId)))
45643
- .replace('{streamId}', encodeURIComponent(String(streamId)));
45644
- const apiPayload = {};
45645
- const uri = new URL(this.client.config.endpoint + apiPath);
45646
- apiPayload['project'] = this.client.config.project;
45647
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45648
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45649
- uri.searchParams.append(key, value);
45650
- }
45651
- return uri.toString();
45652
- }
45653
- getSegment(paramsOrFirst, ...rest) {
45654
- let params;
45655
- if (paramsOrFirst &&
45656
- typeof paramsOrFirst === 'object' &&
45657
- !Array.isArray(paramsOrFirst)) {
45658
- params = (paramsOrFirst || {});
45659
- }
45660
- else {
45661
- params = {
45662
- videoId: paramsOrFirst,
45663
- output: rest[0],
45664
- renditionId: rest[1],
45665
- segmentId: rest[2],
45666
- };
45667
- }
45668
- const videoId = params.videoId;
45669
- const output = params.output;
45670
- const renditionId = params.renditionId;
45671
- const segmentId = params.segmentId;
45672
- if (typeof videoId === 'undefined' || videoId === '') {
45673
- throw new AppwriteException('Missing required parameter: "videoId"');
45674
- }
45675
- if (typeof output === 'undefined') {
45676
- throw new AppwriteException('Missing required parameter: "output"');
45677
- }
45678
- if (typeof renditionId === 'undefined' || renditionId === '') {
45679
- throw new AppwriteException('Missing required parameter: "renditionId"');
45680
- }
45681
- if (typeof segmentId === 'undefined' || segmentId === '') {
45682
- throw new AppwriteException('Missing required parameter: "segmentId"');
45683
- }
45684
- const apiPath = '/videos/{videoId}/outputs/{output}/renditions/{renditionId}/segments/{segmentId}'
45685
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45686
- .replace('{output}', encodeURIComponent(String(output)))
45687
- .replace('{renditionId}', encodeURIComponent(String(renditionId)))
45688
- .replace('{segmentId}', encodeURIComponent(String(segmentId)));
45689
- const apiPayload = {};
45690
- const uri = new URL(this.client.config.endpoint + apiPath);
45691
- apiPayload['project'] = this.client.config.project;
45692
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45693
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45694
- uri.searchParams.append(key, value);
45695
- }
45696
- return uri.toString();
45697
- }
45698
- getSubtitleManifest(paramsOrFirst, ...rest) {
45699
- let params;
45700
- if (paramsOrFirst &&
45701
- typeof paramsOrFirst === 'object' &&
45702
- !Array.isArray(paramsOrFirst)) {
45703
- params = (paramsOrFirst || {});
45704
- }
45705
- else {
45706
- params = {
45707
- videoId: paramsOrFirst,
45708
- output: rest[0],
45709
- subtitleId: rest[1],
45710
- };
45711
- }
45712
- const videoId = params.videoId;
45713
- const output = params.output;
45714
- const subtitleId = params.subtitleId;
45715
- if (typeof videoId === 'undefined' || videoId === '') {
45716
- throw new AppwriteException('Missing required parameter: "videoId"');
45717
- }
45718
- if (typeof output === 'undefined') {
45719
- throw new AppwriteException('Missing required parameter: "output"');
45720
- }
45721
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
45722
- throw new AppwriteException('Missing required parameter: "subtitleId"');
45723
- }
45724
- const apiPath = '/videos/{videoId}/outputs/{output}/subtitles/{subtitleId}/manifest'
45725
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45726
- .replace('{output}', encodeURIComponent(String(output)))
45727
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)));
45728
- const apiPayload = {};
45729
- const uri = new URL(this.client.config.endpoint + apiPath);
45730
- apiPayload['project'] = this.client.config.project;
45731
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45732
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45733
- uri.searchParams.append(key, value);
45734
- }
45735
- return uri.toString();
45736
- }
45737
- getSubtitleSegment(paramsOrFirst, ...rest) {
45738
- let params;
45739
- if (paramsOrFirst &&
45740
- typeof paramsOrFirst === 'object' &&
45741
- !Array.isArray(paramsOrFirst)) {
45742
- params = (paramsOrFirst || {});
45743
- }
45744
- else {
45745
- params = {
45746
- videoId: paramsOrFirst,
45747
- output: rest[0],
45748
- subtitleId: rest[1],
45749
- segmentId: rest[2],
45750
- };
45751
- }
45752
- const videoId = params.videoId;
45753
- const output = params.output;
45754
- const subtitleId = params.subtitleId;
45755
- const segmentId = params.segmentId;
45756
- if (typeof videoId === 'undefined' || videoId === '') {
45757
- throw new AppwriteException('Missing required parameter: "videoId"');
45758
- }
45759
- if (typeof output === 'undefined') {
45760
- throw new AppwriteException('Missing required parameter: "output"');
45761
- }
45762
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
45763
- throw new AppwriteException('Missing required parameter: "subtitleId"');
45764
- }
45765
- if (typeof segmentId === 'undefined' || segmentId === '') {
45766
- throw new AppwriteException('Missing required parameter: "segmentId"');
45767
- }
45768
- const apiPath = '/videos/{videoId}/outputs/{output}/subtitles/{subtitleId}/segments/{segmentId}'
45769
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45770
- .replace('{output}', encodeURIComponent(String(output)))
45771
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)))
45772
- .replace('{segmentId}', encodeURIComponent(String(segmentId)));
45773
- const apiPayload = {};
45774
- const uri = new URL(this.client.config.endpoint + apiPath);
45775
- apiPayload['project'] = this.client.config.project;
45776
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45777
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45778
- uri.searchParams.append(key, value);
45779
- }
45780
- return uri.toString();
45781
- }
45782
- getPreview(paramsOrFirst, ...rest) {
45783
- let params;
45784
- if (paramsOrFirst &&
45785
- typeof paramsOrFirst === 'object' &&
45786
- !Array.isArray(paramsOrFirst)) {
45787
- params = (paramsOrFirst || {});
45788
- }
45789
- else {
45790
- params = {
45791
- videoId: paramsOrFirst,
45792
- previewId: rest[0],
45793
- width: rest[1],
45794
- height: rest[2],
45795
- output: rest[3],
45796
- };
45797
- }
45798
- const videoId = params.videoId;
45799
- const previewId = params.previewId;
45800
- const width = params.width;
45801
- const height = params.height;
45802
- const output = params.output;
45803
- if (typeof videoId === 'undefined' || videoId === '') {
45804
- throw new AppwriteException('Missing required parameter: "videoId"');
45805
- }
45806
- if (typeof previewId === 'undefined' || previewId === '') {
45807
- throw new AppwriteException('Missing required parameter: "previewId"');
45808
- }
45809
- const apiPath = '/videos/{videoId}/previews/{previewId}'
45810
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45811
- .replace('{previewId}', encodeURIComponent(String(previewId)));
45812
- const apiPayload = {};
45813
- if (typeof width !== 'undefined') {
45814
- apiPayload['width'] = width;
45815
- }
45816
- if (typeof height !== 'undefined') {
45817
- apiPayload['height'] = height;
45818
- }
45819
- if (typeof output !== 'undefined') {
45820
- apiPayload['output'] = output;
45821
- }
45822
- const uri = new URL(this.client.config.endpoint + apiPath);
45823
- apiPayload['project'] = this.client.config.project;
45824
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
45825
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
45826
- uri.searchParams.append(key, value);
45827
- }
45828
- return uri.toString();
45829
- }
45830
- listRenditions(paramsOrFirst, ...rest) {
45831
- let params;
45832
- if (paramsOrFirst &&
45833
- typeof paramsOrFirst === 'object' &&
45834
- !Array.isArray(paramsOrFirst)) {
45835
- params = (paramsOrFirst || {});
45836
- }
45837
- else {
45838
- params = {
45839
- videoId: paramsOrFirst,
45840
- output: rest[0],
45841
- status: rest[1],
45842
- };
45843
- }
45844
- const videoId = params.videoId;
45845
- const output = params.output;
45846
- const status = params.status;
45847
- if (typeof videoId === 'undefined' || videoId === '') {
45848
- throw new AppwriteException('Missing required parameter: "videoId"');
45849
- }
45850
- const apiPath = '/videos/{videoId}/renditions'.replace('{videoId}', encodeURIComponent(String(videoId)));
45851
- const apiPayload = {};
45852
- if (typeof output !== 'undefined') {
45853
- apiPayload['output'] = output;
45854
- }
45855
- if (typeof status !== 'undefined') {
45856
- apiPayload['status'] = status;
45857
- }
45858
- const uri = new URL(this.client.config.endpoint + apiPath);
45859
- const apiHeaders = {
45860
- 'X-Appwrite-Project': this.client.config.project,
45861
- accept: 'application/json',
45862
- };
45863
- return this.client.call('get', uri, apiHeaders, apiPayload);
45864
- }
45865
- createRendition(paramsOrFirst, ...rest) {
45866
- let params;
45867
- if (paramsOrFirst &&
45868
- typeof paramsOrFirst === 'object' &&
45869
- !Array.isArray(paramsOrFirst)) {
45870
- params = (paramsOrFirst || {});
45871
- }
45872
- else {
45873
- params = {
45874
- videoId: paramsOrFirst,
45875
- profileId: rest[0],
45876
- output: rest[1],
45877
- };
45878
- }
45879
- const videoId = params.videoId;
45880
- const profileId = params.profileId;
45881
- const output = params.output;
45882
- if (typeof videoId === 'undefined' || videoId === '') {
45883
- throw new AppwriteException('Missing required parameter: "videoId"');
45884
- }
45885
- if (typeof profileId === 'undefined') {
45886
- throw new AppwriteException('Missing required parameter: "profileId"');
45887
- }
45888
- if (typeof output === 'undefined') {
45889
- throw new AppwriteException('Missing required parameter: "output"');
45890
- }
45891
- const apiPath = '/videos/{videoId}/renditions'.replace('{videoId}', encodeURIComponent(String(videoId)));
45892
- const apiPayload = {};
45893
- if (typeof profileId !== 'undefined') {
45894
- apiPayload['profileId'] = profileId;
45895
- }
45896
- if (typeof output !== 'undefined') {
45897
- apiPayload['output'] = output;
45898
- }
45899
- const uri = new URL(this.client.config.endpoint + apiPath);
45900
- const apiHeaders = {
45901
- 'X-Appwrite-Project': this.client.config.project,
45902
- 'content-type': 'application/json',
45903
- accept: 'application/json',
45904
- };
45905
- return this.client.call('post', uri, apiHeaders, apiPayload);
45906
- }
45907
- getRendition(paramsOrFirst, ...rest) {
45908
- let params;
45909
- if (paramsOrFirst &&
45910
- typeof paramsOrFirst === 'object' &&
45911
- !Array.isArray(paramsOrFirst)) {
45912
- params = (paramsOrFirst || {});
45913
- }
45914
- else {
45915
- params = {
45916
- videoId: paramsOrFirst,
45917
- renditionId: rest[0],
45918
- };
45919
- }
45920
- const videoId = params.videoId;
45921
- const renditionId = params.renditionId;
45922
- if (typeof videoId === 'undefined' || videoId === '') {
45923
- throw new AppwriteException('Missing required parameter: "videoId"');
45924
- }
45925
- if (typeof renditionId === 'undefined' || renditionId === '') {
45926
- throw new AppwriteException('Missing required parameter: "renditionId"');
45927
- }
45928
- const apiPath = '/videos/{videoId}/renditions/{renditionId}'
45929
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45930
- .replace('{renditionId}', encodeURIComponent(String(renditionId)));
45931
- const apiPayload = {};
45932
- const uri = new URL(this.client.config.endpoint + apiPath);
45933
- const apiHeaders = {
45934
- 'X-Appwrite-Project': this.client.config.project,
45935
- accept: 'application/json',
45936
- };
45937
- return this.client.call('get', uri, apiHeaders, apiPayload);
45938
- }
45939
- deleteRendition(paramsOrFirst, ...rest) {
45940
- let params;
45941
- if (paramsOrFirst &&
45942
- typeof paramsOrFirst === 'object' &&
45943
- !Array.isArray(paramsOrFirst)) {
45944
- params = (paramsOrFirst || {});
45945
- }
45946
- else {
45947
- params = {
45948
- videoId: paramsOrFirst,
45949
- renditionId: rest[0],
45950
- };
45951
- }
45952
- const videoId = params.videoId;
45953
- const renditionId = params.renditionId;
45954
- if (typeof videoId === 'undefined' || videoId === '') {
45955
- throw new AppwriteException('Missing required parameter: "videoId"');
45956
- }
45957
- if (typeof renditionId === 'undefined' || renditionId === '') {
45958
- throw new AppwriteException('Missing required parameter: "renditionId"');
45959
- }
45960
- const apiPath = '/videos/{videoId}/renditions/{renditionId}'
45961
- .replace('{videoId}', encodeURIComponent(String(videoId)))
45962
- .replace('{renditionId}', encodeURIComponent(String(renditionId)));
45963
- const apiPayload = {};
45964
- const uri = new URL(this.client.config.endpoint + apiPath);
45965
- const apiHeaders = {
45966
- 'X-Appwrite-Project': this.client.config.project,
45967
- 'content-type': 'application/json',
45968
- accept: 'application/json',
45969
- };
45970
- return this.client.call('delete', uri, apiHeaders, apiPayload);
45971
- }
45972
- createSource(paramsOrFirst) {
45973
- let params;
45974
- if (paramsOrFirst &&
45975
- typeof paramsOrFirst === 'object' &&
45976
- !Array.isArray(paramsOrFirst)) {
45977
- params = (paramsOrFirst || {});
45978
- }
45979
- else {
45980
- params = {
45981
- videoId: paramsOrFirst,
45982
- };
45983
- }
45984
- const videoId = params.videoId;
45985
- if (typeof videoId === 'undefined' || videoId === '') {
45986
- throw new AppwriteException('Missing required parameter: "videoId"');
45987
- }
45988
- const apiPath = '/videos/{videoId}/source'.replace('{videoId}', encodeURIComponent(String(videoId)));
45989
- const apiPayload = {};
45990
- const uri = new URL(this.client.config.endpoint + apiPath);
45991
- const apiHeaders = {
45992
- 'X-Appwrite-Project': this.client.config.project,
45993
- 'content-type': 'application/json',
45994
- accept: 'application/json',
45995
- };
45996
- return this.client.call('post', uri, apiHeaders, apiPayload);
45997
- }
45998
- listSubtitles(paramsOrFirst) {
45999
- let params;
46000
- if (paramsOrFirst &&
46001
- typeof paramsOrFirst === 'object' &&
46002
- !Array.isArray(paramsOrFirst)) {
46003
- params = (paramsOrFirst || {});
46004
- }
46005
- else {
46006
- params = {
46007
- videoId: paramsOrFirst,
46008
- };
46009
- }
46010
- const videoId = params.videoId;
46011
- if (typeof videoId === 'undefined' || videoId === '') {
46012
- throw new AppwriteException('Missing required parameter: "videoId"');
46013
- }
46014
- const apiPath = '/videos/{videoId}/subtitles'.replace('{videoId}', encodeURIComponent(String(videoId)));
46015
- const apiPayload = {};
46016
- const uri = new URL(this.client.config.endpoint + apiPath);
46017
- const apiHeaders = {
46018
- 'X-Appwrite-Project': this.client.config.project,
46019
- accept: 'application/json',
46020
- };
46021
- return this.client.call('get', uri, apiHeaders, apiPayload);
46022
- }
46023
- createSubtitle(paramsOrFirst, ...rest) {
46024
- let params;
46025
- if (paramsOrFirst &&
46026
- typeof paramsOrFirst === 'object' &&
46027
- !Array.isArray(paramsOrFirst)) {
46028
- params = (paramsOrFirst || {});
46029
- }
46030
- else {
46031
- params = {
46032
- videoId: paramsOrFirst,
46033
- bucketId: rest[0],
46034
- fileId: rest[1],
46035
- name: rest[2],
46036
- code: rest[3],
46037
- xdefault: rest[4],
46038
- };
46039
- }
46040
- const videoId = params.videoId;
46041
- const bucketId = params.bucketId;
46042
- const fileId = params.fileId;
46043
- const name = params.name;
46044
- const code = params.code;
46045
- const xdefault = params.xdefault;
46046
- if (typeof videoId === 'undefined' || videoId === '') {
46047
- throw new AppwriteException('Missing required parameter: "videoId"');
46048
- }
46049
- if (typeof bucketId === 'undefined') {
46050
- throw new AppwriteException('Missing required parameter: "bucketId"');
46051
- }
46052
- if (typeof fileId === 'undefined') {
46053
- throw new AppwriteException('Missing required parameter: "fileId"');
46054
- }
46055
- if (typeof name === 'undefined') {
46056
- throw new AppwriteException('Missing required parameter: "name"');
46057
- }
46058
- if (typeof code === 'undefined') {
46059
- throw new AppwriteException('Missing required parameter: "code"');
46060
- }
46061
- const apiPath = '/videos/{videoId}/subtitles'.replace('{videoId}', encodeURIComponent(String(videoId)));
46062
- const apiPayload = {};
46063
- if (typeof bucketId !== 'undefined') {
46064
- apiPayload['bucketId'] = bucketId;
46065
- }
46066
- if (typeof fileId !== 'undefined') {
46067
- apiPayload['fileId'] = fileId;
46068
- }
46069
- if (typeof name !== 'undefined') {
46070
- apiPayload['name'] = name;
46071
- }
46072
- if (typeof code !== 'undefined') {
46073
- apiPayload['code'] = code;
46074
- }
46075
- if (typeof xdefault !== 'undefined') {
46076
- apiPayload['default'] = xdefault;
46077
- }
46078
- const uri = new URL(this.client.config.endpoint + apiPath);
46079
- const apiHeaders = {
46080
- 'X-Appwrite-Project': this.client.config.project,
46081
- 'content-type': 'application/json',
46082
- accept: 'application/json',
46083
- };
46084
- return this.client.call('post', uri, apiHeaders, apiPayload);
46085
- }
46086
- updateSubtitle(paramsOrFirst, ...rest) {
46087
- let params;
46088
- if (paramsOrFirst &&
46089
- typeof paramsOrFirst === 'object' &&
46090
- !Array.isArray(paramsOrFirst)) {
46091
- params = (paramsOrFirst || {});
46092
- }
46093
- else {
46094
- params = {
46095
- videoId: paramsOrFirst,
46096
- subtitleId: rest[0],
46097
- bucketId: rest[1],
46098
- fileId: rest[2],
46099
- name: rest[3],
46100
- code: rest[4],
46101
- xdefault: rest[5],
46102
- };
46103
- }
46104
- const videoId = params.videoId;
46105
- const subtitleId = params.subtitleId;
46106
- const bucketId = params.bucketId;
46107
- const fileId = params.fileId;
46108
- const name = params.name;
46109
- const code = params.code;
46110
- const xdefault = params.xdefault;
46111
- if (typeof videoId === 'undefined' || videoId === '') {
46112
- throw new AppwriteException('Missing required parameter: "videoId"');
46113
- }
46114
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
46115
- throw new AppwriteException('Missing required parameter: "subtitleId"');
46116
- }
46117
- const apiPath = '/videos/{videoId}/subtitles/{subtitleId}'
46118
- .replace('{videoId}', encodeURIComponent(String(videoId)))
46119
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)));
46120
- const apiPayload = {};
46121
- if (typeof bucketId !== 'undefined') {
46122
- apiPayload['bucketId'] = bucketId;
46123
- }
46124
- if (typeof fileId !== 'undefined') {
46125
- apiPayload['fileId'] = fileId;
46126
- }
46127
- if (typeof name !== 'undefined') {
46128
- apiPayload['name'] = name;
46129
- }
46130
- if (typeof code !== 'undefined') {
46131
- apiPayload['code'] = code;
46132
- }
46133
- if (typeof xdefault !== 'undefined') {
46134
- apiPayload['default'] = xdefault;
46135
- }
46136
- const uri = new URL(this.client.config.endpoint + apiPath);
46137
- const apiHeaders = {
46138
- 'X-Appwrite-Project': this.client.config.project,
46139
- 'content-type': 'application/json',
46140
- accept: 'application/json',
46141
- };
46142
- return this.client.call('patch', uri, apiHeaders, apiPayload);
46143
- }
46144
- deleteSubtitle(paramsOrFirst, ...rest) {
46145
- let params;
46146
- if (paramsOrFirst &&
46147
- typeof paramsOrFirst === 'object' &&
46148
- !Array.isArray(paramsOrFirst)) {
46149
- params = (paramsOrFirst || {});
46150
- }
46151
- else {
46152
- params = {
46153
- videoId: paramsOrFirst,
46154
- subtitleId: rest[0],
46155
- };
46156
- }
46157
- const videoId = params.videoId;
46158
- const subtitleId = params.subtitleId;
46159
- if (typeof videoId === 'undefined' || videoId === '') {
46160
- throw new AppwriteException('Missing required parameter: "videoId"');
46161
- }
46162
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
46163
- throw new AppwriteException('Missing required parameter: "subtitleId"');
46164
- }
46165
- const apiPath = '/videos/{videoId}/subtitles/{subtitleId}'
46166
- .replace('{videoId}', encodeURIComponent(String(videoId)))
46167
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)));
46168
- const apiPayload = {};
46169
- const uri = new URL(this.client.config.endpoint + apiPath);
46170
- const apiHeaders = {
46171
- 'X-Appwrite-Project': this.client.config.project,
46172
- 'content-type': 'application/json',
46173
- accept: 'application/json',
46174
- };
46175
- return this.client.call('delete', uri, apiHeaders, apiPayload);
46176
- }
46177
- getTimeline(paramsOrFirst) {
46178
- let params;
46179
- if (paramsOrFirst &&
46180
- typeof paramsOrFirst === 'object' &&
46181
- !Array.isArray(paramsOrFirst)) {
46182
- params = (paramsOrFirst || {});
46183
- }
46184
- else {
46185
- params = {
46186
- videoId: paramsOrFirst,
46187
- };
46188
- }
46189
- const videoId = params.videoId;
46190
- if (typeof videoId === 'undefined' || videoId === '') {
46191
- throw new AppwriteException('Missing required parameter: "videoId"');
46192
- }
46193
- const apiPath = '/videos/{videoId}/timeline'.replace('{videoId}', encodeURIComponent(String(videoId)));
46194
- const apiPayload = {};
46195
- const uri = new URL(this.client.config.endpoint + apiPath);
46196
- const apiHeaders = {
46197
- 'X-Appwrite-Project': this.client.config.project,
46198
- accept: 'text/plain',
46199
- };
46200
- return this.client.call('get', uri, apiHeaders, apiPayload, 'text');
46201
- }
46202
- createTimeline(paramsOrFirst) {
46203
- let params;
46204
- if (paramsOrFirst &&
46205
- typeof paramsOrFirst === 'object' &&
46206
- !Array.isArray(paramsOrFirst)) {
46207
- params = (paramsOrFirst || {});
46208
- }
46209
- else {
46210
- params = {
46211
- videoId: paramsOrFirst,
46212
- };
46213
- }
46214
- const videoId = params.videoId;
46215
- if (typeof videoId === 'undefined' || videoId === '') {
46216
- throw new AppwriteException('Missing required parameter: "videoId"');
46217
- }
46218
- const apiPath = '/videos/{videoId}/timeline'.replace('{videoId}', encodeURIComponent(String(videoId)));
46219
- const apiPayload = {};
46220
- const uri = new URL(this.client.config.endpoint + apiPath);
46221
- const apiHeaders = {
46222
- 'X-Appwrite-Project': this.client.config.project,
46223
- 'content-type': 'application/json',
46224
- accept: 'application/json',
46225
- };
46226
- return this.client.call('post', uri, apiHeaders, apiPayload);
46227
- }
46228
- }
46229
-
46230
- class Waf {
46231
- constructor(client) {
46232
- this.client = client;
46233
- }
46234
- listRules(paramsOrFirst, ...rest) {
46235
- let params;
46236
- if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
46237
- (paramsOrFirst &&
46238
- typeof paramsOrFirst === 'object' &&
46239
- !Array.isArray(paramsOrFirst))) {
46240
- params = (paramsOrFirst || {});
46241
- }
46242
- else {
46243
- params = {
46244
- queries: paramsOrFirst,
46245
- search: rest[0],
46246
- total: rest[1],
46247
- };
46248
- }
46249
- const queries = params.queries;
46250
- const search = params.search;
46251
- const total = params.total;
46252
- const apiPath = '/waf/rules';
46253
- const apiPayload = {};
46254
- if (typeof queries !== 'undefined') {
46255
- apiPayload['queries'] = queries;
46256
- }
46257
- if (typeof search !== 'undefined') {
46258
- apiPayload['search'] = search;
46259
- }
46260
- if (typeof total !== 'undefined') {
46261
- apiPayload['total'] = total;
46262
- }
46263
- const uri = new URL(this.client.config.endpoint + apiPath);
46264
- const apiHeaders = {
46265
- 'X-Appwrite-Project': this.client.config.project,
46266
- accept: 'application/json',
46267
- };
46268
- return this.client.call('get', uri, apiHeaders, apiPayload);
46269
- }
46270
- createBypassRule(paramsOrFirst, ...rest) {
46271
- let params;
46272
- if (paramsOrFirst &&
46273
- typeof paramsOrFirst === 'object' &&
46274
- !Array.isArray(paramsOrFirst)) {
46275
- params = (paramsOrFirst || {});
46276
- }
46277
- else {
46278
- params = {
46279
- ruleId: paramsOrFirst,
46280
- resourceType: rest[0],
46281
- name: rest[1],
46282
- resourceId: rest[2],
46283
- description: rest[3],
46284
- priority: rest[4],
46285
- enabled: rest[5],
46286
- conditions: rest[6],
46287
- };
46288
- }
46289
- const ruleId = params.ruleId;
46290
- const resourceType = params.resourceType;
46291
- const name = params.name;
46292
- const resourceId = params.resourceId;
46293
- const description = params.description;
46294
- const priority = params.priority;
46295
- const enabled = params.enabled;
46296
- const conditions = params.conditions;
46297
- if (typeof ruleId === 'undefined') {
46298
- throw new AppwriteException('Missing required parameter: "ruleId"');
46299
- }
46300
- if (typeof resourceType === 'undefined') {
46301
- throw new AppwriteException('Missing required parameter: "resourceType"');
46302
- }
46303
- if (typeof name === 'undefined') {
46304
- throw new AppwriteException('Missing required parameter: "name"');
46305
- }
46306
- const apiPath = '/waf/rules/bypass';
46307
- const apiPayload = {};
46308
- if (typeof ruleId !== 'undefined') {
46309
- apiPayload['ruleId'] = ruleId;
46310
- }
46311
- if (typeof resourceType !== 'undefined') {
46312
- apiPayload['resourceType'] = resourceType;
46313
- }
46314
- if (typeof resourceId !== 'undefined') {
46315
- apiPayload['resourceId'] = resourceId;
46316
- }
46317
- if (typeof name !== 'undefined') {
46318
- apiPayload['name'] = name;
46319
- }
46320
- if (typeof description !== 'undefined') {
46321
- apiPayload['description'] = description;
46322
- }
46323
- if (typeof priority !== 'undefined') {
46324
- apiPayload['priority'] = priority;
46325
- }
46326
- if (typeof enabled !== 'undefined') {
46327
- apiPayload['enabled'] = enabled;
46328
- }
46329
- if (typeof conditions !== 'undefined') {
46330
- apiPayload['conditions'] = conditions;
46331
- }
46332
- const uri = new URL(this.client.config.endpoint + apiPath);
46333
- const apiHeaders = {
46334
- 'X-Appwrite-Project': this.client.config.project,
46335
- 'content-type': 'application/json',
46336
- accept: 'application/json',
46337
- };
46338
- return this.client.call('post', uri, apiHeaders, apiPayload);
46339
- }
46340
- updateBypassRule(paramsOrFirst, ...rest) {
46341
- let params;
46342
- if (paramsOrFirst &&
46343
- typeof paramsOrFirst === 'object' &&
46344
- !Array.isArray(paramsOrFirst)) {
46345
- params = (paramsOrFirst || {});
46346
- }
46347
- else {
46348
- params = {
46349
- ruleId: paramsOrFirst,
46350
- resourceType: rest[0],
46351
- resourceId: rest[1],
46352
- name: rest[2],
46353
- description: rest[3],
46354
- priority: rest[4],
46355
- enabled: rest[5],
46356
- conditions: rest[6],
46357
- };
46358
- }
46359
- const ruleId = params.ruleId;
46360
- const resourceType = params.resourceType;
46361
- const resourceId = params.resourceId;
46362
- const name = params.name;
46363
- const description = params.description;
46364
- const priority = params.priority;
46365
- const enabled = params.enabled;
46366
- const conditions = params.conditions;
46367
- if (typeof ruleId === 'undefined' || ruleId === '') {
46368
- throw new AppwriteException('Missing required parameter: "ruleId"');
46369
- }
46370
- const apiPath = '/waf/rules/bypass/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
46371
- const apiPayload = {};
46372
- if (typeof resourceType !== 'undefined') {
46373
- apiPayload['resourceType'] = resourceType;
46374
- }
46375
- if (typeof resourceId !== 'undefined') {
46376
- apiPayload['resourceId'] = resourceId;
46377
- }
46378
- if (typeof name !== 'undefined') {
46379
- apiPayload['name'] = name;
46380
- }
46381
- if (typeof description !== 'undefined') {
46382
- apiPayload['description'] = description;
46383
- }
46384
- if (typeof priority !== 'undefined') {
46385
- apiPayload['priority'] = priority;
46386
- }
46387
- if (typeof enabled !== 'undefined') {
46388
- apiPayload['enabled'] = enabled;
46389
- }
46390
- if (typeof conditions !== 'undefined') {
46391
- apiPayload['conditions'] = conditions;
46392
- }
46393
- const uri = new URL(this.client.config.endpoint + apiPath);
46394
- const apiHeaders = {
46395
- 'X-Appwrite-Project': this.client.config.project,
46396
- 'content-type': 'application/json',
46397
- accept: 'application/json',
46398
- };
46399
- return this.client.call('patch', uri, apiHeaders, apiPayload);
46400
- }
46401
- createChallengeRule(paramsOrFirst, ...rest) {
46402
- let params;
46403
- if (paramsOrFirst &&
46404
- typeof paramsOrFirst === 'object' &&
46405
- !Array.isArray(paramsOrFirst)) {
46406
- params = (paramsOrFirst || {});
46407
- }
46408
- else {
46409
- params = {
46410
- ruleId: paramsOrFirst,
46411
- resourceType: rest[0],
46412
- name: rest[1],
46413
- resourceId: rest[2],
46414
- description: rest[3],
46415
- challengeType: rest[4],
46416
- priority: rest[5],
46417
- enabled: rest[6],
46418
- conditions: rest[7],
46419
- difficulty: rest[8],
46420
- ttl: rest[9],
46421
- };
46422
- }
46423
- const ruleId = params.ruleId;
46424
- const resourceType = params.resourceType;
46425
- const name = params.name;
46426
- const resourceId = params.resourceId;
46427
- const description = params.description;
46428
- const challengeType = params.challengeType;
46429
- const priority = params.priority;
46430
- const enabled = params.enabled;
46431
- const conditions = params.conditions;
46432
- const difficulty = params.difficulty;
46433
- const ttl = params.ttl;
46434
- if (typeof ruleId === 'undefined') {
46435
- throw new AppwriteException('Missing required parameter: "ruleId"');
46436
- }
46437
- if (typeof resourceType === 'undefined') {
46438
- throw new AppwriteException('Missing required parameter: "resourceType"');
46439
- }
46440
- if (typeof name === 'undefined') {
46441
- throw new AppwriteException('Missing required parameter: "name"');
46442
- }
46443
- const apiPath = '/waf/rules/challenge';
46444
- const apiPayload = {};
46445
- if (typeof ruleId !== 'undefined') {
46446
- apiPayload['ruleId'] = ruleId;
46447
- }
46448
- if (typeof resourceType !== 'undefined') {
46449
- apiPayload['resourceType'] = resourceType;
46450
- }
46451
- if (typeof resourceId !== 'undefined') {
46452
- apiPayload['resourceId'] = resourceId;
46453
- }
46454
- if (typeof name !== 'undefined') {
46455
- apiPayload['name'] = name;
46456
- }
46457
- if (typeof description !== 'undefined') {
46458
- apiPayload['description'] = description;
46459
- }
46460
- if (typeof challengeType !== 'undefined') {
46461
- apiPayload['challengeType'] = challengeType;
46462
- }
46463
- if (typeof priority !== 'undefined') {
46464
- apiPayload['priority'] = priority;
46465
- }
46466
- if (typeof enabled !== 'undefined') {
46467
- apiPayload['enabled'] = enabled;
46468
- }
46469
- if (typeof conditions !== 'undefined') {
46470
- apiPayload['conditions'] = conditions;
46471
- }
46472
- if (typeof difficulty !== 'undefined') {
46473
- apiPayload['difficulty'] = difficulty;
46474
- }
46475
- if (typeof ttl !== 'undefined') {
46476
- apiPayload['ttl'] = ttl;
46477
- }
46478
- const uri = new URL(this.client.config.endpoint + apiPath);
46479
- const apiHeaders = {
46480
- 'X-Appwrite-Project': this.client.config.project,
46481
- 'content-type': 'application/json',
46482
- accept: 'application/json',
46483
- };
46484
- return this.client.call('post', uri, apiHeaders, apiPayload);
46485
- }
46486
- updateChallengeRule(paramsOrFirst, ...rest) {
46487
- let params;
46488
- if (paramsOrFirst &&
46489
- typeof paramsOrFirst === 'object' &&
46490
- !Array.isArray(paramsOrFirst)) {
46491
- params = (paramsOrFirst || {});
46492
- }
46493
- else {
46494
- params = {
46495
- ruleId: paramsOrFirst,
46496
- resourceType: rest[0],
46497
- resourceId: rest[1],
46498
- name: rest[2],
46499
- description: rest[3],
46500
- challengeType: rest[4],
46501
- priority: rest[5],
46502
- enabled: rest[6],
46503
- conditions: rest[7],
46504
- difficulty: rest[8],
46505
- ttl: rest[9],
46506
- };
46507
- }
46508
- const ruleId = params.ruleId;
46509
- const resourceType = params.resourceType;
46510
- const resourceId = params.resourceId;
46511
- const name = params.name;
46512
- const description = params.description;
46513
- const challengeType = params.challengeType;
46514
- const priority = params.priority;
46515
- const enabled = params.enabled;
46516
- const conditions = params.conditions;
46517
- const difficulty = params.difficulty;
46518
- const ttl = params.ttl;
46519
- if (typeof ruleId === 'undefined' || ruleId === '') {
46520
- throw new AppwriteException('Missing required parameter: "ruleId"');
46521
- }
46522
- const apiPath = '/waf/rules/challenge/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
46523
- const apiPayload = {};
46524
- if (typeof resourceType !== 'undefined') {
46525
- apiPayload['resourceType'] = resourceType;
46526
- }
46527
- if (typeof resourceId !== 'undefined') {
46528
- apiPayload['resourceId'] = resourceId;
46529
- }
46530
- if (typeof name !== 'undefined') {
46531
- apiPayload['name'] = name;
46532
- }
46533
- if (typeof description !== 'undefined') {
46534
- apiPayload['description'] = description;
46535
- }
46536
- if (typeof challengeType !== 'undefined') {
46537
- apiPayload['challengeType'] = challengeType;
46538
- }
46539
- if (typeof priority !== 'undefined') {
46540
- apiPayload['priority'] = priority;
46541
- }
46542
- if (typeof enabled !== 'undefined') {
46543
- apiPayload['enabled'] = enabled;
46544
- }
46545
- if (typeof conditions !== 'undefined') {
46546
- apiPayload['conditions'] = conditions;
46547
- }
46548
- if (typeof difficulty !== 'undefined') {
46549
- apiPayload['difficulty'] = difficulty;
46550
- }
46551
- if (typeof ttl !== 'undefined') {
46552
- apiPayload['ttl'] = ttl;
46553
- }
46554
- const uri = new URL(this.client.config.endpoint + apiPath);
46555
- const apiHeaders = {
46556
- 'X-Appwrite-Project': this.client.config.project,
46557
- 'content-type': 'application/json',
46558
- accept: 'application/json',
46559
- };
46560
- return this.client.call('patch', uri, apiHeaders, apiPayload);
46561
- }
46562
- createDenyRule(paramsOrFirst, ...rest) {
46563
- let params;
46564
- if (paramsOrFirst &&
46565
- typeof paramsOrFirst === 'object' &&
46566
- !Array.isArray(paramsOrFirst)) {
46567
- params = (paramsOrFirst || {});
46568
- }
46569
- else {
46570
- params = {
46571
- ruleId: paramsOrFirst,
46572
- resourceType: rest[0],
46573
- name: rest[1],
46574
- resourceId: rest[2],
46575
- description: rest[3],
46576
- priority: rest[4],
46577
- enabled: rest[5],
46578
- conditions: rest[6],
46579
- };
46580
- }
46581
- const ruleId = params.ruleId;
46582
- const resourceType = params.resourceType;
46583
- const name = params.name;
46584
- const resourceId = params.resourceId;
46585
- const description = params.description;
46586
- const priority = params.priority;
46587
- const enabled = params.enabled;
46588
- const conditions = params.conditions;
46589
- if (typeof ruleId === 'undefined') {
46590
- throw new AppwriteException('Missing required parameter: "ruleId"');
46591
- }
46592
- if (typeof resourceType === 'undefined') {
46593
- throw new AppwriteException('Missing required parameter: "resourceType"');
46594
- }
46595
- if (typeof name === 'undefined') {
46596
- throw new AppwriteException('Missing required parameter: "name"');
46597
- }
46598
- const apiPath = '/waf/rules/deny';
46599
- const apiPayload = {};
46600
- if (typeof ruleId !== 'undefined') {
46601
- apiPayload['ruleId'] = ruleId;
46602
- }
46603
- if (typeof resourceType !== 'undefined') {
46604
- apiPayload['resourceType'] = resourceType;
46605
- }
46606
- if (typeof resourceId !== 'undefined') {
46607
- apiPayload['resourceId'] = resourceId;
46608
- }
46609
- if (typeof name !== 'undefined') {
46610
- apiPayload['name'] = name;
46611
- }
46612
- if (typeof description !== 'undefined') {
46613
- apiPayload['description'] = description;
46614
- }
46615
- if (typeof priority !== 'undefined') {
46616
- apiPayload['priority'] = priority;
46617
- }
46618
- if (typeof enabled !== 'undefined') {
46619
- apiPayload['enabled'] = enabled;
46620
- }
46621
- if (typeof conditions !== 'undefined') {
46622
- apiPayload['conditions'] = conditions;
46623
- }
46624
- const uri = new URL(this.client.config.endpoint + apiPath);
46625
- const apiHeaders = {
46626
- 'X-Appwrite-Project': this.client.config.project,
46627
- 'content-type': 'application/json',
46628
- accept: 'application/json',
46629
- };
46630
- return this.client.call('post', uri, apiHeaders, apiPayload);
46631
- }
46632
- updateDenyRule(paramsOrFirst, ...rest) {
46633
- let params;
46634
- if (paramsOrFirst &&
46635
- typeof paramsOrFirst === 'object' &&
46636
- !Array.isArray(paramsOrFirst)) {
46637
- params = (paramsOrFirst || {});
46638
- }
46639
- else {
46640
- params = {
46641
- ruleId: paramsOrFirst,
46642
- resourceType: rest[0],
46643
- resourceId: rest[1],
46644
- name: rest[2],
46645
- description: rest[3],
46646
- priority: rest[4],
46647
- enabled: rest[5],
46648
- conditions: rest[6],
46649
- };
46650
- }
46651
- const ruleId = params.ruleId;
46652
- const resourceType = params.resourceType;
46653
- const resourceId = params.resourceId;
46654
- const name = params.name;
46655
- const description = params.description;
46656
- const priority = params.priority;
46657
- const enabled = params.enabled;
46658
- const conditions = params.conditions;
46659
- if (typeof ruleId === 'undefined' || ruleId === '') {
46660
- throw new AppwriteException('Missing required parameter: "ruleId"');
46661
- }
46662
- const apiPath = '/waf/rules/deny/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
46663
- const apiPayload = {};
46664
- if (typeof resourceType !== 'undefined') {
46665
- apiPayload['resourceType'] = resourceType;
46666
- }
46667
- if (typeof resourceId !== 'undefined') {
46668
- apiPayload['resourceId'] = resourceId;
46669
- }
46670
- if (typeof name !== 'undefined') {
46671
- apiPayload['name'] = name;
46672
- }
46673
- if (typeof description !== 'undefined') {
46674
- apiPayload['description'] = description;
46675
- }
46676
- if (typeof priority !== 'undefined') {
46677
- apiPayload['priority'] = priority;
46678
- }
46679
- if (typeof enabled !== 'undefined') {
46680
- apiPayload['enabled'] = enabled;
46681
- }
46682
- if (typeof conditions !== 'undefined') {
46683
- apiPayload['conditions'] = conditions;
46684
- }
46685
- const uri = new URL(this.client.config.endpoint + apiPath);
46686
- const apiHeaders = {
46687
- 'X-Appwrite-Project': this.client.config.project,
46688
- 'content-type': 'application/json',
46689
- accept: 'application/json',
46690
- };
46691
- return this.client.call('patch', uri, apiHeaders, apiPayload);
46692
- }
46693
- createRateLimitRule(paramsOrFirst, ...rest) {
46694
- let params;
46695
- if (paramsOrFirst &&
46696
- typeof paramsOrFirst === 'object' &&
46697
- !Array.isArray(paramsOrFirst)) {
46698
- params = (paramsOrFirst || {});
46699
- }
46700
- else {
46701
- params = {
46702
- ruleId: paramsOrFirst,
46703
- resourceType: rest[0],
46704
- name: rest[1],
46705
- limit: rest[2],
46706
- interval: rest[3],
46707
- resourceId: rest[4],
46708
- description: rest[5],
46709
- key: rest[6],
46710
- strategy: rest[7],
46711
- maxBucketSize: rest[8],
46712
- priority: rest[9],
46713
- enabled: rest[10],
46714
- conditions: rest[11],
46715
- };
46716
- }
46717
- const ruleId = params.ruleId;
46718
- const resourceType = params.resourceType;
46719
- const name = params.name;
46720
- const limit = params.limit;
46721
- const interval = params.interval;
46722
- const resourceId = params.resourceId;
46723
- const description = params.description;
46724
- const key = params.key;
46725
- const strategy = params.strategy;
46726
- const maxBucketSize = params.maxBucketSize;
46727
- const priority = params.priority;
46728
- const enabled = params.enabled;
46729
- const conditions = params.conditions;
46730
- if (typeof ruleId === 'undefined') {
46731
- throw new AppwriteException('Missing required parameter: "ruleId"');
46732
- }
46733
- if (typeof resourceType === 'undefined') {
46734
- throw new AppwriteException('Missing required parameter: "resourceType"');
46735
- }
46736
- if (typeof name === 'undefined') {
46737
- throw new AppwriteException('Missing required parameter: "name"');
46738
- }
46739
- if (typeof limit === 'undefined') {
46740
- throw new AppwriteException('Missing required parameter: "limit"');
46741
- }
46742
- if (typeof interval === 'undefined') {
46743
- throw new AppwriteException('Missing required parameter: "interval"');
46744
- }
46745
- const apiPath = '/waf/rules/rate-limit';
46746
- const apiPayload = {};
46747
- if (typeof ruleId !== 'undefined') {
46748
- apiPayload['ruleId'] = ruleId;
46749
- }
46750
- if (typeof resourceType !== 'undefined') {
46751
- apiPayload['resourceType'] = resourceType;
46752
- }
46753
- if (typeof resourceId !== 'undefined') {
46754
- apiPayload['resourceId'] = resourceId;
46755
- }
46756
- if (typeof name !== 'undefined') {
46757
- apiPayload['name'] = name;
46758
- }
46759
- if (typeof description !== 'undefined') {
46760
- apiPayload['description'] = description;
46761
- }
46762
- if (typeof limit !== 'undefined') {
46763
- apiPayload['limit'] = limit;
46764
- }
46765
- if (typeof interval !== 'undefined') {
46766
- apiPayload['interval'] = interval;
46767
- }
46768
- if (typeof key !== 'undefined') {
46769
- apiPayload['key'] = key;
46770
- }
46771
- if (typeof strategy !== 'undefined') {
46772
- apiPayload['strategy'] = strategy;
46773
- }
46774
- if (typeof maxBucketSize !== 'undefined') {
46775
- apiPayload['maxBucketSize'] = maxBucketSize;
46776
- }
46777
- if (typeof priority !== 'undefined') {
46778
- apiPayload['priority'] = priority;
46779
- }
46780
- if (typeof enabled !== 'undefined') {
46781
- apiPayload['enabled'] = enabled;
46782
- }
46783
- if (typeof conditions !== 'undefined') {
46784
- apiPayload['conditions'] = conditions;
46785
- }
46786
- const uri = new URL(this.client.config.endpoint + apiPath);
46787
- const apiHeaders = {
46788
- 'X-Appwrite-Project': this.client.config.project,
46789
- 'content-type': 'application/json',
46790
- accept: 'application/json',
46791
- };
46792
- return this.client.call('post', uri, apiHeaders, apiPayload);
46793
- }
46794
- updateRateLimitRule(paramsOrFirst, ...rest) {
46795
- let params;
46796
- if (paramsOrFirst &&
46797
- typeof paramsOrFirst === 'object' &&
46798
- !Array.isArray(paramsOrFirst)) {
46799
- params = (paramsOrFirst || {});
46800
- }
46801
- else {
46802
- params = {
46803
- ruleId: paramsOrFirst,
46804
- resourceType: rest[0],
46805
- resourceId: rest[1],
46806
- name: rest[2],
46807
- description: rest[3],
46808
- limit: rest[4],
46809
- interval: rest[5],
46810
- key: rest[6],
46811
- maxBucketSize: rest[7],
46812
- priority: rest[8],
46813
- enabled: rest[9],
46814
- conditions: rest[10],
46815
- };
46816
- }
46817
- const ruleId = params.ruleId;
46818
- const resourceType = params.resourceType;
46819
- const resourceId = params.resourceId;
46820
- const name = params.name;
46821
- const description = params.description;
46822
- const limit = params.limit;
46823
- const interval = params.interval;
46824
- const key = params.key;
46825
- const maxBucketSize = params.maxBucketSize;
46826
- const priority = params.priority;
46827
- const enabled = params.enabled;
46828
- const conditions = params.conditions;
46829
- if (typeof ruleId === 'undefined' || ruleId === '') {
46830
- throw new AppwriteException('Missing required parameter: "ruleId"');
46831
- }
46832
- const apiPath = '/waf/rules/rate-limit/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
45263
+ const apiPath = '/waf/rules/rate-limit/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
46833
45264
  const apiPayload = {};
46834
45265
  if (typeof resourceType !== 'undefined') {
46835
45266
  apiPayload['resourceType'] = resourceType;
@@ -47989,8 +46420,9 @@ const RECONNECT_PERIOD_MS = 2000;
47989
46420
  * );
47990
46421
  * // sub.update({ background: true }); sub.unsubscribe();
47991
46422
  */
47992
- class Push {
46423
+ class Push extends Service {
47993
46424
  constructor(client) {
46425
+ super(client);
47994
46426
  this.mqtt = null;
47995
46427
  this.connecting = null;
47996
46428
  this.Buffer = null;
@@ -48020,7 +46452,6 @@ class Push {
48020
46452
  this.connectedKey = '';
48021
46453
  this.connectionEpoch = 0;
48022
46454
  this.subscriptions = new Map();
48023
- this.client = client;
48024
46455
  }
48025
46456
  // The broker subscription for a filter uses the highest QoS any local subscription on
48026
46457
  // it wants, so a QoS-0 subscription never downgrades a QoS-1 one sharing the filter.
@@ -48760,670 +47191,6 @@ function matches(filter, topic) {
48760
47191
  return filterParts.length === topicParts.length;
48761
47192
  }
48762
47193
 
48763
- /**
48764
- * Analytics auto-tracking helpers.
48765
- *
48766
- * These are hand-written companions to the generated `Analytics` service.
48767
- * The generated service exposes `createEvent(params)` for arbitrary events;
48768
- * this module wires up common auto-tracking behaviours (pageviews, outbound
48769
- * links, downloads, scroll depth, active engagement) on top of it.
48770
- *
48771
- * The tracking helpers accept a plain event-emitter function so they do not
48772
- * hard-couple to the generated `Analytics` class. The emitter adapts this
48773
- * module's option shape to `createEvent`: `url` is required there, and `props`
48774
- * is a flat alternating key/value list rather than an object.
48775
- *
48776
- * ```ts
48777
- * const analytics = new Analytics(client);
48778
- * const tracking = new AnalyticsTracking(
48779
- * (name, options) => analytics.createEvent({
48780
- * propertyId: options?.propertyId ?? '<PROPERTY_ID>',
48781
- * name,
48782
- * url: options?.url ?? window.location.href,
48783
- * referrer: options?.referrer,
48784
- * scrollDepth: options?.scrollDepth,
48785
- * engagementTime: options?.engagementTime,
48786
- * props: Object.entries(options?.props ?? {}).flatMap(
48787
- * ([key, value]) => [key, String(value)],
48788
- * ),
48789
- * }),
48790
- * { propertyId: '<PROPERTY_ID>' }
48791
- * );
48792
- * tracking.enableAllAutoTracking();
48793
- * ```
48794
- *
48795
- * `propertyId` is optional: when set it is merged into the options of every
48796
- * emitted event, so an emitter that forwards `options.propertyId` (as above)
48797
- * picks it up instead of every caller hand-rolling it into the closure.
48798
- * Per-event `propertyId` always wins over the configured default.
48799
- *
48800
- * All helpers respect `navigator.doNotTrack === '1'` by default; opt out with
48801
- * `respectDoNotTrack: false` in the constructor options.
48802
- *
48803
- * Engagement time follows Plausible's model: rather than one total at unload,
48804
- * a delta is emitted at every natural checkpoint of the visit (tab hidden, SPA
48805
- * route change, unload). See `enableAutoEngagementTime` for details.
48806
- *
48807
- * Auto-emitted event names follow `snake_case` + lowercase (`pageview`,
48808
- * `outbound_link`, `file_download`, `screen_view`, etc.). Any prop keys use
48809
- * camelCase to match the endpoint's parameter naming. Callers can pass any
48810
- * custom event name; the auto-track methods only own the events they emit
48811
- * themselves.
48812
- */
48813
- const DEFAULT_DOWNLOAD_EXTENSIONS = [
48814
- 'pdf',
48815
- 'zip',
48816
- 'rar',
48817
- '7z',
48818
- 'tar',
48819
- 'gz',
48820
- 'csv',
48821
- 'tsv',
48822
- 'xls',
48823
- 'xlsx',
48824
- 'doc',
48825
- 'docx',
48826
- 'ppt',
48827
- 'pptx',
48828
- 'dmg',
48829
- 'exe',
48830
- 'msi',
48831
- 'pkg',
48832
- 'deb',
48833
- 'rpm',
48834
- 'apk',
48835
- 'mp3',
48836
- 'wav',
48837
- 'flac',
48838
- 'mp4',
48839
- 'mov',
48840
- 'avi',
48841
- 'mkv',
48842
- 'webm',
48843
- ];
48844
- /**
48845
- * Two-part public suffixes common enough to matter for outbound-link detection.
48846
- * See `rootDomain()` for why this is a short list rather than the Public Suffix
48847
- * List.
48848
- */
48849
- const MULTI_PART_SUFFIXES = new Set([
48850
- 'co.uk',
48851
- 'org.uk',
48852
- 'ac.uk',
48853
- 'gov.uk',
48854
- 'me.uk',
48855
- 'net.uk',
48856
- 'sch.uk',
48857
- 'co.jp',
48858
- 'ne.jp',
48859
- 'or.jp',
48860
- 'ac.jp',
48861
- 'go.jp',
48862
- 'com.au',
48863
- 'net.au',
48864
- 'org.au',
48865
- 'edu.au',
48866
- 'gov.au',
48867
- 'com.br',
48868
- 'net.br',
48869
- 'org.br',
48870
- 'com.cn',
48871
- 'net.cn',
48872
- 'org.cn',
48873
- 'gov.cn',
48874
- 'co.in',
48875
- 'net.in',
48876
- 'org.in',
48877
- 'co.nz',
48878
- 'net.nz',
48879
- 'org.nz',
48880
- 'co.za',
48881
- 'org.za',
48882
- 'com.mx',
48883
- 'com.ar',
48884
- 'com.co',
48885
- 'com.pe',
48886
- 'com.tr',
48887
- 'com.tw',
48888
- 'com.sg',
48889
- 'com.hk',
48890
- 'com.my',
48891
- 'com.ph',
48892
- 'com.vn',
48893
- 'co.kr',
48894
- 'co.il',
48895
- 'co.id',
48896
- 'co.th',
48897
- 'com.ua',
48898
- 'com.pl',
48899
- 'com.es',
48900
- ]);
48901
- const SCROLL_DEPTH_THROTTLE_MS = 200;
48902
- class AnalyticsTracking {
48903
- constructor(emit, options = {}) {
48904
- this.pageviewCleanups = [];
48905
- this.scrollCleanups = [];
48906
- this.engagementCleanups = [];
48907
- this.maxScrollDepth = 0;
48908
- this.scrollTicking = false;
48909
- this.lastScrollReport = 0;
48910
- this.engagementStart = 0;
48911
- this.engagementAccumulatedMs = 0;
48912
- this.engagementActive = false;
48913
- this.emit = emit;
48914
- this.respectDoNotTrack = options.respectDoNotTrack !== false;
48915
- this.propertyId = options.propertyId;
48916
- }
48917
- /**
48918
- * Enable the opinionated default auto-tracking set: pageviews, outbound
48919
- * links, scroll depth and active engagement time. Downloads must be opted
48920
- * into separately via `enableAutoDownloadTracking()` because the extension
48921
- * list is application-specific.
48922
- */
48923
- enableAllAutoTracking() {
48924
- this.enableAutoPageviews();
48925
- this.enableAutoOutboundTracking();
48926
- this.enableAutoScrollDepth();
48927
- this.enableAutoEngagementTime();
48928
- }
48929
- /**
48930
- * Track an event manually. Respects the DNT setting and swallows emitter
48931
- * exceptions so tracking failures never surface to the host page.
48932
- */
48933
- track(name, options) {
48934
- if (!this.canTrack()) {
48935
- return;
48936
- }
48937
- try {
48938
- this.emit(name, this.withPropertyId(options));
48939
- }
48940
- catch (error) {
48941
- console.warn('AnalyticsTracking: emitter threw', error);
48942
- }
48943
- }
48944
- /**
48945
- * Convenience wrapper for pageview-shaped events.
48946
- */
48947
- pageview(url, referrer) {
48948
- this.track('pageview', {
48949
- url: url !== null && url !== void 0 ? url : this.currentPageUrl(),
48950
- referrer: referrer !== null && referrer !== void 0 ? referrer : (typeof document !== 'undefined'
48951
- ? document.referrer
48952
- : undefined),
48953
- });
48954
- }
48955
- /**
48956
- * Enable SPA-aware pageview tracking. Fires an initial pageview on
48957
- * enable, then again on every `pushState`, `replaceState`, `popstate`
48958
- * or hashchange. Idempotent — repeat calls no-op.
48959
- */
48960
- enableAutoPageviews() {
48961
- if (this.pageviewCleanups.length > 0) {
48962
- return;
48963
- }
48964
- if (typeof window === 'undefined' || typeof history === 'undefined') {
48965
- return;
48966
- }
48967
- this.currentPath = this.currentPageUrl();
48968
- this.pageview();
48969
- const handleNavigation = () => {
48970
- const nextPath = this.currentPageUrl();
48971
- if (nextPath === this.currentPath) {
48972
- return;
48973
- }
48974
- const previous = this.currentPath;
48975
- this.currentPath = nextPath;
48976
- this.flushScrollDepth(previous);
48977
- this.flushEngagement(previous);
48978
- this.pageview(nextPath);
48979
- // flushEngagement no longer auto-restarts the timer (see its
48980
- // implementation note re: bfcache). SPA navigation stays on the
48981
- // same document, so restart engagement tracking for the new
48982
- // route as long as the tab is visible.
48983
- if (this.engagementCleanups.length > 0 &&
48984
- (typeof document === 'undefined' ||
48985
- document.visibilityState !== 'hidden')) {
48986
- this.startEngagement();
48987
- }
48988
- };
48989
- const originalPushState = history.pushState.bind(history);
48990
- const originalReplaceState = history.replaceState.bind(history);
48991
- // Our wrappers stay reachable after cleanup whenever another library
48992
- // patched on top of ours, so they have to be switchable off rather than
48993
- // merely unreferenced.
48994
- let patchActive = true;
48995
- const patchedPushState = (data, unused, url) => {
48996
- originalPushState(data, unused, url);
48997
- if (patchActive) {
48998
- handleNavigation();
48999
- }
49000
- };
49001
- const patchedReplaceState = (data, unused, url) => {
49002
- originalReplaceState(data, unused, url);
49003
- if (patchActive) {
49004
- handleNavigation();
49005
- }
49006
- };
49007
- history.pushState = patchedPushState;
49008
- history.replaceState = patchedReplaceState;
49009
- const popstateHandler = () => handleNavigation();
49010
- const hashchangeHandler = () => handleNavigation();
49011
- window.addEventListener('popstate', popstateHandler);
49012
- window.addEventListener('hashchange', hashchangeHandler);
49013
- this.pageviewCleanups.push(() => {
49014
- // Only unwind our own patch. A router (Next.js App Router, React
49015
- // Router, …) that patched these after us owns the current value,
49016
- // and assigning our saved reference back would silently throw its
49017
- // wrapper away. In that case ours stays in the chain, which is why
49018
- // `patchActive` exists: the wrapper keeps delegating to the original
49019
- // but stops reporting.
49020
- patchActive = false;
49021
- if (history.pushState === patchedPushState) {
49022
- history.pushState = originalPushState;
49023
- }
49024
- if (history.replaceState === patchedReplaceState) {
49025
- history.replaceState = originalReplaceState;
49026
- }
49027
- window.removeEventListener('popstate', popstateHandler);
49028
- window.removeEventListener('hashchange', hashchangeHandler);
49029
- });
49030
- }
49031
- /**
49032
- * Disable auto-pageview tracking installed by `enableAutoPageviews`.
49033
- * Safe to call when auto-pageviews were never enabled.
49034
- */
49035
- disableAutoPageviews() {
49036
- for (const cleanup of this.pageviewCleanups) {
49037
- cleanup();
49038
- }
49039
- this.pageviewCleanups = [];
49040
- }
49041
- /**
49042
- * Enable click-based outbound link tracking. Detects anchor clicks that
49043
- * navigate to a different origin and fires an `outbound_link` event
49044
- * (with `hostname` and `href` props) before the browser navigates.
49045
- */
49046
- enableAutoOutboundTracking(options = {}) {
49047
- if (this.outboundCleanup) {
49048
- return;
49049
- }
49050
- if (typeof document === 'undefined') {
49051
- return;
49052
- }
49053
- const includeSubdomains = options.includeSubdomains === true;
49054
- const clickHandler = (event) => {
49055
- const anchor = this.findAnchor(event.target);
49056
- if (!anchor || !anchor.href) {
49057
- return;
49058
- }
49059
- const target = this.parseUrl(anchor.href);
49060
- if (!target || !this.isExternal(target, includeSubdomains)) {
49061
- return;
49062
- }
49063
- this.track('outbound_link', {
49064
- url: target.href,
49065
- props: { hostname: target.hostname, href: target.href },
49066
- });
49067
- };
49068
- document.addEventListener('click', clickHandler, { capture: true });
49069
- this.outboundCleanup = () => document.removeEventListener('click', clickHandler, {
49070
- capture: true,
49071
- });
49072
- }
49073
- /**
49074
- * Disable outbound-link tracking installed by `enableAutoOutboundTracking`.
49075
- * Safe to call when auto-outbound was never enabled.
49076
- */
49077
- disableAutoOutboundTracking() {
49078
- if (this.outboundCleanup) {
49079
- this.outboundCleanup();
49080
- this.outboundCleanup = undefined;
49081
- }
49082
- }
49083
- /**
49084
- * Enable click-based download tracking. Detects anchor clicks that point
49085
- * at a file whose extension appears in the configured list and fires a
49086
- * `file_download` event with `filename`, `extension` and `href` props.
49087
- */
49088
- enableAutoDownloadTracking(options = {}) {
49089
- var _a;
49090
- if (this.downloadCleanup) {
49091
- return;
49092
- }
49093
- if (typeof document === 'undefined') {
49094
- return;
49095
- }
49096
- const extensions = ((_a = options.extensions) !== null && _a !== void 0 ? _a : DEFAULT_DOWNLOAD_EXTENSIONS).map((ext) => ext.toLowerCase().replace(/^\./, ''));
49097
- const extensionSet = new Set(extensions);
49098
- const clickHandler = (event) => {
49099
- var _a, _b;
49100
- const anchor = this.findAnchor(event.target);
49101
- if (!anchor || !anchor.href) {
49102
- return;
49103
- }
49104
- const url = this.parseUrl(anchor.href);
49105
- if (!url) {
49106
- return;
49107
- }
49108
- const filename = (_a = url.pathname.split('/').pop()) !== null && _a !== void 0 ? _a : '';
49109
- const extension = filename.includes('.')
49110
- ? (_b = filename.split('.').pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase()
49111
- : undefined;
49112
- if (!extension || !extensionSet.has(extension)) {
49113
- return;
49114
- }
49115
- this.track('file_download', {
49116
- url: url.href,
49117
- props: { filename, extension, href: url.href },
49118
- });
49119
- };
49120
- document.addEventListener('click', clickHandler, { capture: true });
49121
- this.downloadCleanup = () => document.removeEventListener('click', clickHandler, {
49122
- capture: true,
49123
- });
49124
- }
49125
- /**
49126
- * Disable file-download tracking installed by `enableAutoDownloadTracking`.
49127
- * Safe to call when auto-download was never enabled.
49128
- */
49129
- disableAutoDownloadTracking() {
49130
- if (this.downloadCleanup) {
49131
- this.downloadCleanup();
49132
- this.downloadCleanup = undefined;
49133
- }
49134
- }
49135
- /**
49136
- * Enable passive scroll-depth tracking. Records the maximum percent of the
49137
- * document scrolled and reports it on `beforeunload` and on SPA route
49138
- * changes. Uses a throttled passive listener so it is safe on hot paths.
49139
- */
49140
- enableAutoScrollDepth() {
49141
- if (this.scrollCleanups.length > 0) {
49142
- return;
49143
- }
49144
- if (typeof window === 'undefined' || typeof document === 'undefined') {
49145
- return;
49146
- }
49147
- this.maxScrollDepth = 0;
49148
- this.lastScrollReport = 0;
49149
- const scrollHandler = () => {
49150
- if (this.scrollTicking) {
49151
- return;
49152
- }
49153
- this.scrollTicking = true;
49154
- window.requestAnimationFrame(() => {
49155
- const now = Date.now();
49156
- if (now - this.lastScrollReport < SCROLL_DEPTH_THROTTLE_MS) {
49157
- this.scrollTicking = false;
49158
- return;
49159
- }
49160
- this.lastScrollReport = now;
49161
- const depth = this.computeScrollDepth();
49162
- if (depth > this.maxScrollDepth) {
49163
- this.maxScrollDepth = depth;
49164
- }
49165
- this.scrollTicking = false;
49166
- });
49167
- };
49168
- const unloadHandler = () => {
49169
- this.flushScrollDepth(this.currentPageUrl());
49170
- };
49171
- window.addEventListener('scroll', scrollHandler, { passive: true });
49172
- window.addEventListener('beforeunload', unloadHandler);
49173
- window.addEventListener('pagehide', unloadHandler);
49174
- this.scrollCleanups.push(() => {
49175
- window.removeEventListener('scroll', scrollHandler);
49176
- window.removeEventListener('beforeunload', unloadHandler);
49177
- window.removeEventListener('pagehide', unloadHandler);
49178
- });
49179
- }
49180
- /**
49181
- * Disable scroll-depth tracking installed by `enableAutoScrollDepth`. Safe
49182
- * to call when auto-scroll-depth was never enabled. Any accumulated depth
49183
- * for the current page is dropped.
49184
- */
49185
- disableAutoScrollDepth() {
49186
- for (const cleanup of this.scrollCleanups) {
49187
- cleanup();
49188
- }
49189
- this.scrollCleanups = [];
49190
- this.maxScrollDepth = 0;
49191
- this.scrollTicking = false;
49192
- this.lastScrollReport = 0;
49193
- }
49194
- /**
49195
- * Enable active engagement-time tracking. Counts time the tab is visible
49196
- * and uses `visibilitychange` to exclude background time.
49197
- *
49198
- * Delivery follows Plausible's model rather than a single total at the
49199
- * end of the visit: an `engagement_time` event is emitted at every natural
49200
- * checkpoint — the tab going hidden, an SPA route change, and finally
49201
- * `beforeunload`/`pagehide`. Unload is kept only as a best-effort last
49202
- * flush; it is the least reliable moment to send anything (browsers
49203
- * routinely cancel in-flight requests there, and `sendBeacon` cannot set
49204
- * the `X-Appwrite-Project` header the endpoint requires), so it must never
49205
- * be the only delivery.
49206
- *
49207
- * Each event carries a **delta** — the seconds accrued since the previous
49208
- * flush, not a running total — so the values are additive per session and
49209
- * a lost event costs only its own slice.
49210
- *
49211
- * There is deliberately no periodic ping. The cadence is driven by
49212
- * navigation and tab switches, so request volume tracks what the visitor
49213
- * actually does instead of multiplying with time on page.
49214
- */
49215
- enableAutoEngagementTime() {
49216
- if (this.engagementCleanups.length > 0) {
49217
- return;
49218
- }
49219
- if (typeof window === 'undefined' || typeof document === 'undefined') {
49220
- return;
49221
- }
49222
- this.engagementAccumulatedMs = 0;
49223
- // Do not start the clock for a tab that is already hidden (prerender,
49224
- // background tab restore); `visibilitychange` starts it when it is
49225
- // actually looked at.
49226
- if (document.visibilityState !== 'hidden') {
49227
- this.startEngagement();
49228
- }
49229
- const visibilityHandler = () => {
49230
- if (document.visibilityState === 'hidden') {
49231
- // Flush, don't just pause. The page is still fully alive here,
49232
- // which makes this the most reliable delivery point in the
49233
- // whole visit — and it is the same moment Plausible reports on.
49234
- this.flushEngagement(this.currentPageUrl());
49235
- }
49236
- else if (document.visibilityState === 'visible') {
49237
- this.startEngagement();
49238
- }
49239
- };
49240
- const unloadHandler = () => {
49241
- this.flushEngagement(this.currentPageUrl());
49242
- };
49243
- const pageshowHandler = (event) => {
49244
- // When the page is restored from the back-forward cache the
49245
- // engagement timer is in a stopped state (flushEngagement paused
49246
- // it on pagehide and does not auto-restart). Kick off a fresh
49247
- // engagementStart so bfcache dwell time is not billed as
49248
- // engagement.
49249
- if (event.persisted) {
49250
- this.startEngagement();
49251
- }
49252
- };
49253
- document.addEventListener('visibilitychange', visibilityHandler);
49254
- window.addEventListener('beforeunload', unloadHandler);
49255
- window.addEventListener('pagehide', unloadHandler);
49256
- window.addEventListener('pageshow', pageshowHandler);
49257
- this.engagementCleanups.push(() => {
49258
- document.removeEventListener('visibilitychange', visibilityHandler);
49259
- window.removeEventListener('beforeunload', unloadHandler);
49260
- window.removeEventListener('pagehide', unloadHandler);
49261
- window.removeEventListener('pageshow', pageshowHandler);
49262
- });
49263
- }
49264
- /**
49265
- * Disable engagement-time tracking installed by `enableAutoEngagementTime`.
49266
- * Safe to call when auto-engagement was never enabled. Any accumulated
49267
- * engagement time is dropped without being emitted.
49268
- */
49269
- disableAutoEngagementTime() {
49270
- for (const cleanup of this.engagementCleanups) {
49271
- cleanup();
49272
- }
49273
- this.engagementCleanups = [];
49274
- this.engagementActive = false;
49275
- this.engagementAccumulatedMs = 0;
49276
- this.engagementStart = 0;
49277
- }
49278
- /**
49279
- * Merge the configured `propertyId` into an event's options. Returns the
49280
- * caller's object untouched when no default is configured (or the event
49281
- * already carries one), so emitters written against the pre-`propertyId`
49282
- * shape keep receiving exactly what they received before.
49283
- */
49284
- withPropertyId(options) {
49285
- if (this.propertyId === undefined ||
49286
- (options === null || options === void 0 ? void 0 : options.propertyId) !== undefined) {
49287
- return options;
49288
- }
49289
- return Object.assign(Object.assign({}, (options !== null && options !== void 0 ? options : {})), { propertyId: this.propertyId });
49290
- }
49291
- canTrack() {
49292
- if (!this.respectDoNotTrack) {
49293
- return true;
49294
- }
49295
- if (typeof navigator === 'undefined') {
49296
- return true;
49297
- }
49298
- return navigator.doNotTrack !== '1';
49299
- }
49300
- currentPageUrl() {
49301
- if (typeof window === 'undefined' || !window.location) {
49302
- return '';
49303
- }
49304
- return window.location.href;
49305
- }
49306
- findAnchor(target) {
49307
- let node = target;
49308
- while (node) {
49309
- if (node.tagName === 'A') {
49310
- return node;
49311
- }
49312
- node = node.parentNode;
49313
- }
49314
- return null;
49315
- }
49316
- parseUrl(href) {
49317
- try {
49318
- return new URL(href, window.location.href);
49319
- }
49320
- catch (_a) {
49321
- return null;
49322
- }
49323
- }
49324
- isExternal(target, includeSubdomains) {
49325
- if (target.protocol !== 'http:' && target.protocol !== 'https:') {
49326
- return false;
49327
- }
49328
- if (target.hostname === window.location.hostname) {
49329
- return false;
49330
- }
49331
- if (includeSubdomains) {
49332
- return true;
49333
- }
49334
- const root = this.rootDomain(window.location.hostname);
49335
- return this.rootDomain(target.hostname) !== root;
49336
- }
49337
- rootDomain(hostname) {
49338
- const parts = hostname.split('.');
49339
- if (parts.length <= 2) {
49340
- return hostname;
49341
- }
49342
- // Taking the last two labels is wrong wherever the registry sells names
49343
- // one level down: `shop.example.co.uk` and `google.co.uk` both reduce to
49344
- // `co.uk`, so every outbound click between two `.co.uk` sites looks
49345
- // internal and is dropped. Take three labels after a known two-part
49346
- // suffix instead.
49347
- //
49348
- // This is a heuristic, not the Public Suffix List — the full list is
49349
- // orders of magnitude larger than this whole file, and a tracking
49350
- // snippet cannot carry it. Sites on a suffix that is missing here can
49351
- // pass `includeSubdomains: true` to treat every other host as outbound.
49352
- const suffix = parts.slice(-2).join('.');
49353
- if (parts.length > 2 && MULTI_PART_SUFFIXES.has(suffix)) {
49354
- return parts.slice(-3).join('.');
49355
- }
49356
- return suffix;
49357
- }
49358
- computeScrollDepth() {
49359
- const scrollTop = window.scrollY || document.documentElement.scrollTop;
49360
- const viewport = window.innerHeight || document.documentElement.clientHeight;
49361
- const total = document.documentElement.scrollHeight;
49362
- if (total <= viewport) {
49363
- return 100;
49364
- }
49365
- const depth = Math.round(((scrollTop + viewport) / total) * 100);
49366
- return Math.max(0, Math.min(100, depth));
49367
- }
49368
- flushScrollDepth(url) {
49369
- if (this.scrollCleanups.length === 0) {
49370
- return;
49371
- }
49372
- if (this.maxScrollDepth <= 0) {
49373
- return;
49374
- }
49375
- this.track('scroll_depth', {
49376
- url,
49377
- scrollDepth: this.maxScrollDepth,
49378
- });
49379
- this.maxScrollDepth = 0;
49380
- }
49381
- startEngagement() {
49382
- if (this.engagementActive) {
49383
- return;
49384
- }
49385
- this.engagementActive = true;
49386
- this.engagementStart = Date.now();
49387
- }
49388
- pauseEngagement() {
49389
- if (!this.engagementActive) {
49390
- return;
49391
- }
49392
- this.engagementActive = false;
49393
- this.engagementAccumulatedMs += Date.now() - this.engagementStart;
49394
- }
49395
- flushEngagement(url) {
49396
- if (this.engagementCleanups.length === 0) {
49397
- return;
49398
- }
49399
- this.pauseEngagement();
49400
- // Deltas, not a running total: emit only what accrued since the last
49401
- // flush. `floor` plus keeping the sub-second remainder in the
49402
- // accumulator is what makes repeated flushes safe — nothing is emitted
49403
- // twice, and a visit chopped into many short segments does not lose a
49404
- // fraction of a second to rounding on every one of them.
49405
- const seconds = Math.floor(this.engagementAccumulatedMs / 1000);
49406
- if (seconds > 0) {
49407
- // Deduct before emitting so a synchronous emitter that re-enters
49408
- // (or throws) can never bill the same seconds again.
49409
- this.engagementAccumulatedMs -= seconds * 1000;
49410
- this.track('engagement_time', {
49411
- url,
49412
- engagementTime: seconds,
49413
- });
49414
- }
49415
- // NOTE: intentionally do NOT call startEngagement() here. flushEngagement
49416
- // runs on `pagehide`, which is also the last hook before the browser
49417
- // may freeze the page into the back-forward cache. Auto-restarting
49418
- // would snapshot engagementStart just before the freeze; the next
49419
- // pauseEngagement (after bfcache restore) would then bill the entire
49420
- // bfcache dwell as active engagement. Restart is driven by explicit
49421
- // resume signals: `pageshow` (with `persisted === true`),
49422
- // `visibilitychange` back to visible, or the SPA navigation flow in
49423
- // `enableAutoPageviews`.
49424
- }
49425
- }
49426
-
49427
47194
  /**
49428
47195
  * Helper class to generate permission strings for resources.
49429
47196
  */
@@ -50130,68 +47897,6 @@ exports.OAuthProvider = void 0;
50130
47897
  OAuthProvider["Zoom"] = "zoom";
50131
47898
  })(exports.OAuthProvider || (exports.OAuthProvider = {}));
50132
47899
 
50133
- exports.PlatformResourceType = void 0;
50134
- (function (PlatformResourceType) {
50135
- PlatformResourceType["Projects"] = "projects";
50136
- PlatformResourceType["Organizations"] = "organizations";
50137
- PlatformResourceType["Users"] = "users";
50138
- PlatformResourceType["Memberships"] = "memberships";
50139
- PlatformResourceType["Rules"] = "rules";
50140
- PlatformResourceType["Keys"] = "keys";
50141
- PlatformResourceType["Platforms"] = "platforms";
50142
- PlatformResourceType["Webhooks"] = "webhooks";
50143
- PlatformResourceType["Certificates"] = "certificates";
50144
- })(exports.PlatformResourceType || (exports.PlatformResourceType = {}));
50145
-
50146
- exports.ProjectResourceType = void 0;
50147
- (function (ProjectResourceType) {
50148
- ProjectResourceType["Users"] = "users";
50149
- ProjectResourceType["Teams"] = "teams";
50150
- ProjectResourceType["Memberships"] = "memberships";
50151
- ProjectResourceType["Databases"] = "databases";
50152
- ProjectResourceType["Buckets"] = "buckets";
50153
- ProjectResourceType["Functions"] = "functions";
50154
- ProjectResourceType["Sites"] = "sites";
50155
- ProjectResourceType["Deployments"] = "deployments";
50156
- ProjectResourceType["Topics"] = "topics";
50157
- ProjectResourceType["Providers"] = "providers";
50158
- ProjectResourceType["Messages"] = "messages";
50159
- })(exports.ProjectResourceType || (exports.ProjectResourceType = {}));
50160
-
50161
- exports.AnalyticsInterval = void 0;
50162
- (function (AnalyticsInterval) {
50163
- AnalyticsInterval["OneHour"] = "1h";
50164
- AnalyticsInterval["OneDay"] = "1d";
50165
- AnalyticsInterval["OneWeek"] = "1w";
50166
- AnalyticsInterval["OneMonth"] = "1m";
50167
- })(exports.AnalyticsInterval || (exports.AnalyticsInterval = {}));
50168
-
50169
- exports.AnalyticsDimension = void 0;
50170
- (function (AnalyticsDimension) {
50171
- AnalyticsDimension["Country"] = "country";
50172
- AnalyticsDimension["Region"] = "region";
50173
- AnalyticsDimension["City"] = "city";
50174
- AnalyticsDimension["Browser"] = "browser";
50175
- AnalyticsDimension["OperatingSystem"] = "operatingSystem";
50176
- AnalyticsDimension["Device"] = "device";
50177
- AnalyticsDimension["ScreenSize"] = "screenSize";
50178
- AnalyticsDimension["ReferrerSource"] = "referrerSource";
50179
- AnalyticsDimension["Channel"] = "channel";
50180
- AnalyticsDimension["UtmSource"] = "utmSource";
50181
- AnalyticsDimension["UtmMedium"] = "utmMedium";
50182
- AnalyticsDimension["UtmCampaign"] = "utmCampaign";
50183
- AnalyticsDimension["UtmContent"] = "utmContent";
50184
- AnalyticsDimension["UtmTerm"] = "utmTerm";
50185
- AnalyticsDimension["Page"] = "page";
50186
- AnalyticsDimension["Hostname"] = "hostname";
50187
- AnalyticsDimension["EntryPage"] = "entryPage";
50188
- AnalyticsDimension["ExitPage"] = "exitPage";
50189
- AnalyticsDimension["TrafficType"] = "trafficType";
50190
- AnalyticsDimension["BotName"] = "botName";
50191
- AnalyticsDimension["BotCategory"] = "botCategory";
50192
- AnalyticsDimension["EventName"] = "eventName";
50193
- })(exports.AnalyticsDimension || (exports.AnalyticsDimension = {}));
50194
-
50195
47900
  exports.Browser = void 0;
50196
47901
  (function (Browser) {
50197
47902
  Browser["AvantBrowser"] = "aa";
@@ -51007,14 +48712,6 @@ exports.QuerySuggestionResource = void 0;
51007
48712
  QuerySuggestionResource["ResourceTokens"] = "resourcetokens";
51008
48713
  QuerySuggestionResource["Transactions"] = "transactions";
51009
48714
  QuerySuggestionResource["TransactionLogs"] = "transactionlogs";
51010
- QuerySuggestionResource["Videos"] = "videos";
51011
- QuerySuggestionResource["VideosPreviews"] = "videos_previews";
51012
- QuerySuggestionResource["VideosRenditions"] = "videos_renditions";
51013
- QuerySuggestionResource["VideosRenditionsSegments"] = "videos_renditions_segments";
51014
- QuerySuggestionResource["VideosProfiles"] = "videos_profiles";
51015
- QuerySuggestionResource["VideosSubtitles"] = "videos_subtitles";
51016
- QuerySuggestionResource["VideosSubtitlesSegments"] = "videos_subtitles_segments";
51017
- QuerySuggestionResource["AnalyticsProperties"] = "analyticsproperties";
51018
48715
  QuerySuggestionResource["DedicatedDatabases"] = "dedicateddatabases";
51019
48716
  QuerySuggestionResource["DedicatedDatabaseConfigs"] = "dedicateddatabaseconfigs";
51020
48717
  QuerySuggestionResource["DedicatedDatabaseRuntimes"] = "dedicateddatabaseruntimes";
@@ -51437,8 +49134,6 @@ exports.ProjectKeyScopes = void 0;
51437
49134
  ProjectKeyScopes["ReportsWrite"] = "reports.write";
51438
49135
  ProjectKeyScopes["PresencesRead"] = "presences.read";
51439
49136
  ProjectKeyScopes["PresencesWrite"] = "presences.write";
51440
- ProjectKeyScopes["VideosRead"] = "videos.read";
51441
- ProjectKeyScopes["VideosWrite"] = "videos.write";
51442
49137
  ProjectKeyScopes["DedicatedDatabasesExecute"] = "dedicatedDatabases.execute";
51443
49138
  ProjectKeyScopes["BackupsPoliciesRead"] = "backups.policies.read";
51444
49139
  ProjectKeyScopes["BackupsPoliciesWrite"] = "backups.policies.write";
@@ -51457,8 +49152,6 @@ exports.ProjectKeyScopes = void 0;
51457
49152
  ProjectKeyScopes["Oauth2Read"] = "oauth2.read";
51458
49153
  ProjectKeyScopes["Oauth2Write"] = "oauth2.write";
51459
49154
  ProjectKeyScopes["Oauth2Introspect"] = "oauth2.introspect";
51460
- ProjectKeyScopes["AnalyticsRead"] = "analytics.read";
51461
- ProjectKeyScopes["AnalyticsWrite"] = "analytics.write";
51462
49155
  })(exports.ProjectKeyScopes || (exports.ProjectKeyScopes = {}));
51463
49156
 
51464
49157
  exports.FunctionTemplateUseCase = void 0;
@@ -51708,7 +49401,6 @@ exports.ProjectAuthMethodId = void 0;
51708
49401
  ProjectAuthMethodId["Invites"] = "invites";
51709
49402
  ProjectAuthMethodId["Jwt"] = "jwt";
51710
49403
  ProjectAuthMethodId["Phone"] = "phone";
51711
- ProjectAuthMethodId["Passkey"] = "passkey";
51712
49404
  })(exports.ProjectAuthMethodId || (exports.ProjectAuthMethodId = {}));
51713
49405
 
51714
49406
  exports.ProjectOAuth2Auth0Prompt = void 0;
@@ -51850,7 +49542,6 @@ exports.ProjectPolicyId = void 0;
51850
49542
  ProjectPolicyId["Denydisposableemail"] = "deny-disposable-email";
51851
49543
  ProjectPolicyId["Denyfreeemail"] = "deny-free-email";
51852
49544
  ProjectPolicyId["Denycorporateemail"] = "deny-corporate-email";
51853
- ProjectPolicyId["Passkey"] = "passkey";
51854
49545
  })(exports.ProjectPolicyId || (exports.ProjectPolicyId = {}));
51855
49546
 
51856
49547
  exports.ProjectProtocolId = void 0;
@@ -52095,9 +49786,6 @@ exports.TablesDBIndexType = void 0;
52095
49786
 
52096
49787
  exports.UsageEventMetric = void 0;
52097
49788
  (function (UsageEventMetric) {
52098
- UsageEventMetric["AnalyticsEvents"] = "analytics.events";
52099
- UsageEventMetric["AnalyticsPageviews"] = "analytics.pageviews";
52100
- UsageEventMetric["AnalyticsBotsEvents"] = "analytics.bots.events";
52101
49789
  UsageEventMetric["NetworkRequests"] = "network.requests";
52102
49790
  UsageEventMetric["NetworkInbound"] = "network.inbound";
52103
49791
  UsageEventMetric["NetworkOutbound"] = "network.outbound";
@@ -52215,7 +49903,6 @@ exports.UsageOrderDirection = void 0;
52215
49903
 
52216
49904
  exports.UsageGaugeMetric = void 0;
52217
49905
  (function (UsageGaugeMetric) {
52218
- UsageGaugeMetric["AnalyticsProperties"] = "analytics.properties";
52219
49906
  UsageGaugeMetric["Teams"] = "teams";
52220
49907
  UsageGaugeMetric["Users"] = "users";
52221
49908
  UsageGaugeMetric["Messages"] = "messages";
@@ -52313,24 +50000,6 @@ exports.VectorsDBIndexType = void 0;
52313
50000
  VectorsDBIndexType["Unique"] = "unique";
52314
50001
  })(exports.VectorsDBIndexType || (exports.VectorsDBIndexType = {}));
52315
50002
 
52316
- exports.VideoOutput = void 0;
52317
- (function (VideoOutput) {
52318
- VideoOutput["Hls"] = "hls";
52319
- VideoOutput["Dash"] = "dash";
52320
- VideoOutput["Cmaf"] = "cmaf";
52321
- })(exports.VideoOutput || (exports.VideoOutput = {}));
52322
-
52323
- exports.VideoRenditionStatus = void 0;
52324
- (function (VideoRenditionStatus) {
52325
- VideoRenditionStatus["Pending"] = "pending";
52326
- VideoRenditionStatus["Started"] = "started";
52327
- VideoRenditionStatus["Ended"] = "ended";
52328
- VideoRenditionStatus["Uploading"] = "uploading";
52329
- VideoRenditionStatus["Ready"] = "ready";
52330
- VideoRenditionStatus["Error"] = "error";
52331
- VideoRenditionStatus["Aborted"] = "aborted";
52332
- })(exports.VideoRenditionStatus || (exports.VideoRenditionStatus = {}));
52333
-
52334
50003
  exports.DatabaseType = void 0;
52335
50004
  (function (DatabaseType) {
52336
50005
  DatabaseType["Legacy"] = "legacy";
@@ -52509,7 +50178,6 @@ exports.ProxyRuleDeploymentResourceType = void 0;
52509
50178
  (function (ProxyRuleDeploymentResourceType) {
52510
50179
  ProxyRuleDeploymentResourceType["Function"] = "function";
52511
50180
  ProxyRuleDeploymentResourceType["Site"] = "site";
52512
- ProxyRuleDeploymentResourceType["DedicatedDatabase"] = "dedicatedDatabase";
52513
50181
  })(exports.ProxyRuleDeploymentResourceType || (exports.ProxyRuleDeploymentResourceType = {}));
52514
50182
 
52515
50183
  exports.ProxyRuleStatus = void 0;
@@ -52567,11 +50235,8 @@ exports.WafRuleAction = void 0;
52567
50235
 
52568
50236
  exports.Account = Account;
52569
50237
  exports.Activities = Activities;
52570
- exports.Admin = Admin;
52571
50238
  exports.Advisor = Advisor;
52572
50239
  exports.Affiliates = Affiliates;
52573
- exports.Analytics = Analytics;
52574
- exports.AnalyticsTracking = AnalyticsTracking;
52575
50240
  exports.Apps = Apps;
52576
50241
  exports.AppwriteException = AppwriteException;
52577
50242
  exports.Assistant = Assistant;
@@ -52620,7 +50285,6 @@ exports.Usage = Usage;
52620
50285
  exports.Users = Users;
52621
50286
  exports.Vcs = Vcs;
52622
50287
  exports.VectorsDB = VectorsDB;
52623
- exports.Videos = Videos;
52624
50288
  exports.Waf = Waf;
52625
50289
  exports.Webhooks = Webhooks;
52626
50290
  //# sourceMappingURL=sdk.js.map