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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/iife/sdk.js CHANGED
@@ -4467,7 +4467,7 @@
4467
4467
  'x-sdk-name': 'Console',
4468
4468
  'x-sdk-platform': 'console',
4469
4469
  'x-sdk-language': 'web',
4470
- 'x-sdk-version': '18.4.0-rc.1',
4470
+ 'x-sdk-version': '18.4.0',
4471
4471
  'X-Appwrite-Response-Format': '2.3.0',
4472
4472
  };
4473
4473
  this.realtime = {
@@ -5320,6 +5320,29 @@
5320
5320
  }
5321
5321
  Client.CHUNK_SIZE = 1024 * 1024 * 5;
5322
5322
 
5323
+ class Service {
5324
+ constructor(client) {
5325
+ this.client = client;
5326
+ }
5327
+ static flatten(data, prefix = '') {
5328
+ let output = {};
5329
+ for (const [key, value] of Object.entries(data)) {
5330
+ const finalKey = prefix ? prefix + '[' + key + ']' : key;
5331
+ if (Array.isArray(value)) {
5332
+ output = Object.assign(Object.assign({}, output), Service.flatten(value, finalKey));
5333
+ }
5334
+ else {
5335
+ output[finalKey] = value;
5336
+ }
5337
+ }
5338
+ return output;
5339
+ }
5340
+ }
5341
+ /**
5342
+ * The size for chunked uploads in bytes.
5343
+ */
5344
+ Service.CHUNK_SIZE = 5 * 1024 * 1024; // 5MB
5345
+
5323
5346
  class Account {
5324
5347
  constructor(client) {
5325
5348
  this.client = client;
@@ -6796,27 +6819,19 @@
6796
6819
  else {
6797
6820
  params = {
6798
6821
  passkeyId: paramsOrFirst,
6799
- challengeId: rest[0],
6800
- credential: rest[1],
6822
+ credential: rest[0],
6801
6823
  };
6802
6824
  }
6803
6825
  const passkeyId = params.passkeyId;
6804
- const challengeId = params.challengeId;
6805
6826
  const credential = params.credential;
6806
6827
  if (typeof passkeyId === 'undefined' || passkeyId === '') {
6807
6828
  throw new AppwriteException('Missing required parameter: "passkeyId"');
6808
6829
  }
6809
- if (typeof challengeId === 'undefined') {
6810
- throw new AppwriteException('Missing required parameter: "challengeId"');
6811
- }
6812
6830
  if (typeof credential === 'undefined') {
6813
6831
  throw new AppwriteException('Missing required parameter: "credential"');
6814
6832
  }
6815
6833
  const apiPath = '/account/passkeys/{passkeyId}/verification'.replace('{passkeyId}', encodeURIComponent(String(passkeyId)));
6816
6834
  const apiPayload = {};
6817
- if (typeof challengeId !== 'undefined') {
6818
- apiPayload['challengeId'] = challengeId;
6819
- }
6820
6835
  if (typeof credential !== 'undefined') {
6821
6836
  apiPayload['credential'] = credential;
6822
6837
  }
@@ -7571,7 +7586,7 @@
7571
7586
  }
7572
7587
  const uri = new URL(this.client.config.endpoint + apiPath);
7573
7588
  apiPayload['project'] = this.client.config.project;
7574
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
7589
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
7575
7590
  uri.searchParams.append(key, value);
7576
7591
  }
7577
7592
  if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
@@ -7980,7 +7995,7 @@
7980
7995
  }
7981
7996
  const uri = new URL(this.client.config.endpoint + apiPath);
7982
7997
  apiPayload['project'] = this.client.config.project;
7983
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
7998
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
7984
7999
  uri.searchParams.append(key, value);
7985
8000
  }
7986
8001
  if (typeof window !== 'undefined' && (window === null || window === void 0 ? void 0 : window.location)) {
@@ -8391,135 +8406,6 @@
8391
8406
  }
8392
8407
  }
8393
8408
 
8394
- class Admin {
8395
- constructor(client) {
8396
- this.client = client;
8397
- }
8398
- /**
8399
- * Delete everything cached from the platform database in the region serving the request.
8400
- *
8401
- * @throws {AppwriteException}
8402
- * @returns {Promise<{}>}
8403
- */
8404
- deletePlatformCache() {
8405
- const apiPath = '/admin/cache/platform';
8406
- const apiPayload = {};
8407
- const uri = new URL(this.client.config.endpoint + apiPath);
8408
- const apiHeaders = {
8409
- 'X-Appwrite-Project': this.client.config.project,
8410
- 'content-type': 'application/json',
8411
- accept: 'application/json',
8412
- };
8413
- return this.client.call('delete', uri, apiHeaders, apiPayload);
8414
- }
8415
- deletePlatformResourceCache(paramsOrFirst, ...rest) {
8416
- let params;
8417
- if (paramsOrFirst &&
8418
- typeof paramsOrFirst === 'object' &&
8419
- !Array.isArray(paramsOrFirst) &&
8420
- ('resourceType' in paramsOrFirst || 'resourceId' in paramsOrFirst)) {
8421
- params = (paramsOrFirst || {});
8422
- }
8423
- else {
8424
- params = {
8425
- resourceType: paramsOrFirst,
8426
- resourceId: rest[0],
8427
- };
8428
- }
8429
- const resourceType = params.resourceType;
8430
- const resourceId = params.resourceId;
8431
- if (typeof resourceType === 'undefined') {
8432
- throw new AppwriteException('Missing required parameter: "resourceType"');
8433
- }
8434
- const apiPath = '/admin/cache/platform/resources';
8435
- const apiPayload = {};
8436
- if (typeof resourceType !== 'undefined') {
8437
- apiPayload['resourceType'] = resourceType;
8438
- }
8439
- if (typeof resourceId !== 'undefined') {
8440
- apiPayload['resourceId'] = resourceId;
8441
- }
8442
- const uri = new URL(this.client.config.endpoint + apiPath);
8443
- const apiHeaders = {
8444
- 'X-Appwrite-Project': this.client.config.project,
8445
- 'content-type': 'application/json',
8446
- accept: 'application/json',
8447
- };
8448
- return this.client.call('delete', uri, apiHeaders, apiPayload);
8449
- }
8450
- deleteProjectCache(paramsOrFirst) {
8451
- let params;
8452
- if (paramsOrFirst &&
8453
- typeof paramsOrFirst === 'object' &&
8454
- !Array.isArray(paramsOrFirst)) {
8455
- params = (paramsOrFirst || {});
8456
- }
8457
- else {
8458
- params = {
8459
- projectId: paramsOrFirst,
8460
- };
8461
- }
8462
- const projectId = params.projectId;
8463
- if (typeof projectId === 'undefined') {
8464
- throw new AppwriteException('Missing required parameter: "projectId"');
8465
- }
8466
- const apiPath = '/admin/cache/project';
8467
- const apiPayload = {};
8468
- if (typeof projectId !== 'undefined') {
8469
- apiPayload['projectId'] = projectId;
8470
- }
8471
- const uri = new URL(this.client.config.endpoint + apiPath);
8472
- const apiHeaders = {
8473
- 'X-Appwrite-Project': this.client.config.project,
8474
- 'content-type': 'application/json',
8475
- accept: 'application/json',
8476
- };
8477
- return this.client.call('delete', uri, apiHeaders, apiPayload);
8478
- }
8479
- deleteProjectResourceCache(paramsOrFirst, ...rest) {
8480
- let params;
8481
- if (paramsOrFirst &&
8482
- typeof paramsOrFirst === 'object' &&
8483
- !Array.isArray(paramsOrFirst)) {
8484
- params = (paramsOrFirst || {});
8485
- }
8486
- else {
8487
- params = {
8488
- projectId: paramsOrFirst,
8489
- resourceType: rest[0],
8490
- resourceId: rest[1],
8491
- };
8492
- }
8493
- const projectId = params.projectId;
8494
- const resourceType = params.resourceType;
8495
- const resourceId = params.resourceId;
8496
- if (typeof projectId === 'undefined') {
8497
- throw new AppwriteException('Missing required parameter: "projectId"');
8498
- }
8499
- if (typeof resourceType === 'undefined') {
8500
- throw new AppwriteException('Missing required parameter: "resourceType"');
8501
- }
8502
- const apiPath = '/admin/cache/project/resources';
8503
- const apiPayload = {};
8504
- if (typeof projectId !== 'undefined') {
8505
- apiPayload['projectId'] = projectId;
8506
- }
8507
- if (typeof resourceType !== 'undefined') {
8508
- apiPayload['resourceType'] = resourceType;
8509
- }
8510
- if (typeof resourceId !== 'undefined') {
8511
- apiPayload['resourceId'] = resourceId;
8512
- }
8513
- const uri = new URL(this.client.config.endpoint + apiPath);
8514
- const apiHeaders = {
8515
- 'X-Appwrite-Project': this.client.config.project,
8516
- 'content-type': 'application/json',
8517
- accept: 'application/json',
8518
- };
8519
- return this.client.call('delete', uri, apiHeaders, apiPayload);
8520
- }
8521
- }
8522
-
8523
8409
  class Affiliates {
8524
8410
  constructor(client) {
8525
8411
  this.client = client;
@@ -8731,369 +8617,6 @@
8731
8617
  }
8732
8618
  }
8733
8619
 
8734
- class Analytics {
8735
- constructor(client) {
8736
- this.client = client;
8737
- }
8738
- listProperties(paramsOrFirst, ...rest) {
8739
- let params;
8740
- if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
8741
- (paramsOrFirst &&
8742
- typeof paramsOrFirst === 'object' &&
8743
- !Array.isArray(paramsOrFirst))) {
8744
- params = (paramsOrFirst || {});
8745
- }
8746
- else {
8747
- params = {
8748
- queries: paramsOrFirst,
8749
- search: rest[0],
8750
- total: rest[1],
8751
- };
8752
- }
8753
- const queries = params.queries;
8754
- const search = params.search;
8755
- const total = params.total;
8756
- const apiPath = '/analytics/properties';
8757
- const apiPayload = {};
8758
- if (typeof queries !== 'undefined') {
8759
- apiPayload['queries'] = queries;
8760
- }
8761
- if (typeof search !== 'undefined') {
8762
- apiPayload['search'] = search;
8763
- }
8764
- if (typeof total !== 'undefined') {
8765
- apiPayload['total'] = total;
8766
- }
8767
- const uri = new URL(this.client.config.endpoint + apiPath);
8768
- const apiHeaders = {
8769
- 'X-Appwrite-Project': this.client.config.project,
8770
- accept: 'application/json',
8771
- };
8772
- return this.client.call('get', uri, apiHeaders, apiPayload);
8773
- }
8774
- createProperty(paramsOrFirst, ...rest) {
8775
- let params;
8776
- if (paramsOrFirst &&
8777
- typeof paramsOrFirst === 'object' &&
8778
- !Array.isArray(paramsOrFirst)) {
8779
- params = (paramsOrFirst || {});
8780
- }
8781
- else {
8782
- params = {
8783
- propertyId: paramsOrFirst,
8784
- name: rest[0],
8785
- domain: rest[1],
8786
- timezone: rest[2],
8787
- enabled: rest[3],
8788
- xpublic: rest[4],
8789
- allowedOrigins: rest[5],
8790
- };
8791
- }
8792
- const propertyId = params.propertyId;
8793
- const name = params.name;
8794
- const domain = params.domain;
8795
- const timezone = params.timezone;
8796
- const enabled = params.enabled;
8797
- const xpublic = params.xpublic;
8798
- const allowedOrigins = params.allowedOrigins;
8799
- if (typeof propertyId === 'undefined') {
8800
- throw new AppwriteException('Missing required parameter: "propertyId"');
8801
- }
8802
- if (typeof name === 'undefined') {
8803
- throw new AppwriteException('Missing required parameter: "name"');
8804
- }
8805
- const apiPath = '/analytics/properties';
8806
- const apiPayload = {};
8807
- if (typeof propertyId !== 'undefined') {
8808
- apiPayload['propertyId'] = propertyId;
8809
- }
8810
- if (typeof name !== 'undefined') {
8811
- apiPayload['name'] = name;
8812
- }
8813
- if (typeof domain !== 'undefined') {
8814
- apiPayload['domain'] = domain;
8815
- }
8816
- if (typeof timezone !== 'undefined') {
8817
- apiPayload['timezone'] = timezone;
8818
- }
8819
- if (typeof enabled !== 'undefined') {
8820
- apiPayload['enabled'] = enabled;
8821
- }
8822
- if (typeof xpublic !== 'undefined') {
8823
- apiPayload['public'] = xpublic;
8824
- }
8825
- if (typeof allowedOrigins !== 'undefined') {
8826
- apiPayload['allowedOrigins'] = allowedOrigins;
8827
- }
8828
- const uri = new URL(this.client.config.endpoint + apiPath);
8829
- const apiHeaders = {
8830
- 'X-Appwrite-Project': this.client.config.project,
8831
- 'content-type': 'application/json',
8832
- accept: 'application/json',
8833
- };
8834
- return this.client.call('post', uri, apiHeaders, apiPayload);
8835
- }
8836
- getProperty(paramsOrFirst) {
8837
- let params;
8838
- if (paramsOrFirst &&
8839
- typeof paramsOrFirst === 'object' &&
8840
- !Array.isArray(paramsOrFirst)) {
8841
- params = (paramsOrFirst || {});
8842
- }
8843
- else {
8844
- params = {
8845
- propertyId: paramsOrFirst,
8846
- };
8847
- }
8848
- const propertyId = params.propertyId;
8849
- if (typeof propertyId === 'undefined' || propertyId === '') {
8850
- throw new AppwriteException('Missing required parameter: "propertyId"');
8851
- }
8852
- const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
8853
- const apiPayload = {};
8854
- const uri = new URL(this.client.config.endpoint + apiPath);
8855
- const apiHeaders = {
8856
- 'X-Appwrite-Project': this.client.config.project,
8857
- accept: 'application/json',
8858
- };
8859
- return this.client.call('get', uri, apiHeaders, apiPayload);
8860
- }
8861
- updateProperty(paramsOrFirst, ...rest) {
8862
- let params;
8863
- if (paramsOrFirst &&
8864
- typeof paramsOrFirst === 'object' &&
8865
- !Array.isArray(paramsOrFirst)) {
8866
- params = (paramsOrFirst || {});
8867
- }
8868
- else {
8869
- params = {
8870
- propertyId: paramsOrFirst,
8871
- name: rest[0],
8872
- domain: rest[1],
8873
- timezone: rest[2],
8874
- enabled: rest[3],
8875
- xpublic: rest[4],
8876
- allowedOrigins: rest[5],
8877
- };
8878
- }
8879
- const propertyId = params.propertyId;
8880
- const name = params.name;
8881
- const domain = params.domain;
8882
- const timezone = params.timezone;
8883
- const enabled = params.enabled;
8884
- const xpublic = params.xpublic;
8885
- const allowedOrigins = params.allowedOrigins;
8886
- if (typeof propertyId === 'undefined' || propertyId === '') {
8887
- throw new AppwriteException('Missing required parameter: "propertyId"');
8888
- }
8889
- const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
8890
- const apiPayload = {};
8891
- if (typeof name !== 'undefined') {
8892
- apiPayload['name'] = name;
8893
- }
8894
- if (typeof domain !== 'undefined') {
8895
- apiPayload['domain'] = domain;
8896
- }
8897
- if (typeof timezone !== 'undefined') {
8898
- apiPayload['timezone'] = timezone;
8899
- }
8900
- if (typeof enabled !== 'undefined') {
8901
- apiPayload['enabled'] = enabled;
8902
- }
8903
- if (typeof xpublic !== 'undefined') {
8904
- apiPayload['public'] = xpublic;
8905
- }
8906
- if (typeof allowedOrigins !== 'undefined') {
8907
- apiPayload['allowedOrigins'] = allowedOrigins;
8908
- }
8909
- const uri = new URL(this.client.config.endpoint + apiPath);
8910
- const apiHeaders = {
8911
- 'X-Appwrite-Project': this.client.config.project,
8912
- 'content-type': 'application/json',
8913
- accept: 'application/json',
8914
- };
8915
- return this.client.call('patch', uri, apiHeaders, apiPayload);
8916
- }
8917
- deleteProperty(paramsOrFirst) {
8918
- let params;
8919
- if (paramsOrFirst &&
8920
- typeof paramsOrFirst === 'object' &&
8921
- !Array.isArray(paramsOrFirst)) {
8922
- params = (paramsOrFirst || {});
8923
- }
8924
- else {
8925
- params = {
8926
- propertyId: paramsOrFirst,
8927
- };
8928
- }
8929
- const propertyId = params.propertyId;
8930
- if (typeof propertyId === 'undefined' || propertyId === '') {
8931
- throw new AppwriteException('Missing required parameter: "propertyId"');
8932
- }
8933
- const apiPath = '/analytics/properties/{propertyId}'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
8934
- const apiPayload = {};
8935
- const uri = new URL(this.client.config.endpoint + apiPath);
8936
- const apiHeaders = {
8937
- 'X-Appwrite-Project': this.client.config.project,
8938
- 'content-type': 'application/json',
8939
- accept: 'application/json',
8940
- };
8941
- return this.client.call('delete', uri, apiHeaders, apiPayload);
8942
- }
8943
- createEvent(paramsOrFirst, ...rest) {
8944
- let params;
8945
- if (paramsOrFirst &&
8946
- typeof paramsOrFirst === 'object' &&
8947
- !Array.isArray(paramsOrFirst)) {
8948
- params = (paramsOrFirst || {});
8949
- }
8950
- else {
8951
- params = {
8952
- propertyId: paramsOrFirst,
8953
- name: rest[0],
8954
- url: rest[1],
8955
- domain: rest[2],
8956
- referrer: rest[3],
8957
- screenWidth: rest[4],
8958
- sessionHash: rest[5],
8959
- scrollDepth: rest[6],
8960
- engagementTime: rest[7],
8961
- props: rest[8],
8962
- userId: rest[9],
8963
- ip: rest[10],
8964
- userAgent: rest[11],
8965
- };
8966
- }
8967
- const propertyId = params.propertyId;
8968
- const name = params.name;
8969
- const url = params.url;
8970
- const domain = params.domain;
8971
- const referrer = params.referrer;
8972
- const screenWidth = params.screenWidth;
8973
- const sessionHash = params.sessionHash;
8974
- const scrollDepth = params.scrollDepth;
8975
- const engagementTime = params.engagementTime;
8976
- const props = params.props;
8977
- const userId = params.userId;
8978
- const ip = params.ip;
8979
- const userAgent = params.userAgent;
8980
- if (typeof propertyId === 'undefined' || propertyId === '') {
8981
- throw new AppwriteException('Missing required parameter: "propertyId"');
8982
- }
8983
- if (typeof name === 'undefined') {
8984
- throw new AppwriteException('Missing required parameter: "name"');
8985
- }
8986
- if (typeof url === 'undefined') {
8987
- throw new AppwriteException('Missing required parameter: "url"');
8988
- }
8989
- const apiPath = '/analytics/properties/{propertyId}/events'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
8990
- const apiPayload = {};
8991
- if (typeof name !== 'undefined') {
8992
- apiPayload['name'] = name;
8993
- }
8994
- if (typeof url !== 'undefined') {
8995
- apiPayload['url'] = url;
8996
- }
8997
- if (typeof domain !== 'undefined') {
8998
- apiPayload['domain'] = domain;
8999
- }
9000
- if (typeof referrer !== 'undefined') {
9001
- apiPayload['referrer'] = referrer;
9002
- }
9003
- if (typeof screenWidth !== 'undefined') {
9004
- apiPayload['screenWidth'] = screenWidth;
9005
- }
9006
- if (typeof sessionHash !== 'undefined') {
9007
- apiPayload['sessionHash'] = sessionHash;
9008
- }
9009
- if (typeof scrollDepth !== 'undefined') {
9010
- apiPayload['scrollDepth'] = scrollDepth;
9011
- }
9012
- if (typeof engagementTime !== 'undefined') {
9013
- apiPayload['engagementTime'] = engagementTime;
9014
- }
9015
- if (typeof props !== 'undefined') {
9016
- apiPayload['props'] = props;
9017
- }
9018
- if (typeof userId !== 'undefined') {
9019
- apiPayload['userId'] = userId;
9020
- }
9021
- if (typeof ip !== 'undefined') {
9022
- apiPayload['ip'] = ip;
9023
- }
9024
- if (typeof userAgent !== 'undefined') {
9025
- apiPayload['userAgent'] = userAgent;
9026
- }
9027
- const uri = new URL(this.client.config.endpoint + apiPath);
9028
- const apiHeaders = {
9029
- 'X-Appwrite-Project': this.client.config.project,
9030
- 'content-type': 'application/json',
9031
- accept: 'application/json',
9032
- };
9033
- return this.client.call('post', uri, apiHeaders, apiPayload);
9034
- }
9035
- listMetrics(paramsOrFirst, ...rest) {
9036
- let params;
9037
- if (paramsOrFirst &&
9038
- typeof paramsOrFirst === 'object' &&
9039
- !Array.isArray(paramsOrFirst)) {
9040
- params = (paramsOrFirst || {});
9041
- }
9042
- else {
9043
- params = {
9044
- propertyId: paramsOrFirst,
9045
- queries: rest[0],
9046
- interval: rest[1],
9047
- dimensions: rest[2],
9048
- dateRange: rest[3],
9049
- startAt: rest[4],
9050
- endAt: rest[5],
9051
- limit: rest[6],
9052
- };
9053
- }
9054
- const propertyId = params.propertyId;
9055
- const queries = params.queries;
9056
- const interval = params.interval;
9057
- const dimensions = params.dimensions;
9058
- const dateRange = params.dateRange;
9059
- const startAt = params.startAt;
9060
- const endAt = params.endAt;
9061
- const limit = params.limit;
9062
- if (typeof propertyId === 'undefined' || propertyId === '') {
9063
- throw new AppwriteException('Missing required parameter: "propertyId"');
9064
- }
9065
- const apiPath = '/analytics/properties/{propertyId}/metrics'.replace('{propertyId}', encodeURIComponent(String(propertyId)));
9066
- const apiPayload = {};
9067
- if (typeof queries !== 'undefined') {
9068
- apiPayload['queries'] = queries;
9069
- }
9070
- if (typeof interval !== 'undefined') {
9071
- apiPayload['interval'] = interval;
9072
- }
9073
- if (typeof dimensions !== 'undefined') {
9074
- apiPayload['dimensions'] = dimensions;
9075
- }
9076
- if (typeof dateRange !== 'undefined') {
9077
- apiPayload['dateRange'] = dateRange;
9078
- }
9079
- if (typeof startAt !== 'undefined') {
9080
- apiPayload['startAt'] = startAt;
9081
- }
9082
- if (typeof endAt !== 'undefined') {
9083
- apiPayload['endAt'] = endAt;
9084
- }
9085
- if (typeof limit !== 'undefined') {
9086
- apiPayload['limit'] = limit;
9087
- }
9088
- const uri = new URL(this.client.config.endpoint + apiPath);
9089
- const apiHeaders = {
9090
- 'X-Appwrite-Project': this.client.config.project,
9091
- accept: 'application/json',
9092
- };
9093
- return this.client.call('get', uri, apiHeaders, apiPayload);
9094
- }
9095
- }
9096
-
9097
8620
  class Apps {
9098
8621
  constructor(client) {
9099
8622
  this.client = client;
@@ -9986,7 +9509,7 @@
9986
9509
  const uri = new URL(this.client.config.endpoint + apiPath);
9987
9510
  apiPayload['project'] = this.client.config.project;
9988
9511
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
9989
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9512
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
9990
9513
  uri.searchParams.append(key, value);
9991
9514
  }
9992
9515
  return uri.toString();
@@ -10031,7 +9554,7 @@
10031
9554
  const uri = new URL(this.client.config.endpoint + apiPath);
10032
9555
  apiPayload['project'] = this.client.config.project;
10033
9556
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10034
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9557
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10035
9558
  uri.searchParams.append(key, value);
10036
9559
  }
