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