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

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