10037
9560
  return uri.toString();
@@ -10060,7 +9583,7 @@
10060
9583
  const uri = new URL(this.client.config.endpoint + apiPath);
10061
9584
  apiPayload['project'] = this.client.config.project;
10062
9585
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10063
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9586
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10064
9587
  uri.searchParams.append(key, value);
10065
9588
  }
10066
9589
  return uri.toString();
@@ -10105,7 +9628,7 @@
10105
9628
  const uri = new URL(this.client.config.endpoint + apiPath);
10106
9629
  apiPayload['project'] = this.client.config.project;
10107
9630
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10108
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9631
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10109
9632
  uri.searchParams.append(key, value);
10110
9633
  }
10111
9634
  return uri.toString();
@@ -10144,7 +9667,7 @@
10144
9667
  const uri = new URL(this.client.config.endpoint + apiPath);
10145
9668
  apiPayload['project'] = this.client.config.project;
10146
9669
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10147
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9670
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10148
9671
  uri.searchParams.append(key, value);
10149
9672
  }
10150
9673
  return uri.toString();
@@ -10186,7 +9709,7 @@
10186
9709
  const uri = new URL(this.client.config.endpoint + apiPath);
10187
9710
  apiPayload['project'] = this.client.config.project;
10188
9711
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10189
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9712
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10190
9713
  uri.searchParams.append(key, value);
10191
9714
  }
10192
9715
  return uri.toString();
@@ -10248,7 +9771,7 @@
10248
9771
  const uri = new URL(this.client.config.endpoint + apiPath);
10249
9772
  apiPayload['project'] = this.client.config.project;
10250
9773
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10251
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9774
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10252
9775
  uri.searchParams.append(key, value);
10253
9776
  }
10254
9777
  return uri.toString();
@@ -10342,7 +9865,7 @@
10342
9865
  const uri = new URL(this.client.config.endpoint + apiPath);
10343
9866
  apiPayload['project'] = this.client.config.project;
10344
9867
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10345
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9868
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10346
9869
  uri.searchParams.append(key, value);
10347
9870
  }
10348
9871
  return uri.toString();
@@ -10466,7 +9989,7 @@
10466
9989
  const uri = new URL(this.client.config.endpoint + apiPath);
10467
9990
  apiPayload['project'] = this.client.config.project;
10468
9991
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
10469
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
9992
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
10470
9993
  uri.searchParams.append(key, value);
10471
9994
  }
10472
9995
  return uri.toString();
@@ -20052,7 +19575,7 @@
20052
19575
  const uri = new URL(this.client.config.endpoint + apiPath);
20053
19576
  apiPayload['project'] = this.client.config.project;
20054
19577
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
20055
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
19578
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
20056
19579
  uri.searchParams.append(key, value);
20057
19580
  }
20058
19581
  return uri.toString();
@@ -30691,7 +30214,7 @@
30691
30214
  const uri = new URL(this.client.config.endpoint + apiPath);
30692
30215
  apiPayload['project'] = this.client.config.project;
30693
30216
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
30694
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
30217
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
30695
30218
  uri.searchParams.append(key, value);
30696
30219
  }
30697
30220
  return uri.toString();
@@ -30798,7 +30321,7 @@
30798
30321
  const uri = new URL(this.client.config.endpoint + apiPath);
30799
30322
  apiPayload['project'] = this.client.config.project;
30800
30323
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
30801
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
30324
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
30802
30325
  uri.searchParams.append(key, value);
30803
30326
  }
30804
30327
  return uri.toString();
@@ -36294,30 +35817,27 @@
36294
35817
  };
36295
35818
  return this.client.call('patch', uri, apiHeaders, apiPayload);
36296
35819
  }
36297
- updatePasskeyPolicy(paramsOrFirst, ...rest) {
35820
+ updatePasskeyPolicy(paramsOrFirst) {
36298
35821
  let params;
36299
- if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
36300
- (paramsOrFirst &&
36301
- typeof paramsOrFirst === 'object' &&
36302
- !Array.isArray(paramsOrFirst))) {
35822
+ if (paramsOrFirst &&
35823
+ typeof paramsOrFirst === 'object' &&
35824
+ !Array.isArray(paramsOrFirst)) {
36303
35825
  params = (paramsOrFirst || {});
36304
35826
  }
36305
35827
  else {
36306
35828
  params = {
36307
35829
  rpId: paramsOrFirst,
36308
- origins: rest[0],
36309
35830
  };
36310
35831
  }
36311
35832
  const rpId = params.rpId;
36312
- const origins = params.origins;
35833
+ if (typeof rpId === 'undefined') {
35834
+ throw new AppwriteException('Missing required parameter: "rpId"');
35835
+ }
36313
35836
  const apiPath = '/project/policies/passkey';
36314
35837
  const apiPayload = {};
36315
35838
  if (typeof rpId !== 'undefined') {
36316
35839
  apiPayload['rpId'] = rpId;
36317
35840
  }
36318
- if (typeof origins !== 'undefined') {
36319
- apiPayload['origins'] = origins;
36320
- }
36321
35841
  const uri = new URL(this.client.config.endpoint + apiPath);
36322
35842
  const apiHeaders = {
36323
35843
  'X-Appwrite-Project': this.client.config.project,
@@ -39016,7 +38536,7 @@
39016
38536
  const uri = new URL(this.client.config.endpoint + apiPath);
39017
38537
  apiPayload['project'] = this.client.config.project;
39018
38538
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
39019
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
38539
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
39020
38540
  uri.searchParams.append(key, value);
39021
38541
  }
39022
38542
  return uri.toString();
@@ -39847,7 +39367,7 @@
39847
39367
  const uri = new URL(this.client.config.endpoint + apiPath);
39848
39368
  apiPayload['project'] = this.client.config.project;
39849
39369
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
39850
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
39370
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
39851
39371
  uri.searchParams.append(key, value);
39852
39372
  }
39853
39373
  return uri.toString();
@@ -39940,7 +39460,7 @@
39940
39460
  const uri = new URL(this.client.config.endpoint + apiPath);
39941
39461
  apiPayload['project'] = this.client.config.project;
39942
39462
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
39943
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
39463
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
39944
39464
  uri.searchParams.append(key, value);
39945
39465
  }
39946
39466
  return uri.toString();
@@ -39978,7 +39498,7 @@
39978
39498
  const uri = new URL(this.client.config.endpoint + apiPath);
39979
39499
  apiPayload['project'] = this.client.config.project;
39980
39500
  apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
39981
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
39501
+ for (const [key, value] of Object.entries(Service.flatten(apiPayload))) {
39982
39502
  uri.searchParams.append(key, value);
39983
39503
  }
39984
39504
  return uri.toString();
@@ -46356,6 +45876,47 @@
46356
45876
  };
46357
45877
  return this.client.call('get', uri, apiHeaders, apiPayload);
46358
45878
  }
45879
+ updatePasskey(paramsOrFirst, ...rest) {
45880
+ let params;
45881
+ if (paramsOrFirst &&
45882
+ typeof paramsOrFirst === 'object' &&
45883
+ !Array.isArray(paramsOrFirst)) {
45884
+ params = (paramsOrFirst || {});
45885
+ }
45886
+ else {
45887
+ params = {
45888
+ userId: paramsOrFirst,
45889
+ passkeyId: rest[0],
45890
+ name: rest[1],
45891
+ };
45892
+ }
45893
+ const userId = params.userId;
45894
+ const passkeyId = params.passkeyId;
45895
+ const name = params.name;
45896
+ if (typeof userId === 'undefined' || userId === '') {
45897
+ throw new AppwriteException('Missing required parameter: "userId"');
45898
+ }
45899
+ if (typeof passkeyId === 'undefined' || passkeyId === '') {
45900
+ throw new AppwriteException('Missing required parameter: "passkeyId"');
45901
+ }
45902
+ if (typeof name === 'undefined') {
45903
+ throw new AppwriteException('Missing required parameter: "name"');
45904
+ }
45905
+ const apiPath = '/users/{userId}/passkeys/{passkeyId}'
45906
+ .replace('{userId}', encodeURIComponent(String(userId)))
45907
+ .replace('{passkeyId}', encodeURIComponent(String(passkeyId)));
45908
+ const apiPayload = {};
45909
+ if (typeof name !== 'undefined') {
45910
+ apiPayload['name'] = name;
45911
+ }
45912
+ const uri = new URL(this.client.config.endpoint + apiPath);
45913
+ const apiHeaders = {
45914
+ 'X-Appwrite-Project': this.client.config.project,
45915
+ 'content-type': 'application/json',
45916
+ accept: 'application/json',
45917
+ };
45918
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
45919
+ }
46359
45920
  deletePasskey(paramsOrFirst, ...rest) {
46360
45921
  let params;
46361
45922
  if (paramsOrFirst &&
@@ -48895,11 +48456,11 @@
48895
48456
  }
48896
48457
  }
48897
48458
 
48898
- class Videos {
48459
+ class Waf {
48899
48460
  constructor(client) {
48900
48461
  this.client = client;
48901
48462
  }
48902
- list(paramsOrFirst, ...rest) {
48463
+ listRules(paramsOrFirst, ...rest) {
48903
48464
  let params;
48904
48465
  if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
48905
48466
  (paramsOrFirst &&
@@ -48917,7 +48478,7 @@
48917
48478
  const queries = params.queries;
48918
48479
  const search = params.search;
48919
48480
  const total = params.total;
48920
- const apiPath = '/videos';
48481
+ const apiPath = '/waf/rules';
48921
48482
  const apiPayload = {};
48922
48483
  if (typeof queries !== 'undefined') {
48923
48484
  apiPayload['queries'] = queries;
@@ -48935,7 +48496,7 @@
48935
48496
  };
48936
48497
  return this.client.call('get', uri, apiHeaders, apiPayload);
48937
48498
  }
48938
- create(paramsOrFirst, ...rest) {
48499
+ createBypassRule(paramsOrFirst, ...rest) {
48939
48500
  let params;
48940
48501
  if (paramsOrFirst &&
48941
48502
  typeof paramsOrFirst === 'object' &&
@@ -48944,31 +48505,59 @@
48944
48505
  }
48945
48506
  else {
48946
48507
  params = {
48947
- bucketId: paramsOrFirst,
48948
- fileId: rest[0],
48508
+ ruleId: paramsOrFirst,
48509
+ resourceType: rest[0],
48949
48510
  name: rest[1],
48511
+ resourceId: rest[2],
48512
+ description: rest[3],
48513
+ priority: rest[4],
48514
+ enabled: rest[5],
48515
+ conditions: rest[6],
48950
48516
  };
48951
48517
  }
48952
- const bucketId = params.bucketId;
48953
- const fileId = params.fileId;
48518
+ const ruleId = params.ruleId;
48519
+ const resourceType = params.resourceType;
48954
48520
  const name = params.name;
48955
- if (typeof bucketId === 'undefined') {
48956
- throw new AppwriteException('Missing required parameter: "bucketId"');
48521
+ const resourceId = params.resourceId;
48522
+ const description = params.description;
48523
+ const priority = params.priority;
48524
+ const enabled = params.enabled;
48525
+ const conditions = params.conditions;
48526
+ if (typeof ruleId === 'undefined') {
48527
+ throw new AppwriteException('Missing required parameter: "ruleId"');
48957
48528
  }
48958
- if (typeof fileId === 'undefined') {
48959
- throw new AppwriteException('Missing required parameter: "fileId"');
48529
+ if (typeof resourceType === 'undefined') {
48530
+ throw new AppwriteException('Missing required parameter: "resourceType"');
48531
+ }
48532
+ if (typeof name === 'undefined') {
48533
+ throw new AppwriteException('Missing required parameter: "name"');
48960
48534
  }
48961
- const apiPath = '/videos';
48535
+ const apiPath = '/waf/rules/bypass';
48962
48536
  const apiPayload = {};
48963
- if (typeof bucketId !== 'undefined') {
48964
- apiPayload['bucketId'] = bucketId;
48537
+ if (typeof ruleId !== 'undefined') {
48538
+ apiPayload['ruleId'] = ruleId;
48965
48539
  }
48966
- if (typeof fileId !== 'undefined') {
48967
- apiPayload['fileId'] = fileId;
48540
+ if (typeof resourceType !== 'undefined') {
48541
+ apiPayload['resourceType'] = resourceType;
48542
+ }
48543
+ if (typeof resourceId !== 'undefined') {
48544
+ apiPayload['resourceId'] = resourceId;
48968
48545
  }
48969
48546
  if (typeof name !== 'undefined') {
48970
48547
  apiPayload['name'] = name;
48971
48548
  }
48549
+ if (typeof description !== 'undefined') {
48550
+ apiPayload['description'] = description;
48551
+ }
48552
+ if (typeof priority !== 'undefined') {
48553
+ apiPayload['priority'] = priority;
48554
+ }
48555
+ if (typeof enabled !== 'undefined') {
48556
+ apiPayload['enabled'] = enabled;
48557
+ }
48558
+ if (typeof conditions !== 'undefined') {
48559
+ apiPayload['conditions'] = conditions;
48560
+ }
48972
48561
  const uri = new URL(this.client.config.endpoint + apiPath);
48973
48562
  const apiHeaders = {
48974
48563
  'X-Appwrite-Project': this.client.config.project,
@@ -48977,33 +48566,68 @@
48977
48566
  };
48978
48567
  return this.client.call('post', uri, apiHeaders, apiPayload);
48979
48568
  }
48980
- listProfiles(paramsOrFirst) {
48569
+ updateBypassRule(paramsOrFirst, ...rest) {
48981
48570
  let params;
48982
- if (typeof paramsOrFirst === 'undefined' ||
48983
- (paramsOrFirst &&
48984
- typeof paramsOrFirst === 'object' &&
48985
- !Array.isArray(paramsOrFirst))) {
48571
+ if (paramsOrFirst &&
48572
+ typeof paramsOrFirst === 'object' &&
48573
+ !Array.isArray(paramsOrFirst)) {
48986
48574
  params = (paramsOrFirst || {});
48987
48575
  }
48988
48576
  else {
48989
48577
  params = {
48990
- search: paramsOrFirst,
48578
+ ruleId: paramsOrFirst,
48579
+ resourceType: rest[0],
48580
+ resourceId: rest[1],
48581
+ name: rest[2],
48582
+ description: rest[3],
48583
+ priority: rest[4],
48584
+ enabled: rest[5],
48585
+ conditions: rest[6],
48991
48586
  };
48992
48587
  }
48993
- const search = params.search;
48994
- const apiPath = '/videos/profiles';
48588
+ const ruleId = params.ruleId;
48589
+ const resourceType = params.resourceType;
48590
+ const resourceId = params.resourceId;
48591
+ const name = params.name;
48592
+ const description = params.description;
48593
+ const priority = params.priority;
48594
+ const enabled = params.enabled;
48595
+ const conditions = params.conditions;
48596
+ if (typeof ruleId === 'undefined' || ruleId === '') {
48597
+ throw new AppwriteException('Missing required parameter: "ruleId"');
48598
+ }
48599
+ const apiPath = '/waf/rules/bypass/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
48995
48600
  const apiPayload = {};
48996
- if (typeof search !== 'undefined') {
48997
- apiPayload['search'] = search;
48601
+ if (typeof resourceType !== 'undefined') {
48602
+ apiPayload['resourceType'] = resourceType;
48603
+ }
48604
+ if (typeof resourceId !== 'undefined') {
48605
+ apiPayload['resourceId'] = resourceId;
48606
+ }
48607
+ if (typeof name !== 'undefined') {
48608
+ apiPayload['name'] = name;
48609
+ }
48610
+ if (typeof description !== 'undefined') {
48611
+ apiPayload['description'] = description;
48612
+ }
48613
+ if (typeof priority !== 'undefined') {
48614
+ apiPayload['priority'] = priority;
48615
+ }
48616
+ if (typeof enabled !== 'undefined') {
48617
+ apiPayload['enabled'] = enabled;
48618
+ }
48619
+ if (typeof conditions !== 'undefined') {
48620
+ apiPayload['conditions'] = conditions;
48998
48621
  }
48999
48622
  const uri = new URL(this.client.config.endpoint + apiPath);
49000
48623
  const apiHeaders = {
49001
48624
  'X-Appwrite-Project': this.client.config.project,
48625
+ 'content-type': 'application/json',
49002
48626
  accept: 'application/json',
49003
48627
  };
49004
- return this.client.call('get', uri, apiHeaders, apiPayload);
48628
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
49005
48629
  }
49006
- createProfile(paramsOrFirst, ...rest) {
48630
+ createChallengeRule(paramsOrFirst, ...rest) {
49007
48631
  let params;
49008
48632
  if (paramsOrFirst &&
49009
48633
  typeof paramsOrFirst === 'object' &&
@@ -49012,49 +48636,73 @@
49012
48636
  }
49013
48637
  else {
49014
48638
  params = {
49015
- name: paramsOrFirst,
49016
- videoBitRate: rest[0],
49017
- audioBitRate: rest[1],
49018
- width: rest[2],
49019
- height: rest[3],
48639
+ ruleId: paramsOrFirst,
48640
+ resourceType: rest[0],
48641
+ name: rest[1],
48642
+ resourceId: rest[2],
48643
+ description: rest[3],
48644
+ challengeType: rest[4],
48645
+ priority: rest[5],
48646
+ enabled: rest[6],
48647
+ conditions: rest[7],
48648
+ difficulty: rest[8],
48649
+ ttl: rest[9],
49020
48650
  };
49021
48651
  }
48652
+ const ruleId = params.ruleId;
48653
+ const resourceType = params.resourceType;
49022
48654
  const name = params.name;
49023
- const videoBitRate = params.videoBitRate;
49024
- const audioBitRate = params.audioBitRate;
49025
- const width = params.width;
49026
- const height = params.height;
48655
+ const resourceId = params.resourceId;
48656
+ const description = params.description;
48657
+ const challengeType = params.challengeType;
48658
+ const priority = params.priority;
48659
+ const enabled = params.enabled;
48660
+ const conditions = params.conditions;
48661
+ const difficulty = params.difficulty;
48662
+ const ttl = params.ttl;
48663
+ if (typeof ruleId === 'undefined') {
48664
+ throw new AppwriteException('Missing required parameter: "ruleId"');
48665
+ }
48666
+ if (typeof resourceType === 'undefined') {
48667
+ throw new AppwriteException('Missing required parameter: "resourceType"');
48668
+ }
49027
48669
  if (typeof name === 'undefined') {
49028
48670
  throw new AppwriteException('Missing required parameter: "name"');
49029
48671
  }
49030
- if (typeof videoBitRate === 'undefined') {
49031
- throw new AppwriteException('Missing required parameter: "videoBitRate"');
49032
- }
49033
- if (typeof audioBitRate === 'undefined') {
49034
- throw new AppwriteException('Missing required parameter: "audioBitRate"');
48672
+ const apiPath = '/waf/rules/challenge';
48673
+ const apiPayload = {};
48674
+ if (typeof ruleId !== 'undefined') {
48675
+ apiPayload['ruleId'] = ruleId;
49035
48676
  }
49036
- if (typeof width === 'undefined') {
49037
- throw new AppwriteException('Missing required parameter: "width"');
48677
+ if (typeof resourceType !== 'undefined') {
48678
+ apiPayload['resourceType'] = resourceType;
49038
48679
  }
49039
- if (typeof height === 'undefined') {
49040
- throw new AppwriteException('Missing required parameter: "height"');
48680
+ if (typeof resourceId !== 'undefined') {
48681
+ apiPayload['resourceId'] = resourceId;
49041
48682
  }
49042
- const apiPath = '/videos/profiles';
49043
- const apiPayload = {};
49044
48683
  if (typeof name !== 'undefined') {
49045
48684
  apiPayload['name'] = name;
49046
48685
  }
49047
- if (typeof videoBitRate !== 'undefined') {
49048
- apiPayload['videoBitRate'] = videoBitRate;
48686
+ if (typeof description !== 'undefined') {
48687
+ apiPayload['description'] = description;
48688
+ }
48689
+ if (typeof challengeType !== 'undefined') {
48690
+ apiPayload['challengeType'] = challengeType;
48691
+ }
48692
+ if (typeof priority !== 'undefined') {
48693
+ apiPayload['priority'] = priority;
49049
48694
  }
49050
- if (typeof audioBitRate !== 'undefined') {
49051
- apiPayload['audioBitRate'] = audioBitRate;
48695
+ if (typeof enabled !== 'undefined') {
48696
+ apiPayload['enabled'] = enabled;
49052
48697
  }
49053
- if (typeof width !== 'undefined') {
49054
- apiPayload['width'] = width;
48698
+ if (typeof conditions !== 'undefined') {
48699
+ apiPayload['conditions'] = conditions;
49055
48700
  }
49056
- if (typeof height !== 'undefined') {
49057
- apiPayload['height'] = height;
48701
+ if (typeof difficulty !== 'undefined') {
48702
+ apiPayload['difficulty'] = difficulty;
48703
+ }
48704
+ if (typeof ttl !== 'undefined') {
48705
+ apiPayload['ttl'] = ttl;
49058
48706
  }
49059
48707
  const uri = new URL(this.client.config.endpoint + apiPath);
49060
48708
  const apiHeaders = {
@@ -49064,7 +48712,7 @@
49064
48712
  };
49065
48713
  return this.client.call('post', uri, apiHeaders, apiPayload);
49066
48714
  }
49067
- getProfile(paramsOrFirst) {
48715
+ updateChallengeRule(paramsOrFirst, ...rest) {
49068
48716
  let params;
49069
48717
  if (paramsOrFirst &&
49070
48718
  typeof paramsOrFirst === 'object' &&
@@ -49073,23 +48721,74 @@
49073
48721
  }
49074
48722
  else {
49075
48723
  params = {
49076
- profileId: paramsOrFirst,
48724
+ ruleId: paramsOrFirst,
48725
+ resourceType: rest[0],
48726
+ resourceId: rest[1],
48727
+ name: rest[2],
48728
+ description: rest[3],
48729
+ challengeType: rest[4],
48730
+ priority: rest[5],
48731
+ enabled: rest[6],
48732
+ conditions: rest[7],
48733
+ difficulty: rest[8],
48734
+ ttl: rest[9],
49077
48735
  };
49078
48736
  }
49079
- const profileId = params.profileId;
49080
- if (typeof profileId === 'undefined' || profileId === '') {
49081
- throw new AppwriteException('Missing required parameter: "profileId"');
48737
+ const ruleId = params.ruleId;
48738
+ const resourceType = params.resourceType;
48739
+ const resourceId = params.resourceId;
48740
+ const name = params.name;
48741
+ const description = params.description;
48742
+ const challengeType = params.challengeType;
48743
+ const priority = params.priority;
48744
+ const enabled = params.enabled;
48745
+ const conditions = params.conditions;
48746
+ const difficulty = params.difficulty;
48747
+ const ttl = params.ttl;
48748
+ if (typeof ruleId === 'undefined' || ruleId === '') {
48749
+ throw new AppwriteException('Missing required parameter: "ruleId"');
49082
48750
  }
49083
- const apiPath = '/videos/profiles/{profileId}'.replace('{profileId}', encodeURIComponent(String(profileId)));
48751
+ const apiPath = '/waf/rules/challenge/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
49084
48752
  const apiPayload = {};
48753
+ if (typeof resourceType !== 'undefined') {
48754
+ apiPayload['resourceType'] = resourceType;
48755
+ }
48756
+ if (typeof resourceId !== 'undefined') {
48757
+ apiPayload['resourceId'] = resourceId;
48758
+ }
48759
+ if (typeof name !== 'undefined') {
48760
+ apiPayload['name'] = name;
48761
+ }
48762
+ if (typeof description !== 'undefined') {
48763
+ apiPayload['description'] = description;
48764
+ }
48765
+ if (typeof challengeType !== 'undefined') {
48766
+ apiPayload['challengeType'] = challengeType;
48767
+ }
48768
+ if (typeof priority !== 'undefined') {
48769
+ apiPayload['priority'] = priority;
48770
+ }
48771
+ if (typeof enabled !== 'undefined') {
48772
+ apiPayload['enabled'] = enabled;
48773
+ }
48774
+ if (typeof conditions !== 'undefined') {
48775
+ apiPayload['conditions'] = conditions;
48776
+ }
48777
+ if (typeof difficulty !== 'undefined') {
48778
+ apiPayload['difficulty'] = difficulty;
48779
+ }
48780
+ if (typeof ttl !== 'undefined') {
48781
+ apiPayload['ttl'] = ttl;
48782
+ }
49085
48783
  const uri = new URL(this.client.config.endpoint + apiPath);
49086
48784
  const apiHeaders = {
49087
48785
  'X-Appwrite-Project': this.client.config.project,
48786
+ 'content-type': 'application/json',
49088
48787
  accept: 'application/json',
49089
48788
  };
49090
- return this.client.call('get', uri, apiHeaders, apiPayload);
48789
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
49091
48790
  }
49092
- updateProfile(paramsOrFirst, ...rest) {
48791
+ createDenyRule(paramsOrFirst, ...rest) {
49093
48792
  let params;
49094
48793
  if (paramsOrFirst &&
49095
48794
  typeof paramsOrFirst === 'object' &&
@@ -49098,54 +48797,58 @@
49098
48797
  }
49099
48798
  else {
49100
48799
  params = {
49101
- profileId: paramsOrFirst,
49102
- name: rest[0],
49103
- videoBitRate: rest[1],
49104
- audioBitRate: rest[2],
49105
- width: rest[3],
49106
- height: rest[4],
48800
+ ruleId: paramsOrFirst,
48801
+ resourceType: rest[0],
48802
+ name: rest[1],
48803
+ resourceId: rest[2],
48804
+ description: rest[3],
48805
+ priority: rest[4],
48806
+ enabled: rest[5],
48807
+ conditions: rest[6],
49107
48808
  };
49108
48809
  }
49109
- const profileId = params.profileId;
48810
+ const ruleId = params.ruleId;
48811
+ const resourceType = params.resourceType;
49110
48812
  const name = params.name;
49111
- const videoBitRate = params.videoBitRate;
49112
- const audioBitRate = params.audioBitRate;
49113
- const width = params.width;
49114
- const height = params.height;
49115
- if (typeof profileId === 'undefined' || profileId === '') {
49116
- throw new AppwriteException('Missing required parameter: "profileId"');
48813
+ const resourceId = params.resourceId;
48814
+ const description = params.description;
48815
+ const priority = params.priority;
48816
+ const enabled = params.enabled;
48817
+ const conditions = params.conditions;
48818
+ if (typeof ruleId === 'undefined') {
48819
+ throw new AppwriteException('Missing required parameter: "ruleId"');
48820
+ }
48821
+ if (typeof resourceType === 'undefined') {
48822
+ throw new AppwriteException('Missing required parameter: "resourceType"');
49117
48823
  }
49118
48824
  if (typeof name === 'undefined') {
49119
48825
  throw new AppwriteException('Missing required parameter: "name"');
49120
48826
  }
49121
- if (typeof videoBitRate === 'undefined') {
49122
- throw new AppwriteException('Missing required parameter: "videoBitRate"');
49123
- }
49124
- if (typeof audioBitRate === 'undefined') {
49125
- throw new AppwriteException('Missing required parameter: "audioBitRate"');
48827
+ const apiPath = '/waf/rules/deny';
48828
+ const apiPayload = {};
48829
+ if (typeof ruleId !== 'undefined') {
48830
+ apiPayload['ruleId'] = ruleId;
49126
48831
  }
49127
- if (typeof width === 'undefined') {
49128
- throw new AppwriteException('Missing required parameter: "width"');
48832
+ if (typeof resourceType !== 'undefined') {
48833
+ apiPayload['resourceType'] = resourceType;
49129
48834
  }
49130
- if (typeof height === 'undefined') {
49131
- throw new AppwriteException('Missing required parameter: "height"');
48835
+ if (typeof resourceId !== 'undefined') {
48836
+ apiPayload['resourceId'] = resourceId;
49132
48837
  }
49133
- const apiPath = '/videos/profiles/{profileId}'.replace('{profileId}', encodeURIComponent(String(profileId)));
49134
- const apiPayload = {};
49135
48838
  if (typeof name !== 'undefined') {
49136
48839
  apiPayload['name'] = name;
49137
48840
  }
49138
- if (typeof videoBitRate !== 'undefined') {
49139
- apiPayload['videoBitRate'] = videoBitRate;
48841
+ if (typeof description !== 'undefined') {
48842
+ apiPayload['description'] = description;
49140
48843
  }
49141
- if (typeof audioBitRate !== 'undefined') {
49142
- apiPayload['audioBitRate'] = audioBitRate;
48844
+ if (typeof priority !== 'undefined') {
48845
+ apiPayload['priority'] = priority;
49143
48846
  }
49144
- if (typeof width !== 'undefined') {
49145
- apiPayload['width'] = width;
48847
+ if (typeof enabled !== 'undefined') {
48848
+ apiPayload['enabled'] = enabled;
49146
48849
  }
49147
- if (typeof height !== 'undefined') {
49148
- apiPayload['height'] = height;
48850
+ if (typeof conditions !== 'undefined') {
48851
+ apiPayload['conditions'] = conditions;
49149
48852
  }
49150
48853
  const uri = new URL(this.client.config.endpoint + apiPath);
49151
48854
  const apiHeaders = {
@@ -49153,9 +48856,9 @@
49153
48856
  'content-type': 'application/json',
49154
48857
  accept: 'application/json',
49155
48858
  };
49156
- return this.client.call('patch', uri, apiHeaders, apiPayload);
48859
+ return this.client.call('post', uri, apiHeaders, apiPayload);
49157
48860
  }
49158
- deleteProfile(paramsOrFirst) {
48861
+ updateDenyRule(paramsOrFirst, ...rest) {
49159
48862
  let params;
49160
48863
  if (paramsOrFirst &&
49161
48864
  typeof paramsOrFirst === 'object' &&
@@ -49164,49 +48867,59 @@
49164
48867
  }
49165
48868
  else {
49166
48869
  params = {
49167
- profileId: paramsOrFirst,
48870
+ ruleId: paramsOrFirst,
48871
+ resourceType: rest[0],
48872
+ resourceId: rest[1],
48873
+ name: rest[2],
48874
+ description: rest[3],
48875
+ priority: rest[4],
48876
+ enabled: rest[5],
48877
+ conditions: rest[6],
49168
48878
  };
49169
48879
  }
49170
- const profileId = params.profileId;
49171
- if (typeof profileId === 'undefined' || profileId === '') {
49172
- throw new AppwriteException('Missing required parameter: "profileId"');
48880
+ const ruleId = params.ruleId;
48881
+ const resourceType = params.resourceType;
48882
+ const resourceId = params.resourceId;
48883
+ const name = params.name;
48884
+ const description = params.description;
48885
+ const priority = params.priority;
48886
+ const enabled = params.enabled;
48887
+ const conditions = params.conditions;
48888
+ if (typeof ruleId === 'undefined' || ruleId === '') {
48889
+ throw new AppwriteException('Missing required parameter: "ruleId"');
49173
48890
  }
49174
- const apiPath = '/videos/profiles/{profileId}'.replace('{profileId}', encodeURIComponent(String(profileId)));
48891
+ const apiPath = '/waf/rules/deny/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
49175
48892
  const apiPayload = {};
49176
- const uri = new URL(this.client.config.endpoint + apiPath);
49177
- const apiHeaders = {
49178
- 'X-Appwrite-Project': this.client.config.project,
49179
- 'content-type': 'application/json',
49180
- accept: 'application/json',
49181
- };
49182
- return this.client.call('delete', uri, apiHeaders, apiPayload);
49183
- }
49184
- get(paramsOrFirst) {
49185
- let params;
49186
- if (paramsOrFirst &&
49187
- typeof paramsOrFirst === 'object' &&
49188
- !Array.isArray(paramsOrFirst)) {
49189
- params = (paramsOrFirst || {});
48893
+ if (typeof resourceType !== 'undefined') {
48894
+ apiPayload['resourceType'] = resourceType;
49190
48895
  }
49191
- else {
49192
- params = {
49193
- videoId: paramsOrFirst,
49194
- };
48896
+ if (typeof resourceId !== 'undefined') {
48897
+ apiPayload['resourceId'] = resourceId;
49195
48898
  }
49196
- const videoId = params.videoId;
49197
- if (typeof videoId === 'undefined' || videoId === '') {
49198
- throw new AppwriteException('Missing required parameter: "videoId"');
48899
+ if (typeof name !== 'undefined') {
48900
+ apiPayload['name'] = name;
48901
+ }
48902
+ if (typeof description !== 'undefined') {
48903
+ apiPayload['description'] = description;
48904
+ }
48905
+ if (typeof priority !== 'undefined') {
48906
+ apiPayload['priority'] = priority;
48907
+ }
48908
+ if (typeof enabled !== 'undefined') {
48909
+ apiPayload['enabled'] = enabled;
48910
+ }
48911
+ if (typeof conditions !== 'undefined') {
48912
+ apiPayload['conditions'] = conditions;
49199
48913
  }
49200
- const apiPath = '/videos/{videoId}'.replace('{videoId}', encodeURIComponent(String(videoId)));
49201
- const apiPayload = {};
49202
48914
  const uri = new URL(this.client.config.endpoint + apiPath);
49203
48915
  const apiHeaders = {
49204
48916
  'X-Appwrite-Project': this.client.config.project,
48917
+ 'content-type': 'application/json',
49205
48918
  accept: 'application/json',
49206
48919
  };
49207
- return this.client.call('get', uri, apiHeaders, apiPayload);
48920
+ return this.client.call('patch', uri, apiHeaders, apiPayload);
49208
48921
  }
49209
- update(paramsOrFirst, ...rest) {
48922
+ createRateLimitRule(paramsOrFirst, ...rest) {
49210
48923
  let params;
49211
48924
  if (paramsOrFirst &&
49212
48925
  typeof paramsOrFirst === 'object' &&
@@ -49215,58 +48928,99 @@
49215
48928
  }
49216
48929
  else {
49217
48930
  params = {
49218
- videoId: paramsOrFirst,
49219
- name: rest[0],
48931
+ ruleId: paramsOrFirst,
48932
+ resourceType: rest[0],
48933
+ name: rest[1],
48934
+ limit: rest[2],
48935
+ interval: rest[3],
48936
+ resourceId: rest[4],
48937
+ description: rest[5],
48938
+ key: rest[6],
48939
+ strategy: rest[7],
48940
+ maxBucketSize: rest[8],
48941
+ priority: rest[9],
48942
+ enabled: rest[10],
48943
+ conditions: rest[11],
49220
48944
  };
49221
48945
  }
49222
- const videoId = params.videoId;
48946
+ const ruleId = params.ruleId;
48947
+ const resourceType = params.resourceType;
49223
48948
  const name = params.name;
49224
- if (typeof videoId === 'undefined' || videoId === '') {
49225
- throw new AppwriteException('Missing required parameter: "videoId"');
48949
+ const limit = params.limit;
48950
+ const interval = params.interval;
48951
+ const resourceId = params.resourceId;
48952
+ const description = params.description;
48953
+ const key = params.key;
48954
+ const strategy = params.strategy;
48955
+ const maxBucketSize = params.maxBucketSize;
48956
+ const priority = params.priority;
48957
+ const enabled = params.enabled;
48958
+ const conditions = params.conditions;
48959
+ if (typeof ruleId === 'undefined') {
48960
+ throw new AppwriteException('Missing required parameter: "ruleId"');
48961
+ }
48962
+ if (typeof resourceType === 'undefined') {
48963
+ throw new AppwriteException('Missing required parameter: "resourceType"');
49226
48964
  }
49227
48965
  if (typeof name === 'undefined') {
49228
48966
  throw new AppwriteException('Missing required parameter: "name"');
49229
48967
  }
49230
- const apiPath = '/videos/{videoId}'.replace('{videoId}', encodeURIComponent(String(videoId)));
48968
+ if (typeof limit === 'undefined') {
48969
+ throw new AppwriteException('Missing required parameter: "limit"');
48970
+ }
48971
+ if (typeof interval === 'undefined') {
48972
+ throw new AppwriteException('Missing required parameter: "interval"');
48973
+ }
48974
+ const apiPath = '/waf/rules/rate-limit';
49231
48975
  const apiPayload = {};
48976
+ if (typeof ruleId !== 'undefined') {
48977
+ apiPayload['ruleId'] = ruleId;
48978
+ }
48979
+ if (typeof resourceType !== 'undefined') {
48980
+ apiPayload['resourceType'] = resourceType;
48981
+ }
48982
+ if (typeof resourceId !== 'undefined') {
48983
+ apiPayload['resourceId'] = resourceId;
48984
+ }
49232
48985
  if (typeof name !== 'undefined') {
49233
48986
  apiPayload['name'] = name;
49234
48987
  }
49235
- const uri = new URL(this.client.config.endpoint + apiPath);
49236
- const apiHeaders = {
49237
- 'X-Appwrite-Project': this.client.config.project,
49238
- 'content-type': 'application/json',
49239
- accept: 'application/json',
49240
- };
49241
- return this.client.call('put', uri, apiHeaders, apiPayload);
49242
- }
49243
- delete(paramsOrFirst) {
49244
- let params;
49245
- if (paramsOrFirst &&
49246
- typeof paramsOrFirst === 'object' &&
49247
- !Array.isArray(paramsOrFirst)) {
49248
- params = (paramsOrFirst || {});
48988
+ if (typeof description !== 'undefined') {
48989
+ apiPayload['description'] = description;
49249
48990
  }
49250
- else {
49251
- params = {
49252
- videoId: paramsOrFirst,
49253
- };
48991
+ if (typeof limit !== 'undefined') {
48992
+ apiPayload['limit'] = limit;
49254
48993
  }
49255
- const videoId = params.videoId;
49256
- if (typeof videoId === 'undefined' || videoId === '') {
49257
- throw new AppwriteException('Missing required parameter: "videoId"');
48994
+ if (typeof interval !== 'undefined') {
48995
+ apiPayload['interval'] = interval;
48996
+ }
48997
+ if (typeof key !== 'undefined') {
48998
+ apiPayload['key'] = key;
48999
+ }
49000
+ if (typeof strategy !== 'undefined') {
49001
+ apiPayload['strategy'] = strategy;
49002
+ }
49003
+ if (typeof maxBucketSize !== 'undefined') {
49004
+ apiPayload['maxBucketSize'] = maxBucketSize;
49005
+ }
49006
+ if (typeof priority !== 'undefined') {
49007
+ apiPayload['priority'] = priority;
49008
+ }
49009
+ if (typeof enabled !== 'undefined') {
49010
+ apiPayload['enabled'] = enabled;
49011
+ }
49012
+ if (typeof conditions !== 'undefined') {
49013
+ apiPayload['conditions'] = conditions;
49258
49014
  }
49259
- const apiPath = '/videos/{videoId}'.replace('{videoId}', encodeURIComponent(String(videoId)));
49260
- const apiPayload = {};
49261
49015
  const uri = new URL(this.client.config.endpoint + apiPath);
49262
49016
  const apiHeaders = {
49263
49017
  'X-Appwrite-Project': this.client.config.project,
49264
49018
  'content-type': 'application/json',
49265
49019
  accept: 'application/json',
49266
49020
  };
49267
- return this.client.call('delete', uri, apiHeaders, apiPayload);
49021
+ return this.client.call('post', uri, apiHeaders, apiPayload);
49268
49022
  }
49269
- getCmafHlsManifest(paramsOrFirst) {
49023
+ updateRateLimitRule(paramsOrFirst, ...rest) {
49270
49024
  let params;
49271
49025
  if (paramsOrFirst &&
49272
49026
  typeof paramsOrFirst === 'object' &&
@@ -49275,1359 +49029,36 @@
49275
49029
  }
49276
49030
  else {
49277
49031
  params = {
49278
- videoId: paramsOrFirst,
49032
+ ruleId: paramsOrFirst,
49033
+ resourceType: rest[0],
49034
+ resourceId: rest[1],
49035
+ name: rest[2],
49036
+ description: rest[3],
49037
+ limit: rest[4],
49038
+ interval: rest[5],
49039
+ key: rest[6],
49040
+ maxBucketSize: rest[7],
49041
+ priority: rest[8],
49042
+ enabled: rest[9],
49043
+ conditions: rest[10],
49279
49044
  };
49280
49045
  }
49281
- const videoId = params.videoId;
49282
- if (typeof videoId === 'undefined' || videoId === '') {
49283
- throw new AppwriteException('Missing required parameter: "videoId"');
49046
+ const ruleId = params.ruleId;
49047
+ const resourceType = params.resourceType;
49048
+ const resourceId = params.resourceId;
49049
+ const name = params.name;
49050
+ const description = params.description;
49051
+ const limit = params.limit;
49052
+ const interval = params.interval;
49053
+ const key = params.key;
49054
+ const maxBucketSize = params.maxBucketSize;
49055
+ const priority = params.priority;
49056
+ const enabled = params.enabled;
49057
+ const conditions = params.conditions;
49058
+ if (typeof ruleId === 'undefined' || ruleId === '') {
49059
+ throw new AppwriteException('Missing required parameter: "ruleId"');
49284
49060
  }
49285
- const apiPath = '/videos/{videoId}/outputs/cmaf/master.m3u8'.replace('{videoId}', encodeURIComponent(String(videoId)));
49286
- const apiPayload = {};
49287
- const uri = new URL(this.client.config.endpoint + apiPath);
49288
- apiPayload['project'] = this.client.config.project;
49289
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49290
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49291
- uri.searchParams.append(key, value);
49292
- }
49293
- return uri.toString();
49294
- }
49295
- getCmafDashManifest(paramsOrFirst) {
49296
- let params;
49297
- if (paramsOrFirst &&
49298
- typeof paramsOrFirst === 'object' &&
49299
- !Array.isArray(paramsOrFirst)) {
49300
- params = (paramsOrFirst || {});
49301
- }
49302
- else {
49303
- params = {
49304
- videoId: paramsOrFirst,
49305
- };
49306
- }
49307
- const videoId = params.videoId;
49308
- if (typeof videoId === 'undefined' || videoId === '') {
49309
- throw new AppwriteException('Missing required parameter: "videoId"');
49310
- }
49311
- const apiPath = '/videos/{videoId}/outputs/cmaf/master.mpd'.replace('{videoId}', encodeURIComponent(String(videoId)));
49312
- const apiPayload = {};
49313
- const uri = new URL(this.client.config.endpoint + apiPath);
49314
- apiPayload['project'] = this.client.config.project;
49315
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49316
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49317
- uri.searchParams.append(key, value);
49318
- }
49319
- return uri.toString();
49320
- }
49321
- getCmafStreamManifest(paramsOrFirst, ...rest) {
49322
- let params;
49323
- if (paramsOrFirst &&
49324
- typeof paramsOrFirst === 'object' &&
49325
- !Array.isArray(paramsOrFirst)) {
49326
- params = (paramsOrFirst || {});
49327
- }
49328
- else {
49329
- params = {
49330
- videoId: paramsOrFirst,
49331
- renditionId: rest[0],
49332
- streamId: rest[1],
49333
- };
49334
- }
49335
- const videoId = params.videoId;
49336
- const renditionId = params.renditionId;
49337
- const streamId = params.streamId;
49338
- if (typeof videoId === 'undefined' || videoId === '') {
49339
- throw new AppwriteException('Missing required parameter: "videoId"');
49340
- }
49341
- if (typeof renditionId === 'undefined' || renditionId === '') {
49342
- throw new AppwriteException('Missing required parameter: "renditionId"');
49343
- }
49344
- if (typeof streamId === 'undefined') {
49345
- throw new AppwriteException('Missing required parameter: "streamId"');
49346
- }
49347
- const apiPath = '/videos/{videoId}/outputs/cmaf/renditions/{renditionId}/streams/{streamId}/playlist.m3u8'
49348
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49349
- .replace('{renditionId}', encodeURIComponent(String(renditionId)))
49350
- .replace('{streamId}', encodeURIComponent(String(streamId)));
49351
- const apiPayload = {};
49352
- const uri = new URL(this.client.config.endpoint + apiPath);
49353
- apiPayload['project'] = this.client.config.project;
49354
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49355
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49356
- uri.searchParams.append(key, value);
49357
- }
49358
- return uri.toString();
49359
- }
49360
- getDashManifest(paramsOrFirst) {
49361
- let params;
49362
- if (paramsOrFirst &&
49363
- typeof paramsOrFirst === 'object' &&
49364
- !Array.isArray(paramsOrFirst)) {
49365
- params = (paramsOrFirst || {});
49366
- }
49367
- else {
49368
- params = {
49369
- videoId: paramsOrFirst,
49370
- };
49371
- }
49372
- const videoId = params.videoId;
49373
- if (typeof videoId === 'undefined' || videoId === '') {
49374
- throw new AppwriteException('Missing required parameter: "videoId"');
49375
- }
49376
- const apiPath = '/videos/{videoId}/outputs/dash/master.mpd'.replace('{videoId}', encodeURIComponent(String(videoId)));
49377
- const apiPayload = {};
49378
- const uri = new URL(this.client.config.endpoint + apiPath);
49379
- apiPayload['project'] = this.client.config.project;
49380
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49381
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49382
- uri.searchParams.append(key, value);
49383
- }
49384
- return uri.toString();
49385
- }
49386
- getHlsManifest(paramsOrFirst) {
49387
- let params;
49388
- if (paramsOrFirst &&
49389
- typeof paramsOrFirst === 'object' &&
49390
- !Array.isArray(paramsOrFirst)) {
49391
- params = (paramsOrFirst || {});
49392
- }
49393
- else {
49394
- params = {
49395
- videoId: paramsOrFirst,
49396
- };
49397
- }
49398
- const videoId = params.videoId;
49399
- if (typeof videoId === 'undefined' || videoId === '') {
49400
- throw new AppwriteException('Missing required parameter: "videoId"');
49401
- }
49402
- const apiPath = '/videos/{videoId}/outputs/hls/master.m3u8'.replace('{videoId}', encodeURIComponent(String(videoId)));
49403
- const apiPayload = {};
49404
- const uri = new URL(this.client.config.endpoint + apiPath);
49405
- apiPayload['project'] = this.client.config.project;
49406
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49407
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49408
- uri.searchParams.append(key, value);
49409
- }
49410
- return uri.toString();
49411
- }
49412
- getStreamManifest(paramsOrFirst, ...rest) {
49413
- let params;
49414
- if (paramsOrFirst &&
49415
- typeof paramsOrFirst === 'object' &&
49416
- !Array.isArray(paramsOrFirst)) {
49417
- params = (paramsOrFirst || {});
49418
- }
49419
- else {
49420
- params = {
49421
- videoId: paramsOrFirst,
49422
- renditionId: rest[0],
49423
- streamId: rest[1],
49424
- };
49425
- }
49426
- const videoId = params.videoId;
49427
- const renditionId = params.renditionId;
49428
- const streamId = params.streamId;
49429
- if (typeof videoId === 'undefined' || videoId === '') {
49430
- throw new AppwriteException('Missing required parameter: "videoId"');
49431
- }
49432
- if (typeof renditionId === 'undefined' || renditionId === '') {
49433
- throw new AppwriteException('Missing required parameter: "renditionId"');
49434
- }
49435
- if (typeof streamId === 'undefined') {
49436
- throw new AppwriteException('Missing required parameter: "streamId"');
49437
- }
49438
- const apiPath = '/videos/{videoId}/outputs/hls/renditions/{renditionId}/streams/{streamId}/playlist.m3u8'
49439
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49440
- .replace('{renditionId}', encodeURIComponent(String(renditionId)))
49441
- .replace('{streamId}', encodeURIComponent(String(streamId)));
49442
- const apiPayload = {};
49443
- const uri = new URL(this.client.config.endpoint + apiPath);
49444
- apiPayload['project'] = this.client.config.project;
49445
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49446
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49447
- uri.searchParams.append(key, value);
49448
- }
49449
- return uri.toString();
49450
- }
49451
- getSegment(paramsOrFirst, ...rest) {
49452
- let params;
49453
- if (paramsOrFirst &&
49454
- typeof paramsOrFirst === 'object' &&
49455
- !Array.isArray(paramsOrFirst)) {
49456
- params = (paramsOrFirst || {});
49457
- }
49458
- else {
49459
- params = {
49460
- videoId: paramsOrFirst,
49461
- output: rest[0],
49462
- renditionId: rest[1],
49463
- segmentId: rest[2],
49464
- };
49465
- }
49466
- const videoId = params.videoId;
49467
- const output = params.output;
49468
- const renditionId = params.renditionId;
49469
- const segmentId = params.segmentId;
49470
- if (typeof videoId === 'undefined' || videoId === '') {
49471
- throw new AppwriteException('Missing required parameter: "videoId"');
49472
- }
49473
- if (typeof output === 'undefined') {
49474
- throw new AppwriteException('Missing required parameter: "output"');
49475
- }
49476
- if (typeof renditionId === 'undefined' || renditionId === '') {
49477
- throw new AppwriteException('Missing required parameter: "renditionId"');
49478
- }
49479
- if (typeof segmentId === 'undefined' || segmentId === '') {
49480
- throw new AppwriteException('Missing required parameter: "segmentId"');
49481
- }
49482
- const apiPath = '/videos/{videoId}/outputs/{output}/renditions/{renditionId}/segments/{segmentId}'
49483
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49484
- .replace('{output}', encodeURIComponent(String(output)))
49485
- .replace('{renditionId}', encodeURIComponent(String(renditionId)))
49486
- .replace('{segmentId}', encodeURIComponent(String(segmentId)));
49487
- const apiPayload = {};
49488
- const uri = new URL(this.client.config.endpoint + apiPath);
49489
- apiPayload['project'] = this.client.config.project;
49490
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49491
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49492
- uri.searchParams.append(key, value);
49493
- }
49494
- return uri.toString();
49495
- }
49496
- getSubtitleManifest(paramsOrFirst, ...rest) {
49497
- let params;
49498
- if (paramsOrFirst &&
49499
- typeof paramsOrFirst === 'object' &&
49500
- !Array.isArray(paramsOrFirst)) {
49501
- params = (paramsOrFirst || {});
49502
- }
49503
- else {
49504
- params = {
49505
- videoId: paramsOrFirst,
49506
- output: rest[0],
49507
- subtitleId: rest[1],
49508
- };
49509
- }
49510
- const videoId = params.videoId;
49511
- const output = params.output;
49512
- const subtitleId = params.subtitleId;
49513
- if (typeof videoId === 'undefined' || videoId === '') {
49514
- throw new AppwriteException('Missing required parameter: "videoId"');
49515
- }
49516
- if (typeof output === 'undefined') {
49517
- throw new AppwriteException('Missing required parameter: "output"');
49518
- }
49519
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
49520
- throw new AppwriteException('Missing required parameter: "subtitleId"');
49521
- }
49522
- const apiPath = '/videos/{videoId}/outputs/{output}/subtitles/{subtitleId}/manifest'
49523
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49524
- .replace('{output}', encodeURIComponent(String(output)))
49525
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)));
49526
- const apiPayload = {};
49527
- const uri = new URL(this.client.config.endpoint + apiPath);
49528
- apiPayload['project'] = this.client.config.project;
49529
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49530
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49531
- uri.searchParams.append(key, value);
49532
- }
49533
- return uri.toString();
49534
- }
49535
- getSubtitleSegment(paramsOrFirst, ...rest) {
49536
- let params;
49537
- if (paramsOrFirst &&
49538
- typeof paramsOrFirst === 'object' &&
49539
- !Array.isArray(paramsOrFirst)) {
49540
- params = (paramsOrFirst || {});
49541
- }
49542
- else {
49543
- params = {
49544
- videoId: paramsOrFirst,
49545
- output: rest[0],
49546
- subtitleId: rest[1],
49547
- segmentId: rest[2],
49548
- };
49549
- }
49550
- const videoId = params.videoId;
49551
- const output = params.output;
49552
- const subtitleId = params.subtitleId;
49553
- const segmentId = params.segmentId;
49554
- if (typeof videoId === 'undefined' || videoId === '') {
49555
- throw new AppwriteException('Missing required parameter: "videoId"');
49556
- }
49557
- if (typeof output === 'undefined') {
49558
- throw new AppwriteException('Missing required parameter: "output"');
49559
- }
49560
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
49561
- throw new AppwriteException('Missing required parameter: "subtitleId"');
49562
- }
49563
- if (typeof segmentId === 'undefined' || segmentId === '') {
49564
- throw new AppwriteException('Missing required parameter: "segmentId"');
49565
- }
49566
- const apiPath = '/videos/{videoId}/outputs/{output}/subtitles/{subtitleId}/segments/{segmentId}'
49567
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49568
- .replace('{output}', encodeURIComponent(String(output)))
49569
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)))
49570
- .replace('{segmentId}', encodeURIComponent(String(segmentId)));
49571
- const apiPayload = {};
49572
- const uri = new URL(this.client.config.endpoint + apiPath);
49573
- apiPayload['project'] = this.client.config.project;
49574
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49575
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49576
- uri.searchParams.append(key, value);
49577
- }
49578
- return uri.toString();
49579
- }
49580
- getPreview(paramsOrFirst, ...rest) {
49581
- let params;
49582
- if (paramsOrFirst &&
49583
- typeof paramsOrFirst === 'object' &&
49584
- !Array.isArray(paramsOrFirst)) {
49585
- params = (paramsOrFirst || {});
49586
- }
49587
- else {
49588
- params = {
49589
- videoId: paramsOrFirst,
49590
- previewId: rest[0],
49591
- width: rest[1],
49592
- height: rest[2],
49593
- output: rest[3],
49594
- };
49595
- }
49596
- const videoId = params.videoId;
49597
- const previewId = params.previewId;
49598
- const width = params.width;
49599
- const height = params.height;
49600
- const output = params.output;
49601
- if (typeof videoId === 'undefined' || videoId === '') {
49602
- throw new AppwriteException('Missing required parameter: "videoId"');
49603
- }
49604
- if (typeof previewId === 'undefined' || previewId === '') {
49605
- throw new AppwriteException('Missing required parameter: "previewId"');
49606
- }
49607
- const apiPath = '/videos/{videoId}/previews/{previewId}'
49608
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49609
- .replace('{previewId}', encodeURIComponent(String(previewId)));
49610
- const apiPayload = {};
49611
- if (typeof width !== 'undefined') {
49612
- apiPayload['width'] = width;
49613
- }
49614
- if (typeof height !== 'undefined') {
49615
- apiPayload['height'] = height;
49616
- }
49617
- if (typeof output !== 'undefined') {
49618
- apiPayload['output'] = output;
49619
- }
49620
- const uri = new URL(this.client.config.endpoint + apiPath);
49621
- apiPayload['project'] = this.client.config.project;
49622
- apiPayload['impersonateuserid'] = this.client.config.impersonateuserid;
49623
- for (const [key, value] of Object.entries(Client.flatten(apiPayload))) {
49624
- uri.searchParams.append(key, value);
49625
- }
49626
- return uri.toString();
49627
- }
49628
- listRenditions(paramsOrFirst, ...rest) {
49629
- let params;
49630
- if (paramsOrFirst &&
49631
- typeof paramsOrFirst === 'object' &&
49632
- !Array.isArray(paramsOrFirst)) {
49633
- params = (paramsOrFirst || {});
49634
- }
49635
- else {
49636
- params = {
49637
- videoId: paramsOrFirst,
49638
- output: rest[0],
49639
- status: rest[1],
49640
- };
49641
- }
49642
- const videoId = params.videoId;
49643
- const output = params.output;
49644
- const status = params.status;
49645
- if (typeof videoId === 'undefined' || videoId === '') {
49646
- throw new AppwriteException('Missing required parameter: "videoId"');
49647
- }
49648
- const apiPath = '/videos/{videoId}/renditions'.replace('{videoId}', encodeURIComponent(String(videoId)));
49649
- const apiPayload = {};
49650
- if (typeof output !== 'undefined') {
49651
- apiPayload['output'] = output;
49652
- }
49653
- if (typeof status !== 'undefined') {
49654
- apiPayload['status'] = status;
49655
- }
49656
- const uri = new URL(this.client.config.endpoint + apiPath);
49657
- const apiHeaders = {
49658
- 'X-Appwrite-Project': this.client.config.project,
49659
- accept: 'application/json',
49660
- };
49661
- return this.client.call('get', uri, apiHeaders, apiPayload);
49662
- }
49663
- createRendition(paramsOrFirst, ...rest) {
49664
- let params;
49665
- if (paramsOrFirst &&
49666
- typeof paramsOrFirst === 'object' &&
49667
- !Array.isArray(paramsOrFirst)) {
49668
- params = (paramsOrFirst || {});
49669
- }
49670
- else {
49671
- params = {
49672
- videoId: paramsOrFirst,
49673
- profileId: rest[0],
49674
- output: rest[1],
49675
- };
49676
- }
49677
- const videoId = params.videoId;
49678
- const profileId = params.profileId;
49679
- const output = params.output;
49680
- if (typeof videoId === 'undefined' || videoId === '') {
49681
- throw new AppwriteException('Missing required parameter: "videoId"');
49682
- }
49683
- if (typeof profileId === 'undefined') {
49684
- throw new AppwriteException('Missing required parameter: "profileId"');
49685
- }
49686
- if (typeof output === 'undefined') {
49687
- throw new AppwriteException('Missing required parameter: "output"');
49688
- }
49689
- const apiPath = '/videos/{videoId}/renditions'.replace('{videoId}', encodeURIComponent(String(videoId)));
49690
- const apiPayload = {};
49691
- if (typeof profileId !== 'undefined') {
49692
- apiPayload['profileId'] = profileId;
49693
- }
49694
- if (typeof output !== 'undefined') {
49695
- apiPayload['output'] = output;
49696
- }
49697
- const uri = new URL(this.client.config.endpoint + apiPath);
49698
- const apiHeaders = {
49699
- 'X-Appwrite-Project': this.client.config.project,
49700
- 'content-type': 'application/json',
49701
- accept: 'application/json',
49702
- };
49703
- return this.client.call('post', uri, apiHeaders, apiPayload);
49704
- }
49705
- getRendition(paramsOrFirst, ...rest) {
49706
- let params;
49707
- if (paramsOrFirst &&
49708
- typeof paramsOrFirst === 'object' &&
49709
- !Array.isArray(paramsOrFirst)) {
49710
- params = (paramsOrFirst || {});
49711
- }
49712
- else {
49713
- params = {
49714
- videoId: paramsOrFirst,
49715
- renditionId: rest[0],
49716
- };
49717
- }
49718
- const videoId = params.videoId;
49719
- const renditionId = params.renditionId;
49720
- if (typeof videoId === 'undefined' || videoId === '') {
49721
- throw new AppwriteException('Missing required parameter: "videoId"');
49722
- }
49723
- if (typeof renditionId === 'undefined' || renditionId === '') {
49724
- throw new AppwriteException('Missing required parameter: "renditionId"');
49725
- }
49726
- const apiPath = '/videos/{videoId}/renditions/{renditionId}'
49727
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49728
- .replace('{renditionId}', encodeURIComponent(String(renditionId)));
49729
- const apiPayload = {};
49730
- const uri = new URL(this.client.config.endpoint + apiPath);
49731
- const apiHeaders = {
49732
- 'X-Appwrite-Project': this.client.config.project,
49733
- accept: 'application/json',
49734
- };
49735
- return this.client.call('get', uri, apiHeaders, apiPayload);
49736
- }
49737
- deleteRendition(paramsOrFirst, ...rest) {
49738
- let params;
49739
- if (paramsOrFirst &&
49740
- typeof paramsOrFirst === 'object' &&
49741
- !Array.isArray(paramsOrFirst)) {
49742
- params = (paramsOrFirst || {});
49743
- }
49744
- else {
49745
- params = {
49746
- videoId: paramsOrFirst,
49747
- renditionId: rest[0],
49748
- };
49749
- }
49750
- const videoId = params.videoId;
49751
- const renditionId = params.renditionId;
49752
- if (typeof videoId === 'undefined' || videoId === '') {
49753
- throw new AppwriteException('Missing required parameter: "videoId"');
49754
- }
49755
- if (typeof renditionId === 'undefined' || renditionId === '') {
49756
- throw new AppwriteException('Missing required parameter: "renditionId"');
49757
- }
49758
- const apiPath = '/videos/{videoId}/renditions/{renditionId}'
49759
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49760
- .replace('{renditionId}', encodeURIComponent(String(renditionId)));
49761
- const apiPayload = {};
49762
- const uri = new URL(this.client.config.endpoint + apiPath);
49763
- const apiHeaders = {
49764
- 'X-Appwrite-Project': this.client.config.project,
49765
- 'content-type': 'application/json',
49766
- accept: 'application/json',
49767
- };
49768
- return this.client.call('delete', uri, apiHeaders, apiPayload);
49769
- }
49770
- createSource(paramsOrFirst) {
49771
- let params;
49772
- if (paramsOrFirst &&
49773
- typeof paramsOrFirst === 'object' &&
49774
- !Array.isArray(paramsOrFirst)) {
49775
- params = (paramsOrFirst || {});
49776
- }
49777
- else {
49778
- params = {
49779
- videoId: paramsOrFirst,
49780
- };
49781
- }
49782
- const videoId = params.videoId;
49783
- if (typeof videoId === 'undefined' || videoId === '') {
49784
- throw new AppwriteException('Missing required parameter: "videoId"');
49785
- }
49786
- const apiPath = '/videos/{videoId}/source'.replace('{videoId}', encodeURIComponent(String(videoId)));
49787
- const apiPayload = {};
49788
- const uri = new URL(this.client.config.endpoint + apiPath);
49789
- const apiHeaders = {
49790
- 'X-Appwrite-Project': this.client.config.project,
49791
- 'content-type': 'application/json',
49792
- accept: 'application/json',
49793
- };
49794
- return this.client.call('post', uri, apiHeaders, apiPayload);
49795
- }
49796
- listSubtitles(paramsOrFirst) {
49797
- let params;
49798
- if (paramsOrFirst &&
49799
- typeof paramsOrFirst === 'object' &&
49800
- !Array.isArray(paramsOrFirst)) {
49801
- params = (paramsOrFirst || {});
49802
- }
49803
- else {
49804
- params = {
49805
- videoId: paramsOrFirst,
49806
- };
49807
- }
49808
- const videoId = params.videoId;
49809
- if (typeof videoId === 'undefined' || videoId === '') {
49810
- throw new AppwriteException('Missing required parameter: "videoId"');
49811
- }
49812
- const apiPath = '/videos/{videoId}/subtitles'.replace('{videoId}', encodeURIComponent(String(videoId)));
49813
- const apiPayload = {};
49814
- const uri = new URL(this.client.config.endpoint + apiPath);
49815
- const apiHeaders = {
49816
- 'X-Appwrite-Project': this.client.config.project,
49817
- accept: 'application/json',
49818
- };
49819
- return this.client.call('get', uri, apiHeaders, apiPayload);
49820
- }
49821
- createSubtitle(paramsOrFirst, ...rest) {
49822
- let params;
49823
- if (paramsOrFirst &&
49824
- typeof paramsOrFirst === 'object' &&
49825
- !Array.isArray(paramsOrFirst)) {
49826
- params = (paramsOrFirst || {});
49827
- }
49828
- else {
49829
- params = {
49830
- videoId: paramsOrFirst,
49831
- bucketId: rest[0],
49832
- fileId: rest[1],
49833
- name: rest[2],
49834
- code: rest[3],
49835
- xdefault: rest[4],
49836
- };
49837
- }
49838
- const videoId = params.videoId;
49839
- const bucketId = params.bucketId;
49840
- const fileId = params.fileId;
49841
- const name = params.name;
49842
- const code = params.code;
49843
- const xdefault = params.xdefault;
49844
- if (typeof videoId === 'undefined' || videoId === '') {
49845
- throw new AppwriteException('Missing required parameter: "videoId"');
49846
- }
49847
- if (typeof bucketId === 'undefined') {
49848
- throw new AppwriteException('Missing required parameter: "bucketId"');
49849
- }
49850
- if (typeof fileId === 'undefined') {
49851
- throw new AppwriteException('Missing required parameter: "fileId"');
49852
- }
49853
- if (typeof name === 'undefined') {
49854
- throw new AppwriteException('Missing required parameter: "name"');
49855
- }
49856
- if (typeof code === 'undefined') {
49857
- throw new AppwriteException('Missing required parameter: "code"');
49858
- }
49859
- const apiPath = '/videos/{videoId}/subtitles'.replace('{videoId}', encodeURIComponent(String(videoId)));
49860
- const apiPayload = {};
49861
- if (typeof bucketId !== 'undefined') {
49862
- apiPayload['bucketId'] = bucketId;
49863
- }
49864
- if (typeof fileId !== 'undefined') {
49865
- apiPayload['fileId'] = fileId;
49866
- }
49867
- if (typeof name !== 'undefined') {
49868
- apiPayload['name'] = name;
49869
- }
49870
- if (typeof code !== 'undefined') {
49871
- apiPayload['code'] = code;
49872
- }
49873
- if (typeof xdefault !== 'undefined') {
49874
- apiPayload['default'] = xdefault;
49875
- }
49876
- const uri = new URL(this.client.config.endpoint + apiPath);
49877
- const apiHeaders = {
49878
- 'X-Appwrite-Project': this.client.config.project,
49879
- 'content-type': 'application/json',
49880
- accept: 'application/json',
49881
- };
49882
- return this.client.call('post', uri, apiHeaders, apiPayload);
49883
- }
49884
- updateSubtitle(paramsOrFirst, ...rest) {
49885
- let params;
49886
- if (paramsOrFirst &&
49887
- typeof paramsOrFirst === 'object' &&
49888
- !Array.isArray(paramsOrFirst)) {
49889
- params = (paramsOrFirst || {});
49890
- }
49891
- else {
49892
- params = {
49893
- videoId: paramsOrFirst,
49894
- subtitleId: rest[0],
49895
- bucketId: rest[1],
49896
- fileId: rest[2],
49897
- name: rest[3],
49898
- code: rest[4],
49899
- xdefault: rest[5],
49900
- };
49901
- }
49902
- const videoId = params.videoId;
49903
- const subtitleId = params.subtitleId;
49904
- const bucketId = params.bucketId;
49905
- const fileId = params.fileId;
49906
- const name = params.name;
49907
- const code = params.code;
49908
- const xdefault = params.xdefault;
49909
- if (typeof videoId === 'undefined' || videoId === '') {
49910
- throw new AppwriteException('Missing required parameter: "videoId"');
49911
- }
49912
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
49913
- throw new AppwriteException('Missing required parameter: "subtitleId"');
49914
- }
49915
- const apiPath = '/videos/{videoId}/subtitles/{subtitleId}'
49916
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49917
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)));
49918
- const apiPayload = {};
49919
- if (typeof bucketId !== 'undefined') {
49920
- apiPayload['bucketId'] = bucketId;
49921
- }
49922
- if (typeof fileId !== 'undefined') {
49923
- apiPayload['fileId'] = fileId;
49924
- }
49925
- if (typeof name !== 'undefined') {
49926
- apiPayload['name'] = name;
49927
- }
49928
- if (typeof code !== 'undefined') {
49929
- apiPayload['code'] = code;
49930
- }
49931
- if (typeof xdefault !== 'undefined') {
49932
- apiPayload['default'] = xdefault;
49933
- }
49934
- const uri = new URL(this.client.config.endpoint + apiPath);
49935
- const apiHeaders = {
49936
- 'X-Appwrite-Project': this.client.config.project,
49937
- 'content-type': 'application/json',
49938
- accept: 'application/json',
49939
- };
49940
- return this.client.call('patch', uri, apiHeaders, apiPayload);
49941
- }
49942
- deleteSubtitle(paramsOrFirst, ...rest) {
49943
- let params;
49944
- if (paramsOrFirst &&
49945
- typeof paramsOrFirst === 'object' &&
49946
- !Array.isArray(paramsOrFirst)) {
49947
- params = (paramsOrFirst || {});
49948
- }
49949
- else {
49950
- params = {
49951
- videoId: paramsOrFirst,
49952
- subtitleId: rest[0],
49953
- };
49954
- }
49955
- const videoId = params.videoId;
49956
- const subtitleId = params.subtitleId;
49957
- if (typeof videoId === 'undefined' || videoId === '') {
49958
- throw new AppwriteException('Missing required parameter: "videoId"');
49959
- }
49960
- if (typeof subtitleId === 'undefined' || subtitleId === '') {
49961
- throw new AppwriteException('Missing required parameter: "subtitleId"');
49962
- }
49963
- const apiPath = '/videos/{videoId}/subtitles/{subtitleId}'
49964
- .replace('{videoId}', encodeURIComponent(String(videoId)))
49965
- .replace('{subtitleId}', encodeURIComponent(String(subtitleId)));
49966
- const apiPayload = {};
49967
- const uri = new URL(this.client.config.endpoint + apiPath);
49968
- const apiHeaders = {
49969
- 'X-Appwrite-Project': this.client.config.project,
49970
- 'content-type': 'application/json',
49971
- accept: 'application/json',
49972
- };
49973
- return this.client.call('delete', uri, apiHeaders, apiPayload);
49974
- }
49975
- getTimeline(paramsOrFirst) {
49976
- let params;
49977
- if (paramsOrFirst &&
49978
- typeof paramsOrFirst === 'object' &&
49979
- !Array.isArray(paramsOrFirst)) {
49980
- params = (paramsOrFirst || {});
49981
- }
49982
- else {
49983
- params = {
49984
- videoId: paramsOrFirst,
49985
- };
49986
- }
49987
- const videoId = params.videoId;
49988
- if (typeof videoId === 'undefined' || videoId === '') {
49989
- throw new AppwriteException('Missing required parameter: "videoId"');
49990
- }
49991
- const apiPath = '/videos/{videoId}/timeline'.replace('{videoId}', encodeURIComponent(String(videoId)));
49992
- const apiPayload = {};
49993
- const uri = new URL(this.client.config.endpoint + apiPath);
49994
- const apiHeaders = {
49995
- 'X-Appwrite-Project': this.client.config.project,
49996
- accept: 'text/plain',
49997
- };
49998
- return this.client.call('get', uri, apiHeaders, apiPayload, 'text');
49999
- }
50000
- createTimeline(paramsOrFirst) {
50001
- let params;
50002
- if (paramsOrFirst &&
50003
- typeof paramsOrFirst === 'object' &&
50004
- !Array.isArray(paramsOrFirst)) {
50005
- params = (paramsOrFirst || {});
50006
- }
50007
- else {
50008
- params = {
50009
- videoId: paramsOrFirst,
50010
- };
50011
- }
50012
- const videoId = params.videoId;
50013
- if (typeof videoId === 'undefined' || videoId === '') {
50014
- throw new AppwriteException('Missing required parameter: "videoId"');
50015
- }
50016
- const apiPath = '/videos/{videoId}/timeline'.replace('{videoId}', encodeURIComponent(String(videoId)));
50017
- const apiPayload = {};
50018
- const uri = new URL(this.client.config.endpoint + apiPath);
50019
- const apiHeaders = {
50020
- 'X-Appwrite-Project': this.client.config.project,
50021
- 'content-type': 'application/json',
50022
- accept: 'application/json',
50023
- };
50024
- return this.client.call('post', uri, apiHeaders, apiPayload);
50025
- }
50026
- }
50027
-
50028
- class Waf {
50029
- constructor(client) {
50030
- this.client = client;
50031
- }
50032
- listRules(paramsOrFirst, ...rest) {
50033
- let params;
50034
- if ((typeof paramsOrFirst === 'undefined' && rest.length === 0) ||
50035
- (paramsOrFirst &&
50036
- typeof paramsOrFirst === 'object' &&
50037
- !Array.isArray(paramsOrFirst))) {
50038
- params = (paramsOrFirst || {});
50039
- }
50040
- else {
50041
- params = {
50042
- queries: paramsOrFirst,
50043
- search: rest[0],
50044
- total: rest[1],
50045
- };
50046
- }
50047
- const queries = params.queries;
50048
- const search = params.search;
50049
- const total = params.total;
50050
- const apiPath = '/waf/rules';
50051
- const apiPayload = {};
50052
- if (typeof queries !== 'undefined') {
50053
- apiPayload['queries'] = queries;
50054
- }
50055
- if (typeof search !== 'undefined') {
50056
- apiPayload['search'] = search;
50057
- }
50058
- if (typeof total !== 'undefined') {
50059
- apiPayload['total'] = total;
50060
- }
50061
- const uri = new URL(this.client.config.endpoint + apiPath);
50062
- const apiHeaders = {
50063
- 'X-Appwrite-Project': this.client.config.project,
50064
- accept: 'application/json',
50065
- };
50066
- return this.client.call('get', uri, apiHeaders, apiPayload);
50067
- }
50068
- createBypassRule(paramsOrFirst, ...rest) {
50069
- let params;
50070
- if (paramsOrFirst &&
50071
- typeof paramsOrFirst === 'object' &&
50072
- !Array.isArray(paramsOrFirst)) {
50073
- params = (paramsOrFirst || {});
50074
- }
50075
- else {
50076
- params = {
50077
- ruleId: paramsOrFirst,
50078
- resourceType: rest[0],
50079
- name: rest[1],
50080
- resourceId: rest[2],
50081
- description: rest[3],
50082
- priority: rest[4],
50083
- enabled: rest[5],
50084
- conditions: rest[6],
50085
- };
50086
- }
50087
- const ruleId = params.ruleId;
50088
- const resourceType = params.resourceType;
50089
- const name = params.name;
50090
- const resourceId = params.resourceId;
50091
- const description = params.description;
50092
- const priority = params.priority;
50093
- const enabled = params.enabled;
50094
- const conditions = params.conditions;
50095
- if (typeof ruleId === 'undefined') {
50096
- throw new AppwriteException('Missing required parameter: "ruleId"');
50097
- }
50098
- if (typeof resourceType === 'undefined') {
50099
- throw new AppwriteException('Missing required parameter: "resourceType"');
50100
- }
50101
- if (typeof name === 'undefined') {
50102
- throw new AppwriteException('Missing required parameter: "name"');
50103
- }
50104
- const apiPath = '/waf/rules/bypass';
50105
- const apiPayload = {};
50106
- if (typeof ruleId !== 'undefined') {
50107
- apiPayload['ruleId'] = ruleId;
50108
- }
50109
- if (typeof resourceType !== 'undefined') {
50110
- apiPayload['resourceType'] = resourceType;
50111
- }
50112
- if (typeof resourceId !== 'undefined') {
50113
- apiPayload['resourceId'] = resourceId;
50114
- }
50115
- if (typeof name !== 'undefined') {
50116
- apiPayload['name'] = name;
50117
- }
50118
- if (typeof description !== 'undefined') {
50119
- apiPayload['description'] = description;
50120
- }
50121
- if (typeof priority !== 'undefined') {
50122
- apiPayload['priority'] = priority;
50123
- }
50124
- if (typeof enabled !== 'undefined') {
50125
- apiPayload['enabled'] = enabled;
50126
- }
50127
- if (typeof conditions !== 'undefined') {
50128
- apiPayload['conditions'] = conditions;
50129
- }
50130
- const uri = new URL(this.client.config.endpoint + apiPath);
50131
- const apiHeaders = {
50132
- 'X-Appwrite-Project': this.client.config.project,
50133
- 'content-type': 'application/json',
50134
- accept: 'application/json',
50135
- };
50136
- return this.client.call('post', uri, apiHeaders, apiPayload);
50137
- }
50138
- updateBypassRule(paramsOrFirst, ...rest) {
50139
- let params;
50140
- if (paramsOrFirst &&
50141
- typeof paramsOrFirst === 'object' &&
50142
- !Array.isArray(paramsOrFirst)) {
50143
- params = (paramsOrFirst || {});
50144
- }
50145
- else {
50146
- params = {
50147
- ruleId: paramsOrFirst,
50148
- resourceType: rest[0],
50149
- resourceId: rest[1],
50150
- name: rest[2],
50151
- description: rest[3],
50152
- priority: rest[4],
50153
- enabled: rest[5],
50154
- conditions: rest[6],
50155
- };
50156
- }
50157
- const ruleId = params.ruleId;
50158
- const resourceType = params.resourceType;
50159
- const resourceId = params.resourceId;
50160
- const name = params.name;
50161
- const description = params.description;
50162
- const priority = params.priority;
50163
- const enabled = params.enabled;
50164
- const conditions = params.conditions;
50165
- if (typeof ruleId === 'undefined' || ruleId === '') {
50166
- throw new AppwriteException('Missing required parameter: "ruleId"');
50167
- }
50168
- const apiPath = '/waf/rules/bypass/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
50169
- const apiPayload = {};
50170
- if (typeof resourceType !== 'undefined') {
50171
- apiPayload['resourceType'] = resourceType;
50172
- }
50173
- if (typeof resourceId !== 'undefined') {
50174
- apiPayload['resourceId'] = resourceId;
50175
- }
50176
- if (typeof name !== 'undefined') {
50177
- apiPayload['name'] = name;
50178
- }
50179
- if (typeof description !== 'undefined') {
50180
- apiPayload['description'] = description;
50181
- }
50182
- if (typeof priority !== 'undefined') {
50183
- apiPayload['priority'] = priority;
50184
- }
50185
- if (typeof enabled !== 'undefined') {
50186
- apiPayload['enabled'] = enabled;
50187
- }
50188
- if (typeof conditions !== 'undefined') {
50189
- apiPayload['conditions'] = conditions;
50190
- }
50191
- const uri = new URL(this.client.config.endpoint + apiPath);
50192
- const apiHeaders = {
50193
- 'X-Appwrite-Project': this.client.config.project,
50194
- 'content-type': 'application/json',
50195
- accept: 'application/json',
50196
- };
50197
- return this.client.call('patch', uri, apiHeaders, apiPayload);
50198
- }
50199
- createChallengeRule(paramsOrFirst, ...rest) {
50200
- let params;
50201
- if (paramsOrFirst &&
50202
- typeof paramsOrFirst === 'object' &&
50203
- !Array.isArray(paramsOrFirst)) {
50204
- params = (paramsOrFirst || {});
50205
- }
50206
- else {
50207
- params = {
50208
- ruleId: paramsOrFirst,
50209
- resourceType: rest[0],
50210
- name: rest[1],
50211
- resourceId: rest[2],
50212
- description: rest[3],
50213
- challengeType: rest[4],
50214
- priority: rest[5],
50215
- enabled: rest[6],
50216
- conditions: rest[7],
50217
- difficulty: rest[8],
50218
- ttl: rest[9],
50219
- };
50220
- }
50221
- const ruleId = params.ruleId;
50222
- const resourceType = params.resourceType;
50223
- const name = params.name;
50224
- const resourceId = params.resourceId;
50225
- const description = params.description;
50226
- const challengeType = params.challengeType;
50227
- const priority = params.priority;
50228
- const enabled = params.enabled;
50229
- const conditions = params.conditions;
50230
- const difficulty = params.difficulty;
50231
- const ttl = params.ttl;
50232
- if (typeof ruleId === 'undefined') {
50233
- throw new AppwriteException('Missing required parameter: "ruleId"');
50234
- }
50235
- if (typeof resourceType === 'undefined') {
50236
- throw new AppwriteException('Missing required parameter: "resourceType"');
50237
- }
50238
- if (typeof name === 'undefined') {
50239
- throw new AppwriteException('Missing required parameter: "name"');
50240
- }
50241
- const apiPath = '/waf/rules/challenge';
50242
- const apiPayload = {};
50243
- if (typeof ruleId !== 'undefined') {
50244
- apiPayload['ruleId'] = ruleId;
50245
- }
50246
- if (typeof resourceType !== 'undefined') {
50247
- apiPayload['resourceType'] = resourceType;
50248
- }
50249
- if (typeof resourceId !== 'undefined') {
50250
- apiPayload['resourceId'] = resourceId;
50251
- }
50252
- if (typeof name !== 'undefined') {
50253
- apiPayload['name'] = name;
50254
- }
50255
- if (typeof description !== 'undefined') {
50256
- apiPayload['description'] = description;
50257
- }
50258
- if (typeof challengeType !== 'undefined') {
50259
- apiPayload['challengeType'] = challengeType;
50260
- }
50261
- if (typeof priority !== 'undefined') {
50262
- apiPayload['priority'] = priority;
50263
- }
50264
- if (typeof enabled !== 'undefined') {
50265
- apiPayload['enabled'] = enabled;
50266
- }
50267
- if (typeof conditions !== 'undefined') {
50268
- apiPayload['conditions'] = conditions;
50269
- }
50270
- if (typeof difficulty !== 'undefined') {
50271
- apiPayload['difficulty'] = difficulty;
50272
- }
50273
- if (typeof ttl !== 'undefined') {
50274
- apiPayload['ttl'] = ttl;
50275
- }
50276
- const uri = new URL(this.client.config.endpoint + apiPath);
50277
- const apiHeaders = {
50278
- 'X-Appwrite-Project': this.client.config.project,
50279
- 'content-type': 'application/json',
50280
- accept: 'application/json',
50281
- };
50282
- return this.client.call('post', uri, apiHeaders, apiPayload);
50283
- }
50284
- updateChallengeRule(paramsOrFirst, ...rest) {
50285
- let params;
50286
- if (paramsOrFirst &&
50287
- typeof paramsOrFirst === 'object' &&
50288
- !Array.isArray(paramsOrFirst)) {
50289
- params = (paramsOrFirst || {});
50290
- }
50291
- else {
50292
- params = {
50293
- ruleId: paramsOrFirst,
50294
- resourceType: rest[0],
50295
- resourceId: rest[1],
50296
- name: rest[2],
50297
- description: rest[3],
50298
- challengeType: rest[4],
50299
- priority: rest[5],
50300
- enabled: rest[6],
50301
- conditions: rest[7],
50302
- difficulty: rest[8],
50303
- ttl: rest[9],
50304
- };
50305
- }
50306
- const ruleId = params.ruleId;
50307
- const resourceType = params.resourceType;
50308
- const resourceId = params.resourceId;
50309
- const name = params.name;
50310
- const description = params.description;
50311
- const challengeType = params.challengeType;
50312
- const priority = params.priority;
50313
- const enabled = params.enabled;
50314
- const conditions = params.conditions;
50315
- const difficulty = params.difficulty;
50316
- const ttl = params.ttl;
50317
- if (typeof ruleId === 'undefined' || ruleId === '') {
50318
- throw new AppwriteException('Missing required parameter: "ruleId"');
50319
- }
50320
- const apiPath = '/waf/rules/challenge/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
50321
- const apiPayload = {};
50322
- if (typeof resourceType !== 'undefined') {
50323
- apiPayload['resourceType'] = resourceType;
50324
- }
50325
- if (typeof resourceId !== 'undefined') {
50326
- apiPayload['resourceId'] = resourceId;
50327
- }
50328
- if (typeof name !== 'undefined') {
50329
- apiPayload['name'] = name;
50330
- }
50331
- if (typeof description !== 'undefined') {
50332
- apiPayload['description'] = description;
50333
- }
50334
- if (typeof challengeType !== 'undefined') {
50335
- apiPayload['challengeType'] = challengeType;
50336
- }
50337
- if (typeof priority !== 'undefined') {
50338
- apiPayload['priority'] = priority;
50339
- }
50340
- if (typeof enabled !== 'undefined') {
50341
- apiPayload['enabled'] = enabled;
50342
- }
50343
- if (typeof conditions !== 'undefined') {
50344
- apiPayload['conditions'] = conditions;
50345
- }
50346
- if (typeof difficulty !== 'undefined') {
50347
- apiPayload['difficulty'] = difficulty;
50348
- }
50349
- if (typeof ttl !== 'undefined') {
50350
- apiPayload['ttl'] = ttl;
50351
- }
50352
- const uri = new URL(this.client.config.endpoint + apiPath);
50353
- const apiHeaders = {
50354
- 'X-Appwrite-Project': this.client.config.project,
50355
- 'content-type': 'application/json',
50356
- accept: 'application/json',
50357
- };
50358
- return this.client.call('patch', uri, apiHeaders, apiPayload);
50359
- }
50360
- createDenyRule(paramsOrFirst, ...rest) {
50361
- let params;
50362
- if (paramsOrFirst &&
50363
- typeof paramsOrFirst === 'object' &&
50364
- !Array.isArray(paramsOrFirst)) {
50365
- params = (paramsOrFirst || {});
50366
- }
50367
- else {
50368
- params = {
50369
- ruleId: paramsOrFirst,
50370
- resourceType: rest[0],
50371
- name: rest[1],
50372
- resourceId: rest[2],
50373
- description: rest[3],
50374
- priority: rest[4],
50375
- enabled: rest[5],
50376
- conditions: rest[6],
50377
- };
50378
- }
50379
- const ruleId = params.ruleId;
50380
- const resourceType = params.resourceType;
50381
- const name = params.name;
50382
- const resourceId = params.resourceId;
50383
- const description = params.description;
50384
- const priority = params.priority;
50385
- const enabled = params.enabled;
50386
- const conditions = params.conditions;
50387
- if (typeof ruleId === 'undefined') {
50388
- throw new AppwriteException('Missing required parameter: "ruleId"');
50389
- }
50390
- if (typeof resourceType === 'undefined') {
50391
- throw new AppwriteException('Missing required parameter: "resourceType"');
50392
- }
50393
- if (typeof name === 'undefined') {
50394
- throw new AppwriteException('Missing required parameter: "name"');
50395
- }
50396
- const apiPath = '/waf/rules/deny';
50397
- const apiPayload = {};
50398
- if (typeof ruleId !== 'undefined') {
50399
- apiPayload['ruleId'] = ruleId;
50400
- }
50401
- if (typeof resourceType !== 'undefined') {
50402
- apiPayload['resourceType'] = resourceType;
50403
- }
50404
- if (typeof resourceId !== 'undefined') {
50405
- apiPayload['resourceId'] = resourceId;
50406
- }
50407
- if (typeof name !== 'undefined') {
50408
- apiPayload['name'] = name;
50409
- }
50410
- if (typeof description !== 'undefined') {
50411
- apiPayload['description'] = description;
50412
- }
50413
- if (typeof priority !== 'undefined') {
50414
- apiPayload['priority'] = priority;
50415
- }
50416
- if (typeof enabled !== 'undefined') {
50417
- apiPayload['enabled'] = enabled;
50418
- }
50419
- if (typeof conditions !== 'undefined') {
50420
- apiPayload['conditions'] = conditions;
50421
- }
50422
- const uri = new URL(this.client.config.endpoint + apiPath);
50423
- const apiHeaders = {
50424
- 'X-Appwrite-Project': this.client.config.project,
50425
- 'content-type': 'application/json',
50426
- accept: 'application/json',
50427
- };
50428
- return this.client.call('post', uri, apiHeaders, apiPayload);
50429
- }
50430
- updateDenyRule(paramsOrFirst, ...rest) {
50431
- let params;
50432
- if (paramsOrFirst &&
50433
- typeof paramsOrFirst === 'object' &&
50434
- !Array.isArray(paramsOrFirst)) {
50435
- params = (paramsOrFirst || {});
50436
- }
50437
- else {
50438
- params = {
50439
- ruleId: paramsOrFirst,
50440
- resourceType: rest[0],
50441
- resourceId: rest[1],
50442
- name: rest[2],
50443
- description: rest[3],
50444
- priority: rest[4],
50445
- enabled: rest[5],
50446
- conditions: rest[6],
50447
- };
50448
- }
50449
- const ruleId = params.ruleId;
50450
- const resourceType = params.resourceType;
50451
- const resourceId = params.resourceId;
50452
- const name = params.name;
50453
- const description = params.description;
50454
- const priority = params.priority;
50455
- const enabled = params.enabled;
50456
- const conditions = params.conditions;
50457
- if (typeof ruleId === 'undefined' || ruleId === '') {
50458
- throw new AppwriteException('Missing required parameter: "ruleId"');
50459
- }
50460
- const apiPath = '/waf/rules/deny/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
50461
- const apiPayload = {};
50462
- if (typeof resourceType !== 'undefined') {
50463
- apiPayload['resourceType'] = resourceType;
50464
- }
50465
- if (typeof resourceId !== 'undefined') {
50466
- apiPayload['resourceId'] = resourceId;
50467
- }
50468
- if (typeof name !== 'undefined') {
50469
- apiPayload['name'] = name;
50470
- }
50471
- if (typeof description !== 'undefined') {
50472
- apiPayload['description'] = description;
50473
- }
50474
- if (typeof priority !== 'undefined') {
50475
- apiPayload['priority'] = priority;
50476
- }
50477
- if (typeof enabled !== 'undefined') {
50478
- apiPayload['enabled'] = enabled;
50479
- }
50480
- if (typeof conditions !== 'undefined') {
50481
- apiPayload['conditions'] = conditions;
50482
- }
50483
- const uri = new URL(this.client.config.endpoint + apiPath);
50484
- const apiHeaders = {
50485
- 'X-Appwrite-Project': this.client.config.project,
50486
- 'content-type': 'application/json',
50487
- accept: 'application/json',
50488
- };
50489
- return this.client.call('patch', uri, apiHeaders, apiPayload);
50490
- }
50491
- createRateLimitRule(paramsOrFirst, ...rest) {
50492
- let params;
50493
- if (paramsOrFirst &&
50494
- typeof paramsOrFirst === 'object' &&
50495
- !Array.isArray(paramsOrFirst)) {
50496
- params = (paramsOrFirst || {});
50497
- }
50498
- else {
50499
- params = {
50500
- ruleId: paramsOrFirst,
50501
- resourceType: rest[0],
50502
- name: rest[1],
50503
- limit: rest[2],
50504
- interval: rest[3],
50505
- resourceId: rest[4],
50506
- description: rest[5],
50507
- key: rest[6],
50508
- strategy: rest[7],
50509
- maxBucketSize: rest[8],
50510
- priority: rest[9],
50511
- enabled: rest[10],
50512
- conditions: rest[11],
50513
- };
50514
- }
50515
- const ruleId = params.ruleId;
50516
- const resourceType = params.resourceType;
50517
- const name = params.name;
50518
- const limit = params.limit;
50519
- const interval = params.interval;
50520
- const resourceId = params.resourceId;
50521
- const description = params.description;
50522
- const key = params.key;
50523
- const strategy = params.strategy;
50524
- const maxBucketSize = params.maxBucketSize;
50525
- const priority = params.priority;
50526
- const enabled = params.enabled;
50527
- const conditions = params.conditions;
50528
- if (typeof ruleId === 'undefined') {
50529
- throw new AppwriteException('Missing required parameter: "ruleId"');
50530
- }
50531
- if (typeof resourceType === 'undefined') {
50532
- throw new AppwriteException('Missing required parameter: "resourceType"');
50533
- }
50534
- if (typeof name === 'undefined') {
50535
- throw new AppwriteException('Missing required parameter: "name"');
50536
- }
50537
- if (typeof limit === 'undefined') {
50538
- throw new AppwriteException('Missing required parameter: "limit"');
50539
- }
50540
- if (typeof interval === 'undefined') {
50541
- throw new AppwriteException('Missing required parameter: "interval"');
50542
- }
50543
- const apiPath = '/waf/rules/rate-limit';
50544
- const apiPayload = {};
50545
- if (typeof ruleId !== 'undefined') {
50546
- apiPayload['ruleId'] = ruleId;
50547
- }
50548
- if (typeof resourceType !== 'undefined') {
50549
- apiPayload['resourceType'] = resourceType;
50550
- }
50551
- if (typeof resourceId !== 'undefined') {
50552
- apiPayload['resourceId'] = resourceId;
50553
- }
50554
- if (typeof name !== 'undefined') {
50555
- apiPayload['name'] = name;
50556
- }
50557
- if (typeof description !== 'undefined') {
50558
- apiPayload['description'] = description;
50559
- }
50560
- if (typeof limit !== 'undefined') {
50561
- apiPayload['limit'] = limit;
50562
- }
50563
- if (typeof interval !== 'undefined') {
50564
- apiPayload['interval'] = interval;
50565
- }
50566
- if (typeof key !== 'undefined') {
50567
- apiPayload['key'] = key;
50568
- }
50569
- if (typeof strategy !== 'undefined') {
50570
- apiPayload['strategy'] = strategy;
50571
- }
50572
- if (typeof maxBucketSize !== 'undefined') {
50573
- apiPayload['maxBucketSize'] = maxBucketSize;
50574
- }
50575
- if (typeof priority !== 'undefined') {
50576
- apiPayload['priority'] = priority;
50577
- }
50578
- if (typeof enabled !== 'undefined') {
50579
- apiPayload['enabled'] = enabled;
50580
- }
50581
- if (typeof conditions !== 'undefined') {
50582
- apiPayload['conditions'] = conditions;
50583
- }
50584
- const uri = new URL(this.client.config.endpoint + apiPath);
50585
- const apiHeaders = {
50586
- 'X-Appwrite-Project': this.client.config.project,
50587
- 'content-type': 'application/json',
50588
- accept: 'application/json',
50589
- };
50590
- return this.client.call('post', uri, apiHeaders, apiPayload);
50591
- }
50592
- updateRateLimitRule(paramsOrFirst, ...rest) {
50593
- let params;
50594
- if (paramsOrFirst &&
50595
- typeof paramsOrFirst === 'object' &&
50596
- !Array.isArray(paramsOrFirst)) {
50597
- params = (paramsOrFirst || {});
50598
- }
50599
- else {
50600
- params = {
50601
- ruleId: paramsOrFirst,
50602
- resourceType: rest[0],
50603
- resourceId: rest[1],
50604
- name: rest[2],
50605
- description: rest[3],
50606
- limit: rest[4],
50607
- interval: rest[5],
50608
- key: rest[6],
50609
- maxBucketSize: rest[7],
50610
- priority: rest[8],
50611
- enabled: rest[9],
50612
- conditions: rest[10],
50613
- };
50614
- }
50615
- const ruleId = params.ruleId;
50616
- const resourceType = params.resourceType;
50617
- const resourceId = params.resourceId;
50618
- const name = params.name;
50619
- const description = params.description;
50620
- const limit = params.limit;
50621
- const interval = params.interval;
50622
- const key = params.key;
50623
- const maxBucketSize = params.maxBucketSize;
50624
- const priority = params.priority;
50625
- const enabled = params.enabled;
50626
- const conditions = params.conditions;
50627
- if (typeof ruleId === 'undefined' || ruleId === '') {
50628
- throw new AppwriteException('Missing required parameter: "ruleId"');
50629
- }
50630
- const apiPath = '/waf/rules/rate-limit/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
49061
+ const apiPath = '/waf/rules/rate-limit/{ruleId}'.replace('{ruleId}', encodeURIComponent(String(ruleId)));
50631
49062
  const apiPayload = {};
50632
49063
  if (typeof resourceType !== 'undefined') {
50633
49064
  apiPayload['resourceType'] = resourceType;
@@ -51787,8 +50218,9 @@
51787
50218
  * );
51788
50219
  * // sub.update({ background: true }); sub.unsubscribe();
51789
50220
  */
51790
- class Push {
50221
+ class Push extends Service {
51791
50222
  constructor(client) {
50223
+ super(client);
51792
50224
  this.mqtt = null;
51793
50225
  this.connecting = null;
51794
50226
  this.Buffer = null;
@@ -51818,7 +50250,6 @@
51818
50250
  this.connectedKey = '';
51819
50251
  this.connectionEpoch = 0;
51820
50252
  this.subscriptions = new Map();
51821
- this.client = client;
51822
50253
  }
51823
50254
  // The broker subscription for a filter uses the highest QoS any local subscription on
51824
50255
  // it wants, so a QoS-0 subscription never downgrades a QoS-1 one sharing the filter.
@@ -52558,670 +50989,6 @@
52558
50989
  return filterParts.length === topicParts.length;
52559
50990
  }
52560
50991
 
52561
- /**
52562
- * Analytics auto-tracking helpers.
52563
- *
52564
- * These are hand-written companions to the generated `Analytics` service.
52565
- * The generated service exposes `createEvent(params)` for arbitrary events;
52566
- * this module wires up common auto-tracking behaviours (pageviews, outbound
52567
- * links, downloads, scroll depth, active engagement) on top of it.
52568
- *
52569
- * The tracking helpers accept a plain event-emitter function so they do not
52570
- * hard-couple to the generated `Analytics` class. The emitter adapts this
52571
- * module's option shape to `createEvent`: `url` is required there, and `props`
52572
- * is a flat alternating key/value list rather than an object.
52573
- *
52574
- * ```ts
52575
- * const analytics = new Analytics(client);
52576
- * const tracking = new AnalyticsTracking(
52577
- * (name, options) => analytics.createEvent({
52578
- * propertyId: options?.propertyId ?? '<PROPERTY_ID>',
52579
- * name,
52580
- * url: options?.url ?? window.location.href,
52581
- * referrer: options?.referrer,
52582
- * scrollDepth: options?.scrollDepth,
52583
- * engagementTime: options?.engagementTime,
52584
- * props: Object.entries(options?.props ?? {}).flatMap(
52585
- * ([key, value]) => [key, String(value)],
52586
- * ),
52587
- * }),
52588
- * { propertyId: '<PROPERTY_ID>' }
52589
- * );
52590
- * tracking.enableAllAutoTracking();
52591
- * ```
52592
- *
52593
- * `propertyId` is optional: when set it is merged into the options of every
52594
- * emitted event, so an emitter that forwards `options.propertyId` (as above)
52595
- * picks it up instead of every caller hand-rolling it into the closure.
52596
- * Per-event `propertyId` always wins over the configured default.
52597
- *
52598
- * All helpers respect `navigator.doNotTrack === '1'` by default; opt out with
52599
- * `respectDoNotTrack: false` in the constructor options.
52600
- *
52601
- * Engagement time follows Plausible's model: rather than one total at unload,
52602
- * a delta is emitted at every natural checkpoint of the visit (tab hidden, SPA
52603
- * route change, unload). See `enableAutoEngagementTime` for details.
52604
- *
52605
- * Auto-emitted event names follow `snake_case` + lowercase (`pageview`,
52606
- * `outbound_link`, `file_download`, `screen_view`, etc.). Any prop keys use
52607
- * camelCase to match the endpoint's parameter naming. Callers can pass any
52608
- * custom event name; the auto-track methods only own the events they emit
52609
- * themselves.
52610
- */
52611
- const DEFAULT_DOWNLOAD_EXTENSIONS = [
52612
- 'pdf',
52613
- 'zip',
52614
- 'rar',
52615
- '7z',
52616
- 'tar',
52617
- 'gz',
52618
- 'csv',
52619
- 'tsv',
52620
- 'xls',
52621
- 'xlsx',
52622
- 'doc',
52623
- 'docx',
52624
- 'ppt',
52625
- 'pptx',
52626
- 'dmg',
52627
- 'exe',
52628
- 'msi',
52629
- 'pkg',
52630
- 'deb',
52631
- 'rpm',
52632
- 'apk',
52633
- 'mp3',
52634
- 'wav',
52635
- 'flac',
52636
- 'mp4',
52637
- 'mov',
52638
- 'avi',
52639
- 'mkv',
52640
- 'webm',
52641
- ];
52642
- /**
52643
- * Two-part public suffixes common enough to matter for outbound-link detection.
52644
- * See `rootDomain()` for why this is a short list rather than the Public Suffix
52645
- * List.
52646
- */
52647
- const MULTI_PART_SUFFIXES = new Set([
52648
- 'co.uk',
52649
- 'org.uk',
52650
- 'ac.uk',
52651
- 'gov.uk',
52652
- 'me.uk',
52653
- 'net.uk',
52654
- 'sch.uk',
52655
- 'co.jp',
52656
- 'ne.jp',
52657
- 'or.jp',
52658
- 'ac.jp',
52659
- 'go.jp',
52660
- 'com.au',
52661
- 'net.au',
52662
- 'org.au',
52663
- 'edu.au',
52664
- 'gov.au',
52665
- 'com.br',
52666
- 'net.br',
52667
- 'org.br',
52668
- 'com.cn',
52669
- 'net.cn',
52670
- 'org.cn',
52671
- 'gov.cn',
52672
- 'co.in',
52673
- 'net.in',
52674
- 'org.in',
52675
- 'co.nz',
52676
- 'net.nz',
52677
- 'org.nz',
52678
- 'co.za',
52679
- 'org.za',
52680
- 'com.mx',
52681
- 'com.ar',
52682
- 'com.co',
52683
- 'com.pe',
52684
- 'com.tr',
52685
- 'com.tw',
52686
- 'com.sg',
52687
- 'com.hk',
52688
- 'com.my',
52689
- 'com.ph',
52690
- 'com.vn',
52691
- 'co.kr',
52692
- 'co.il',
52693
- 'co.id',
52694
- 'co.th',
52695
- 'com.ua',
52696
- 'com.pl',
52697
- 'com.es',
52698
- ]);
52699
- const SCROLL_DEPTH_THROTTLE_MS = 200;
52700
- class AnalyticsTracking {
52701
- constructor(emit, options = {}) {
52702
- this.pageviewCleanups = [];
52703
- this.scrollCleanups = [];
52704
- this.engagementCleanups = [];
52705
- this.maxScrollDepth = 0;
52706
- this.scrollTicking = false;
52707
- this.lastScrollReport = 0;
52708
- this.engagementStart = 0;
52709
- this.engagementAccumulatedMs = 0;
52710
- this.engagementActive = false;
52711
- this.emit = emit;
52712
- this.respectDoNotTrack = options.respectDoNotTrack !== false;
52713
- this.propertyId = options.propertyId;
52714
- }
52715
- /**
52716
- * Enable the opinionated default auto-tracking set: pageviews, outbound
52717
- * links, scroll depth and active engagement time. Downloads must be opted
52718
- * into separately via `enableAutoDownloadTracking()` because the extension
52719
- * list is application-specific.
52720
- */
52721
- enableAllAutoTracking() {
52722
- this.enableAutoPageviews();
52723
- this.enableAutoOutboundTracking();
52724
- this.enableAutoScrollDepth();
52725
- this.enableAutoEngagementTime();
52726
- }
52727
- /**
52728
- * Track an event manually. Respects the DNT setting and swallows emitter
52729
- * exceptions so tracking failures never surface to the host page.
52730
- */
52731
- track(name, options) {
52732
- if (!this.canTrack()) {
52733
- return;
52734
- }
52735
- try {
52736
- this.emit(name, this.withPropertyId(options));
52737
- }
52738
- catch (error) {
52739
- console.warn('AnalyticsTracking: emitter threw', error);
52740
- }
52741
- }
52742
- /**
52743
- * Convenience wrapper for pageview-shaped events.
52744
- */
52745
- pageview(url, referrer) {
52746
- this.track('pageview', {
52747
- url: url !== null && url !== void 0 ? url : this.currentPageUrl(),
52748
- referrer: referrer !== null && referrer !== void 0 ? referrer : (typeof document !== 'undefined'
52749
- ? document.referrer
52750
- : undefined),
52751
- });
52752
- }
52753
- /**
52754
- * Enable SPA-aware pageview tracking. Fires an initial pageview on
52755
- * enable, then again on every `pushState`, `replaceState`, `popstate`
52756
- * or hashchange. Idempotent — repeat calls no-op.
52757
- */
52758
- enableAutoPageviews() {
52759
- if (this.pageviewCleanups.length > 0) {
52760
- return;
52761
- }
52762
- if (typeof window === 'undefined' || typeof history === 'undefined') {
52763
- return;
52764
- }
52765
- this.currentPath = this.currentPageUrl();
52766
- this.pageview();
52767
- const handleNavigation = () => {
52768
- const nextPath = this.currentPageUrl();
52769
- if (nextPath === this.currentPath) {
52770
- return;
52771
- }
52772
- const previous = this.currentPath;
52773
- this.currentPath = nextPath;
52774
- this.flushScrollDepth(previous);
52775
- this.flushEngagement(previous);
52776
- this.pageview(nextPath);
52777
- // flushEngagement no longer auto-restarts the timer (see its
52778
- // implementation note re: bfcache). SPA navigation stays on the
52779
- // same document, so restart engagement tracking for the new
52780
- // route as long as the tab is visible.
52781
- if (this.engagementCleanups.length > 0 &&
52782
- (typeof document === 'undefined' ||
52783
- document.visibilityState !== 'hidden')) {
52784
- this.startEngagement();
52785
- }
52786
- };
52787
- const originalPushState = history.pushState.bind(history);
52788
- const originalReplaceState = history.replaceState.bind(history);
52789
- // Our wrappers stay reachable after cleanup whenever another library
52790
- // patched on top of ours, so they have to be switchable off rather than
52791
- // merely unreferenced.
52792
- let patchActive = true;
52793
- const patchedPushState = (data, unused, url) => {
52794
- originalPushState(data, unused, url);
52795
- if (patchActive) {
52796
- handleNavigation();
52797
- }
52798
- };
52799
- const patchedReplaceState = (data, unused, url) => {
52800
- originalReplaceState(data, unused, url);
52801
- if (patchActive) {
52802
- handleNavigation();
52803
- }
52804
- };
52805
- history.pushState = patchedPushState;
52806
- history.replaceState = patchedReplaceState;
52807
- const popstateHandler = () => handleNavigation();
52808
- const hashchangeHandler = () => handleNavigation();
52809
- window.addEventListener('popstate', popstateHandler);
52810
- window.addEventListener('hashchange', hashchangeHandler);
52811
- this.pageviewCleanups.push(() => {
52812
- // Only unwind our own patch. A router (Next.js App Router, React
52813
- // Router, …) that patched these after us owns the current value,
52814
- // and assigning our saved reference back would silently throw its
52815
- // wrapper away. In that case ours stays in the chain, which is why
52816
- // `patchActive` exists: the wrapper keeps delegating to the original
52817
- // but stops reporting.
52818
- patchActive = false;
52819
- if (history.pushState === patchedPushState) {
52820
- history.pushState = originalPushState;
52821
- }
52822
- if (history.replaceState === patchedReplaceState) {
52823
- history.replaceState = originalReplaceState;
52824
- }
52825
- window.removeEventListener('popstate', popstateHandler);
52826
- window.removeEventListener('hashchange', hashchangeHandler);
52827
- });
52828
- }
52829
- /**
52830
- * Disable auto-pageview tracking installed by `enableAutoPageviews`.
52831
- * Safe to call when auto-pageviews were never enabled.
52832
- */
52833
- disableAutoPageviews() {
52834
- for (const cleanup of this.pageviewCleanups) {
52835
- cleanup();
52836
- }
52837
- this.pageviewCleanups = [];
52838
- }
52839
- /**
52840
- * Enable click-based outbound link tracking. Detects anchor clicks that
52841
- * navigate to a different origin and fires an `outbound_link` event
52842
- * (with `hostname` and `href` props) before the browser navigates.
52843
- */
52844
- enableAutoOutboundTracking(options = {}) {
52845
- if (this.outboundCleanup) {
52846
- return;
52847
- }
52848
- if (typeof document === 'undefined') {
52849
- return;
52850
- }
52851
- const includeSubdomains = options.includeSubdomains === true;
52852
- const clickHandler = (event) => {
52853
- const anchor = this.findAnchor(event.target);
52854
- if (!anchor || !anchor.href) {
52855
- return;
52856
- }
52857
- const target = this.parseUrl(anchor.href);
52858
- if (!target || !this.isExternal(target, includeSubdomains)) {
52859
- return;
52860
- }
52861
- this.track('outbound_link', {
52862
- url: target.href,
52863
- props: { hostname: target.hostname, href: target.href },
52864
- });
52865
- };
52866
- document.addEventListener('click', clickHandler, { capture: true });
52867
- this.outboundCleanup = () => document.removeEventListener('click', clickHandler, {
52868
- capture: true,
52869
- });
52870
- }
52871
- /**
52872
- * Disable outbound-link tracking installed by `enableAutoOutboundTracking`.
52873
- * Safe to call when auto-outbound was never enabled.
52874
- */
52875
- disableAutoOutboundTracking() {
52876
- if (this.outboundCleanup) {
52877
- this.outboundCleanup();
52878
- this.outboundCleanup = undefined;
52879
- }
52880
- }
52881
- /**
52882
- * Enable click-based download tracking. Detects anchor clicks that point
52883
- * at a file whose extension appears in the configured list and fires a
52884
- * `file_download` event with `filename`, `extension` and `href` props.
52885
- */
52886
- enableAutoDownloadTracking(options = {}) {
52887
- var _a;
52888
- if (this.downloadCleanup) {
52889
- return;
52890
- }
52891
- if (typeof document === 'undefined') {
52892
- return;
52893
- }
52894
- const extensions = ((_a = options.extensions) !== null && _a !== void 0 ? _a : DEFAULT_DOWNLOAD_EXTENSIONS).map((ext) => ext.toLowerCase().replace(/^\./, ''));
52895
- const extensionSet = new Set(extensions);
52896
- const clickHandler = (event) => {
52897
- var _a, _b;
52898
- const anchor = this.findAnchor(event.target);
52899
- if (!anchor || !anchor.href) {
52900
- return;
52901
- }
52902
- const url = this.parseUrl(anchor.href);
52903
- if (!url) {
52904
- return;
52905
- }
52906
- const filename = (_a = url.pathname.split('/').pop()) !== null && _a !== void 0 ? _a : '';
52907
- const extension = filename.includes('.')
52908
- ? (_b = filename.split('.').pop()) === null || _b === void 0 ? void 0 : _b.toLowerCase()
52909
- : undefined;
52910
- if (!extension || !extensionSet.has(extension)) {
52911
- return;
52912
- }
52913
- this.track('file_download', {
52914
- url: url.href,
52915
- props: { filename, extension, href: url.href },
52916
- });
52917
- };
52918
- document.addEventListener('click', clickHandler, { capture: true });
52919
- this.downloadCleanup = () => document.removeEventListener('click', clickHandler, {
52920
- capture: true,
52921
- });
52922
- }
52923
- /**
52924
- * Disable file-download tracking installed by `enableAutoDownloadTracking`.
52925
- * Safe to call when auto-download was never enabled.
52926
- */
52927
- disableAutoDownloadTracking() {
52928
- if (this.downloadCleanup) {
52929
- this.downloadCleanup();
52930
- this.downloadCleanup = undefined;
52931
- }
52932
- }
52933
- /**
52934
- * Enable passive scroll-depth tracking. Records the maximum percent of the
52935
- * document scrolled and reports it on `beforeunload` and on SPA route
52936
- * changes. Uses a throttled passive listener so it is safe on hot paths.
52937
- */
52938
- enableAutoScrollDepth() {
52939
- if (this.scrollCleanups.length > 0) {
52940
- return;
52941
- }
52942
- if (typeof window === 'undefined' || typeof document === 'undefined') {
52943
- return;
52944
- }
52945
- this.maxScrollDepth = 0;
52946
- this.lastScrollReport = 0;
52947
- const scrollHandler = () => {
52948
- if (this.scrollTicking) {
52949
- return;
52950
- }
52951
- this.scrollTicking = true;
52952
- window.requestAnimationFrame(() => {
52953
- const now = Date.now();
52954
- if (now - this.lastScrollReport < SCROLL_DEPTH_THROTTLE_MS) {
52955
- this.scrollTicking = false;
52956
- return;
52957
- }
52958
- this.lastScrollReport = now;
52959
- const depth = this.computeScrollDepth();
52960
- if (depth > this.maxScrollDepth) {
52961
- this.maxScrollDepth = depth;
52962
- }
52963
- this.scrollTicking = false;
52964
- });
52965
- };
52966
- const unloadHandler = () => {
52967
- this.flushScrollDepth(this.currentPageUrl());
52968
- };
52969
- window.addEventListener('scroll', scrollHandler, { passive: true });
52970
- window.addEventListener('beforeunload', unloadHandler);
52971
- window.addEventListener('pagehide', unloadHandler);
52972
- this.scrollCleanups.push(() => {
52973
- window.removeEventListener('scroll', scrollHandler);
52974
- window.removeEventListener('beforeunload', unloadHandler);
52975
- window.removeEventListener('pagehide', unloadHandler);
52976
- });
52977
- }
52978
- /**
52979
- * Disable scroll-depth tracking installed by `enableAutoScrollDepth`. Safe
52980
- * to call when auto-scroll-depth was never enabled. Any accumulated depth
52981
- * for the current page is dropped.
52982
- */
52983
- disableAutoScrollDepth() {
52984
- for (const cleanup of this.scrollCleanups) {
52985
- cleanup();
52986
- }
52987
- this.scrollCleanups = [];
52988
- this.maxScrollDepth = 0;
52989
- this.scrollTicking = false;
52990
- this.lastScrollReport = 0;
52991
- }
52992
- /**
52993
- * Enable active engagement-time tracking. Counts time the tab is visible
52994
- * and uses `visibilitychange` to exclude background time.
52995
- *
52996
- * Delivery follows Plausible's model rather than a single total at the
52997
- * end of the visit: an `engagement_time` event is emitted at every natural
52998
- * checkpoint — the tab going hidden, an SPA route change, and finally
52999
- * `beforeunload`/`pagehide`. Unload is kept only as a best-effort last
53000
- * flush; it is the least reliable moment to send anything (browsers
53001
- * routinely cancel in-flight requests there, and `sendBeacon` cannot set
53002
- * the `X-Appwrite-Project` header the endpoint requires), so it must never
53003
- * be the only delivery.
53004
- *
53005
- * Each event carries a **delta** — the seconds accrued since the previous
53006
- * flush, not a running total — so the values are additive per session and
53007
- * a lost event costs only its own slice.
53008
- *
53009
- * There is deliberately no periodic ping. The cadence is driven by
53010
- * navigation and tab switches, so request volume tracks what the visitor
53011
- * actually does instead of multiplying with time on page.
53012
- */
53013
- enableAutoEngagementTime() {
53014
- if (this.engagementCleanups.length > 0) {
53015
- return;
53016
- }
53017
- if (typeof window === 'undefined' || typeof document === 'undefined') {
53018
- return;
53019
- }
53020
- this.engagementAccumulatedMs = 0;
53021
- // Do not start the clock for a tab that is already hidden (prerender,
53022
- // background tab restore); `visibilitychange` starts it when it is
53023
- // actually looked at.
53024
- if (document.visibilityState !== 'hidden') {
53025
- this.startEngagement();
53026
- }
53027
- const visibilityHandler = () => {
53028
- if (document.visibilityState === 'hidden') {
53029
- // Flush, don't just pause. The page is still fully alive here,
53030
- // which makes this the most reliable delivery point in the
53031
- // whole visit — and it is the same moment Plausible reports on.
53032
- this.flushEngagement(this.currentPageUrl());
53033
- }
53034
- else if (document.visibilityState === 'visible') {
53035
- this.startEngagement();
53036
- }
53037
- };
53038
- const unloadHandler = () => {
53039
- this.flushEngagement(this.currentPageUrl());
53040
- };
53041
- const pageshowHandler = (event) => {
53042
- // When the page is restored from the back-forward cache the
53043
- // engagement timer is in a stopped state (flushEngagement paused
53044
- // it on pagehide and does not auto-restart). Kick off a fresh
53045
- // engagementStart so bfcache dwell time is not billed as
53046
- // engagement.
53047
- if (event.persisted) {
53048
- this.startEngagement();
53049
- }
53050
- };
53051
- document.addEventListener('visibilitychange', visibilityHandler);
53052
- window.addEventListener('beforeunload', unloadHandler);
53053
- window.addEventListener('pagehide', unloadHandler);
53054
- window.addEventListener('pageshow', pageshowHandler);
53055
- this.engagementCleanups.push(() => {
53056
- document.removeEventListener('visibilitychange', visibilityHandler);
53057
- window.removeEventListener('beforeunload', unloadHandler);
53058
- window.removeEventListener('pagehide', unloadHandler);
53059
- window.removeEventListener('pageshow', pageshowHandler);
53060
- });
53061
- }
53062
- /**
53063
- * Disable engagement-time tracking installed by `enableAutoEngagementTime`.
53064
- * Safe to call when auto-engagement was never enabled. Any accumulated
53065
- * engagement time is dropped without being emitted.
53066
- */
53067
- disableAutoEngagementTime() {
53068
- for (const cleanup of this.engagementCleanups) {
53069
- cleanup();
53070
- }
53071
- this.engagementCleanups = [];
53072
- this.engagementActive = false;
53073
- this.engagementAccumulatedMs = 0;
53074
- this.engagementStart = 0;
53075
- }
53076
- /**
53077
- * Merge the configured `propertyId` into an event's options. Returns the
53078
- * caller's object untouched when no default is configured (or the event
53079
- * already carries one), so emitters written against the pre-`propertyId`
53080
- * shape keep receiving exactly what they received before.
53081
- */
53082
- withPropertyId(options) {
53083
- if (this.propertyId === undefined ||
53084
- (options === null || options === void 0 ? void 0 : options.propertyId) !== undefined) {
53085
- return options;
53086
- }
53087
- return Object.assign(Object.assign({}, (options !== null && options !== void 0 ? options : {})), { propertyId: this.propertyId });
53088
- }
53089
- canTrack() {
53090
- if (!this.respectDoNotTrack) {
53091
- return true;
53092
- }
53093
- if (typeof navigator === 'undefined') {
53094
- return true;
53095
- }
53096
- return navigator.doNotTrack !== '1';
53097
- }
53098
- currentPageUrl() {
53099
- if (typeof window === 'undefined' || !window.location) {
53100
- return '';
53101
- }
53102
- return window.location.href;
53103
- }
53104
- findAnchor(target) {
53105
- let node = target;
53106
- while (node) {
53107
- if (node.tagName === 'A') {
53108
- return node;
53109
- }
53110
- node = node.parentNode;
53111
- }
53112
- return null;
53113
- }
53114
- parseUrl(href) {
53115
- try {
53116
- return new URL(href, window.location.href);
53117
- }
53118
- catch (_a) {
53119
- return null;
53120
- }
53121
- }
53122
- isExternal(target, includeSubdomains) {
53123
- if (target.protocol !== 'http:' && target.protocol !== 'https:') {
53124
- return false;
53125
- }
53126
- if (target.hostname === window.location.hostname) {
53127
- return false;
53128
- }
53129
- if (includeSubdomains) {
53130
- return true;
53131
- }
53132
- const root = this.rootDomain(window.location.hostname);
53133
- return this.rootDomain(target.hostname) !== root;
53134
- }
53135
- rootDomain(hostname) {
53136
- const parts = hostname.split('.');
53137
- if (parts.length <= 2) {
53138
- return hostname;
53139
- }
53140
- // Taking the last two labels is wrong wherever the registry sells names
53141
- // one level down: `shop.example.co.uk` and `google.co.uk` both reduce to
53142
- // `co.uk`, so every outbound click between two `.co.uk` sites looks
53143
- // internal and is dropped. Take three labels after a known two-part
53144
- // suffix instead.
53145
- //
53146
- // This is a heuristic, not the Public Suffix List — the full list is
53147
- // orders of magnitude larger than this whole file, and a tracking
53148
- // snippet cannot carry it. Sites on a suffix that is missing here can
53149
- // pass `includeSubdomains: true` to treat every other host as outbound.
53150
- const suffix = parts.slice(-2).join('.');
53151
- if (parts.length > 2 && MULTI_PART_SUFFIXES.has(suffix)) {
53152
- return parts.slice(-3).join('.');
53153
- }
53154
- return suffix;
53155
- }
53156
- computeScrollDepth() {
53157
- const scrollTop = window.scrollY || document.documentElement.scrollTop;
53158
- const viewport = window.innerHeight || document.documentElement.clientHeight;
53159
- const total = document.documentElement.scrollHeight;
53160
- if (total <= viewport) {
53161
- return 100;
53162
- }
53163
- const depth = Math.round(((scrollTop + viewport) / total) * 100);
53164
- return Math.max(0, Math.min(100, depth));
53165
- }
53166
- flushScrollDepth(url) {
53167
- if (this.scrollCleanups.length === 0) {
53168
- return;
53169
- }
53170
- if (this.maxScrollDepth <= 0) {
53171
- return;
53172
- }
53173
- this.track('scroll_depth', {
53174
- url,
53175
- scrollDepth: this.maxScrollDepth,
53176
- });
53177
- this.maxScrollDepth = 0;
53178
- }
53179
- startEngagement() {
53180
- if (this.engagementActive) {
53181
- return;
53182
- }
53183
- this.engagementActive = true;
53184
- this.engagementStart = Date.now();
53185
- }
53186
- pauseEngagement() {
53187
- if (!this.engagementActive) {
53188
- return;
53189
- }
53190
- this.engagementActive = false;
53191
- this.engagementAccumulatedMs += Date.now() - this.engagementStart;
53192
- }
53193
- flushEngagement(url) {
53194
- if (this.engagementCleanups.length === 0) {
53195
- return;
53196
- }
53197
- this.pauseEngagement();
53198
- // Deltas, not a running total: emit only what accrued since the last
53199
- // flush. `floor` plus keeping the sub-second remainder in the
53200
- // accumulator is what makes repeated flushes safe — nothing is emitted
53201
- // twice, and a visit chopped into many short segments does not lose a
53202
- // fraction of a second to rounding on every one of them.
53203
- const seconds = Math.floor(this.engagementAccumulatedMs / 1000);
53204
- if (seconds > 0) {
53205
- // Deduct before emitting so a synchronous emitter that re-enters
53206
- // (or throws) can never bill the same seconds again.
53207
- this.engagementAccumulatedMs -= seconds * 1000;
53208
- this.track('engagement_time', {
53209
- url,
53210
- engagementTime: seconds,
53211
- });
53212
- }
53213
- // NOTE: intentionally do NOT call startEngagement() here. flushEngagement
53214
- // runs on `pagehide`, which is also the last hook before the browser
53215
- // may freeze the page into the back-forward cache. Auto-restarting
53216
- // would snapshot engagementStart just before the freeze; the next
53217
- // pauseEngagement (after bfcache restore) would then bill the entire
53218
- // bfcache dwell as active engagement. Restart is driven by explicit
53219
- // resume signals: `pageshow` (with `persisted === true`),
53220
- // `visibilitychange` back to visible, or the SPA navigation flow in
53221
- // `enableAutoPageviews`.
53222
- }
53223
- }
53224
-
53225
50992
  /**
53226
50993
  * Helper class to generate permission strings for resources.
53227
50994
  */
@@ -53928,68 +51695,6 @@
53928
51695
  OAuthProvider["Zoom"] = "zoom";
53929
51696
  })(exports.OAuthProvider || (exports.OAuthProvider = {}));
53930
51697
 
53931
- exports.PlatformResourceType = void 0;
53932
- (function (PlatformResourceType) {
53933
- PlatformResourceType["Projects"] = "projects";
53934
- PlatformResourceType["Organizations"] = "organizations";
53935
- PlatformResourceType["Users"] = "users";
53936
- PlatformResourceType["Memberships"] = "memberships";
53937
- PlatformResourceType["Rules"] = "rules";
53938
- PlatformResourceType["Keys"] = "keys";
53939
- PlatformResourceType["Platforms"] = "platforms";
53940
- PlatformResourceType["Webhooks"] = "webhooks";
53941
- PlatformResourceType["Certificates"] = "certificates";
53942
- })(exports.PlatformResourceType || (exports.PlatformResourceType = {}));
53943
-
53944
- exports.ProjectResourceType = void 0;
53945
- (function (ProjectResourceType) {
53946
- ProjectResourceType["Users"] = "users";
53947
- ProjectResourceType["Teams"] = "teams";
53948
- ProjectResourceType["Memberships"] = "memberships";
53949
- ProjectResourceType["Databases"] = "databases";
53950
- ProjectResourceType["Buckets"] = "buckets";
53951
- ProjectResourceType["Functions"] = "functions";
53952
- ProjectResourceType["Sites"] = "sites";
53953
- ProjectResourceType["Deployments"] = "deployments";
53954
- ProjectResourceType["Topics"] = "topics";
53955
- ProjectResourceType["Providers"] = "providers";
53956
- ProjectResourceType["Messages"] = "messages";
53957
- })(exports.ProjectResourceType || (exports.ProjectResourceType = {}));
53958
-
53959
- exports.AnalyticsInterval = void 0;
53960
- (function (AnalyticsInterval) {
53961
- AnalyticsInterval["OneHour"] = "1h";
53962
- AnalyticsInterval["OneDay"] = "1d";
53963
- AnalyticsInterval["OneWeek"] = "1w";
53964
- AnalyticsInterval["OneMonth"] = "1m";
53965
- })(exports.AnalyticsInterval || (exports.AnalyticsInterval = {}));
53966
-
53967
- exports.AnalyticsDimension = void 0;
53968
- (function (AnalyticsDimension) {
53969
- AnalyticsDimension["Country"] = "country";
53970
- AnalyticsDimension["Region"] = "region";
53971
- AnalyticsDimension["City"] = "city";
53972
- AnalyticsDimension["Browser"] = "browser";
53973
- AnalyticsDimension["OperatingSystem"] = "operatingSystem";
53974
- AnalyticsDimension["Device"] = "device";
53975
- AnalyticsDimension["ScreenSize"] = "screenSize";
53976
- AnalyticsDimension["ReferrerSource"] = "referrerSource";
53977
- AnalyticsDimension["Channel"] = "channel";
53978
- AnalyticsDimension["UtmSource"] = "utmSource";
53979
- AnalyticsDimension["UtmMedium"] = "utmMedium";
53980
- AnalyticsDimension["UtmCampaign"] = "utmCampaign";
53981
- AnalyticsDimension["UtmContent"] = "utmContent";
53982
- AnalyticsDimension["UtmTerm"] = "utmTerm";
53983
- AnalyticsDimension["Page"] = "page";
53984
- AnalyticsDimension["Hostname"] = "hostname";
53985
- AnalyticsDimension["EntryPage"] = "entryPage";
53986
- AnalyticsDimension["ExitPage"] = "exitPage";
53987
- AnalyticsDimension["TrafficType"] = "trafficType";
53988
- AnalyticsDimension["BotName"] = "botName";
53989
- AnalyticsDimension["BotCategory"] = "botCategory";
53990
- AnalyticsDimension["EventName"] = "eventName";
53991
- })(exports.AnalyticsDimension || (exports.AnalyticsDimension = {}));
53992
-
53993
51698
  exports.Browser = void 0;
53994
51699
  (function (Browser) {
53995
51700
  Browser["AvantBrowser"] = "aa";
@@ -54805,14 +52510,6 @@
54805
52510
  QuerySuggestionResource["ResourceTokens"] = "resourcetokens";
54806
52511
  QuerySuggestionResource["Transactions"] = "transactions";
54807
52512
  QuerySuggestionResource["TransactionLogs"] = "transactionlogs";
54808
- QuerySuggestionResource["Videos"] = "videos";
54809
- QuerySuggestionResource["VideosPreviews"] = "videos_previews";
54810
- QuerySuggestionResource["VideosRenditions"] = "videos_renditions";
54811
- QuerySuggestionResource["VideosRenditionsSegments"] = "videos_renditions_segments";
54812
- QuerySuggestionResource["VideosProfiles"] = "videos_profiles";
54813
- QuerySuggestionResource["VideosSubtitles"] = "videos_subtitles";
54814
- QuerySuggestionResource["VideosSubtitlesSegments"] = "videos_subtitles_segments";
54815
- QuerySuggestionResource["AnalyticsProperties"] = "analyticsproperties";
54816
52513
  QuerySuggestionResource["DedicatedDatabases"] = "dedicateddatabases";
54817
52514
  QuerySuggestionResource["DedicatedDatabaseConfigs"] = "dedicateddatabaseconfigs";
54818
52515
  QuerySuggestionResource["DedicatedDatabaseRuntimes"] = "dedicateddatabaseruntimes";
@@ -55235,8 +52932,6 @@
55235
52932
  ProjectKeyScopes["ReportsWrite"] = "reports.write";
55236
52933
  ProjectKeyScopes["PresencesRead"] = "presences.read";
55237
52934
  ProjectKeyScopes["PresencesWrite"] = "presences.write";
55238
- ProjectKeyScopes["VideosRead"] = "videos.read";
55239
- ProjectKeyScopes["VideosWrite"] = "videos.write";
55240
52935
  ProjectKeyScopes["DedicatedDatabasesExecute"] = "dedicatedDatabases.execute";
55241
52936
  ProjectKeyScopes["BackupsPoliciesRead"] = "backups.policies.read";
55242
52937
  ProjectKeyScopes["BackupsPoliciesWrite"] = "backups.policies.write";
@@ -55255,8 +52950,6 @@
55255
52950
  ProjectKeyScopes["Oauth2Read"] = "oauth2.read";
55256
52951
  ProjectKeyScopes["Oauth2Write"] = "oauth2.write";
55257
52952
  ProjectKeyScopes["Oauth2Introspect"] = "oauth2.introspect";
55258
- ProjectKeyScopes["AnalyticsRead"] = "analytics.read";
55259
- ProjectKeyScopes["AnalyticsWrite"] = "analytics.write";
55260
52953
  })(exports.ProjectKeyScopes || (exports.ProjectKeyScopes = {}));
55261
52954
 
55262
52955
  exports.FunctionTemplateUseCase = void 0;
@@ -55506,7 +53199,6 @@
55506
53199
  ProjectAuthMethodId["Invites"] = "invites";
55507
53200
  ProjectAuthMethodId["Jwt"] = "jwt";
55508
53201
  ProjectAuthMethodId["Phone"] = "phone";
55509
- ProjectAuthMethodId["Passkey"] = "passkey";
55510
53202
  })(exports.ProjectAuthMethodId || (exports.ProjectAuthMethodId = {}));
55511
53203
 
55512
53204
  exports.ProjectOAuth2Auth0Prompt = void 0;
@@ -55648,7 +53340,6 @@
55648
53340
  ProjectPolicyId["Denydisposableemail"] = "deny-disposable-email";
55649
53341
  ProjectPolicyId["Denyfreeemail"] = "deny-free-email";
55650
53342
  ProjectPolicyId["Denycorporateemail"] = "deny-corporate-email";
55651
- ProjectPolicyId["Passkey"] = "passkey";
55652
53343
  })(exports.ProjectPolicyId || (exports.ProjectPolicyId = {}));
55653
53344
 
55654
53345
  exports.ProjectProtocolId = void 0;
@@ -55893,9 +53584,6 @@
55893
53584
 
55894
53585
  exports.UsageEventMetric = void 0;
55895
53586
  (function (UsageEventMetric) {
55896
- UsageEventMetric["AnalyticsEvents"] = "analytics.events";
55897
- UsageEventMetric["AnalyticsPageviews"] = "analytics.pageviews";
55898
- UsageEventMetric["AnalyticsBotsEvents"] = "analytics.bots.events";
55899
53587
  UsageEventMetric["NetworkRequests"] = "network.requests";
55900
53588
  UsageEventMetric["NetworkInbound"] = "network.inbound";
55901
53589
  UsageEventMetric["NetworkOutbound"] = "network.outbound";
@@ -56013,7 +53701,6 @@
56013
53701
 
56014
53702
  exports.UsageGaugeMetric = void 0;
56015
53703
  (function (UsageGaugeMetric) {
56016
- UsageGaugeMetric["AnalyticsProperties"] = "analytics.properties";
56017
53704
  UsageGaugeMetric["Teams"] = "teams";
56018
53705
  UsageGaugeMetric["Users"] = "users";
56019
53706
  UsageGaugeMetric["Messages"] = "messages";
@@ -56111,24 +53798,6 @@
56111
53798
  VectorsDBIndexType["Unique"] = "unique";
56112
53799
  })(exports.VectorsDBIndexType || (exports.VectorsDBIndexType = {}));
56113
53800
 
56114
- exports.VideoOutput = void 0;
56115
- (function (VideoOutput) {
56116
- VideoOutput["Hls"] = "hls";
56117
- VideoOutput["Dash"] = "dash";
56118
- VideoOutput["Cmaf"] = "cmaf";
56119
- })(exports.VideoOutput || (exports.VideoOutput = {}));
56120
-
56121
- exports.VideoRenditionStatus = void 0;
56122
- (function (VideoRenditionStatus) {
56123
- VideoRenditionStatus["Pending"] = "pending";
56124
- VideoRenditionStatus["Started"] = "started";
56125
- VideoRenditionStatus["Ended"] = "ended";
56126
- VideoRenditionStatus["Uploading"] = "uploading";
56127
- VideoRenditionStatus["Ready"] = "ready";
56128
- VideoRenditionStatus["Error"] = "error";
56129
- VideoRenditionStatus["Aborted"] = "aborted";
56130
- })(exports.VideoRenditionStatus || (exports.VideoRenditionStatus = {}));
56131
-
56132
53801
  exports.DatabaseType = void 0;
56133
53802
  (function (DatabaseType) {
56134
53803
  DatabaseType["Legacy"] = "legacy";
@@ -56307,7 +53976,6 @@
56307
53976
  (function (ProxyRuleDeploymentResourceType) {
56308
53977
  ProxyRuleDeploymentResourceType["Function"] = "function";
56309
53978
  ProxyRuleDeploymentResourceType["Site"] = "site";
56310
- ProxyRuleDeploymentResourceType["DedicatedDatabase"] = "dedicatedDatabase";
56311
53979
  })(exports.ProxyRuleDeploymentResourceType || (exports.ProxyRuleDeploymentResourceType = {}));
56312
53980
 
56313
53981
  exports.ProxyRuleStatus = void 0;
@@ -58387,11 +56055,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
58387
56055
 
58388
56056
  exports.Account = Account;
58389
56057
  exports.Activities = Activities;
58390
- exports.Admin = Admin;
58391
56058
  exports.Advisor = Advisor;
58392
56059
  exports.Affiliates = Affiliates;
58393
- exports.Analytics = Analytics;
58394
- exports.AnalyticsTracking = AnalyticsTracking;
58395
56060
  exports.Apps = Apps;
58396
56061
  exports.AppwriteException = AppwriteException;
58397
56062
  exports.Assistant = Assistant;
@@ -58440,7 +56105,6 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
58440
56105
  exports.Users = Users;
58441
56106
  exports.Vcs = Vcs;
58442
56107
  exports.VectorsDB = VectorsDB;
58443
- exports.Videos = Videos;
58444
56108
  exports.Waf = Waf;
58445
56109
  exports.Webhooks = Webhooks;
58446
56110