appwrite 23.0.0 → 24.0.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.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/appwrite/client.rb +28 -2
  3. data/lib/appwrite/enums/build_runtime.rb +1 -0
  4. data/lib/appwrite/enums/o_auth2_google_prompt.rb +9 -0
  5. data/lib/appwrite/enums/o_auth_provider.rb +3 -0
  6. data/lib/appwrite/enums/project_auth_method_id.rb +13 -0
  7. data/lib/appwrite/enums/project_email_template_id.rb +13 -0
  8. data/lib/appwrite/enums/project_email_template_locale.rb +137 -0
  9. data/lib/appwrite/enums/project_key_scopes.rb +100 -0
  10. data/lib/appwrite/enums/project_o_auth2_google_prompt.rb +9 -0
  11. data/lib/appwrite/enums/project_o_auth_provider_id.rb +51 -0
  12. data/lib/appwrite/enums/project_policy_id.rb +15 -0
  13. data/lib/appwrite/enums/{protocol_id.rb → project_protocol_id.rb} +1 -1
  14. data/lib/appwrite/enums/{service_id.rb → project_service_id.rb} +2 -1
  15. data/lib/appwrite/enums/project_smtp_secure.rb +8 -0
  16. data/lib/appwrite/enums/proxy_resource_type.rb +8 -0
  17. data/lib/appwrite/enums/proxy_rule_deployment_resource_type.rb +8 -0
  18. data/lib/appwrite/enums/proxy_rule_status.rb +9 -0
  19. data/lib/appwrite/enums/runtime.rb +1 -0
  20. data/lib/appwrite/enums/scopes.rb +51 -31
  21. data/lib/appwrite/enums/status_code.rb +10 -0
  22. data/lib/appwrite/models/attribute_bigint.rb +96 -0
  23. data/lib/appwrite/models/block.rb +28 -3
  24. data/lib/appwrite/models/column_bigint.rb +96 -0
  25. data/lib/appwrite/models/database.rb +2 -2
  26. data/lib/appwrite/models/email_template.rb +62 -0
  27. data/lib/appwrite/models/email_template_list.rb +32 -0
  28. data/lib/appwrite/models/ephemeral_key.rb +67 -0
  29. data/lib/appwrite/models/insight.rb +107 -0
  30. data/lib/appwrite/models/insight_cta.rb +42 -0
  31. data/lib/appwrite/models/insight_list.rb +32 -0
  32. data/lib/appwrite/models/membership.rb +5 -0
  33. data/lib/appwrite/models/mock_number.rb +18 -8
  34. data/lib/appwrite/models/mock_number_list.rb +32 -0
  35. data/lib/appwrite/models/o_auth2_amazon.rb +42 -0
  36. data/lib/appwrite/models/o_auth2_apple.rb +52 -0
  37. data/lib/appwrite/models/o_auth2_auth0.rb +47 -0
  38. data/lib/appwrite/models/o_auth2_authentik.rb +47 -0
  39. data/lib/appwrite/models/o_auth2_autodesk.rb +42 -0
  40. data/lib/appwrite/models/o_auth2_bitbucket.rb +42 -0
  41. data/lib/appwrite/models/o_auth2_bitly.rb +42 -0
  42. data/lib/appwrite/models/o_auth2_box.rb +42 -0
  43. data/lib/appwrite/models/o_auth2_dailymotion.rb +42 -0
  44. data/lib/appwrite/models/o_auth2_discord.rb +42 -0
  45. data/lib/appwrite/models/o_auth2_disqus.rb +42 -0
  46. data/lib/appwrite/models/o_auth2_dropbox.rb +42 -0
  47. data/lib/appwrite/models/o_auth2_etsy.rb +42 -0
  48. data/lib/appwrite/models/o_auth2_facebook.rb +42 -0
  49. data/lib/appwrite/models/o_auth2_figma.rb +42 -0
  50. data/lib/appwrite/models/o_auth2_fusion_auth.rb +47 -0
  51. data/lib/appwrite/models/o_auth2_github.rb +42 -0
  52. data/lib/appwrite/models/o_auth2_gitlab.rb +47 -0
  53. data/lib/appwrite/models/o_auth2_google.rb +47 -0
  54. data/lib/appwrite/models/o_auth2_keycloak.rb +52 -0
  55. data/lib/appwrite/models/o_auth2_kick.rb +42 -0
  56. data/lib/appwrite/models/o_auth2_linkedin.rb +42 -0
  57. data/lib/appwrite/models/o_auth2_microsoft.rb +47 -0
  58. data/lib/appwrite/models/o_auth2_notion.rb +42 -0
  59. data/lib/appwrite/models/o_auth2_oidc.rb +62 -0
  60. data/lib/appwrite/models/o_auth2_okta.rb +52 -0
  61. data/lib/appwrite/models/o_auth2_paypal.rb +42 -0
  62. data/lib/appwrite/models/o_auth2_podio.rb +42 -0
  63. data/lib/appwrite/models/o_auth2_provider_list.rb +32 -0
  64. data/lib/appwrite/models/o_auth2_salesforce.rb +42 -0
  65. data/lib/appwrite/models/o_auth2_slack.rb +42 -0
  66. data/lib/appwrite/models/o_auth2_spotify.rb +42 -0
  67. data/lib/appwrite/models/o_auth2_stripe.rb +42 -0
  68. data/lib/appwrite/models/o_auth2_tradeshift.rb +42 -0
  69. data/lib/appwrite/models/o_auth2_twitch.rb +42 -0
  70. data/lib/appwrite/models/o_auth2_word_press.rb +42 -0
  71. data/lib/appwrite/models/o_auth2_x.rb +42 -0
  72. data/lib/appwrite/models/o_auth2_yahoo.rb +42 -0
  73. data/lib/appwrite/models/o_auth2_yandex.rb +42 -0
  74. data/lib/appwrite/models/o_auth2_zoho.rb +42 -0
  75. data/lib/appwrite/models/o_auth2_zoom.rb +42 -0
  76. data/lib/appwrite/models/policy_list.rb +32 -0
  77. data/lib/appwrite/models/policy_membership_privacy.rb +52 -0
  78. data/lib/appwrite/models/policy_password_dictionary.rb +32 -0
  79. data/lib/appwrite/models/policy_password_history.rb +32 -0
  80. data/lib/appwrite/models/policy_password_personal_data.rb +32 -0
  81. data/lib/appwrite/models/policy_session_alert.rb +32 -0
  82. data/lib/appwrite/models/policy_session_duration.rb +32 -0
  83. data/lib/appwrite/models/policy_session_invalidation.rb +32 -0
  84. data/lib/appwrite/models/policy_session_limit.rb +32 -0
  85. data/lib/appwrite/models/policy_user_limit.rb +32 -0
  86. data/lib/appwrite/models/presence.rb +71 -0
  87. data/lib/appwrite/models/presence_list.rb +36 -0
  88. data/lib/appwrite/models/project.rb +25 -280
  89. data/lib/appwrite/models/project_auth_method.rb +53 -0
  90. data/lib/appwrite/models/project_protocol.rb +49 -0
  91. data/lib/appwrite/models/project_service.rb +64 -0
  92. data/lib/appwrite/models/proxy_rule.rb +127 -0
  93. data/lib/appwrite/models/proxy_rule_list.rb +32 -0
  94. data/lib/appwrite/models/report.rb +82 -0
  95. data/lib/appwrite/models/report_list.rb +32 -0
  96. data/lib/appwrite/models/usage_event.rb +72 -0
  97. data/lib/appwrite/models/usage_event_list.rb +32 -0
  98. data/lib/appwrite/models/usage_gauge.rb +37 -0
  99. data/lib/appwrite/models/usage_gauge_list.rb +32 -0
  100. data/lib/appwrite/services/account.rb +1 -1
  101. data/lib/appwrite/services/advisor.rb +173 -0
  102. data/lib/appwrite/services/databases.rb +126 -0
  103. data/lib/appwrite/services/functions.rb +13 -7
  104. data/lib/appwrite/services/presences.rb +199 -0
  105. data/lib/appwrite/services/project.rb +2817 -292
  106. data/lib/appwrite/services/proxy.rb +303 -0
  107. data/lib/appwrite/services/sites.rb +13 -7
  108. data/lib/appwrite/services/tables_db.rb +120 -0
  109. data/lib/appwrite/services/usage.rb +86 -0
  110. data/lib/appwrite.rb +92 -3
  111. metadata +94 -5
  112. data/lib/appwrite/models/auth_provider.rb +0 -47
@@ -0,0 +1,127 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class ProxyRule
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :domain
10
+ attr_reader :type
11
+ attr_reader :trigger
12
+ attr_reader :redirect_url
13
+ attr_reader :redirect_status_code
14
+ attr_reader :deployment_id
15
+ attr_reader :deployment_resource_type
16
+ attr_reader :deployment_resource_id
17
+ attr_reader :deployment_vcs_provider_branch
18
+ attr_reader :status
19
+ attr_reader :logs
20
+ attr_reader :renew_at
21
+
22
+ def initialize(
23
+ id:,
24
+ created_at:,
25
+ updated_at:,
26
+ domain:,
27
+ type:,
28
+ trigger:,
29
+ redirect_url:,
30
+ redirect_status_code:,
31
+ deployment_id:,
32
+ deployment_resource_type: ,
33
+ deployment_resource_id:,
34
+ deployment_vcs_provider_branch:,
35
+ status:,
36
+ logs:,
37
+ renew_at:
38
+ )
39
+ @id = id
40
+ @created_at = created_at
41
+ @updated_at = updated_at
42
+ @domain = domain
43
+ @type = type
44
+ @trigger = trigger
45
+ @redirect_url = redirect_url
46
+ @redirect_status_code = redirect_status_code
47
+ @deployment_id = deployment_id
48
+ @deployment_resource_type = deployment_resource_type.nil? ? deployment_resource_type : validate_deployment_resource_type(deployment_resource_type)
49
+ @deployment_resource_id = deployment_resource_id
50
+ @deployment_vcs_provider_branch = deployment_vcs_provider_branch
51
+ @status = validate_status(status)
52
+ @logs = logs
53
+ @renew_at = renew_at
54
+ end
55
+
56
+ def self.from(map:)
57
+ ProxyRule.new(
58
+ id: map["$id"],
59
+ created_at: map["$createdAt"],
60
+ updated_at: map["$updatedAt"],
61
+ domain: map["domain"],
62
+ type: map["type"],
63
+ trigger: map["trigger"],
64
+ redirect_url: map["redirectUrl"],
65
+ redirect_status_code: map["redirectStatusCode"],
66
+ deployment_id: map["deploymentId"],
67
+ deployment_resource_type: map["deploymentResourceType"],
68
+ deployment_resource_id: map["deploymentResourceId"],
69
+ deployment_vcs_provider_branch: map["deploymentVcsProviderBranch"],
70
+ status: map["status"],
71
+ logs: map["logs"],
72
+ renew_at: map["renewAt"]
73
+ )
74
+ end
75
+
76
+ def to_map
77
+ {
78
+ "$id": @id,
79
+ "$createdAt": @created_at,
80
+ "$updatedAt": @updated_at,
81
+ "domain": @domain,
82
+ "type": @type,
83
+ "trigger": @trigger,
84
+ "redirectUrl": @redirect_url,
85
+ "redirectStatusCode": @redirect_status_code,
86
+ "deploymentId": @deployment_id,
87
+ "deploymentResourceType": @deployment_resource_type,
88
+ "deploymentResourceId": @deployment_resource_id,
89
+ "deploymentVcsProviderBranch": @deployment_vcs_provider_branch,
90
+ "status": @status,
91
+ "logs": @logs,
92
+ "renewAt": @renew_at
93
+ }
94
+ end
95
+
96
+ private
97
+
98
+ def validate_deployment_resource_type(deployment_resource_type)
99
+ valid_deployment_resource_type = [
100
+ Appwrite::Enums::ProxyRuleDeploymentResourceType::FUNCTION,
101
+ Appwrite::Enums::ProxyRuleDeploymentResourceType::SITE,
102
+ ]
103
+
104
+ unless valid_deployment_resource_type.include?(deployment_resource_type)
105
+ raise ArgumentError, "Invalid " + deployment_resource_type + ". Must be one of: " + valid_deployment_resource_type.join(', ')
106
+ end
107
+
108
+ deployment_resource_type
109
+ end
110
+
111
+ def validate_status(status)
112
+ valid_status = [
113
+ Appwrite::Enums::ProxyRuleStatus::UNVERIFIED,
114
+ Appwrite::Enums::ProxyRuleStatus::VERIFYING,
115
+ Appwrite::Enums::ProxyRuleStatus::VERIFIED,
116
+ ]
117
+
118
+ unless valid_status.include?(status)
119
+ raise ArgumentError, "Invalid " + status + ". Must be one of: " + valid_status.join(', ')
120
+ end
121
+
122
+ status
123
+ end
124
+
125
+ end
126
+ end
127
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class ProxyRuleList
6
+ attr_reader :total
7
+ attr_reader :rules
8
+
9
+ def initialize(
10
+ total:,
11
+ rules:
12
+ )
13
+ @total = total
14
+ @rules = rules
15
+ end
16
+
17
+ def self.from(map:)
18
+ ProxyRuleList.new(
19
+ total: map["total"],
20
+ rules: map["rules"].map { |it| ProxyRule.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "rules": @rules.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,82 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Report
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :app_id
10
+ attr_reader :type
11
+ attr_reader :title
12
+ attr_reader :summary
13
+ attr_reader :target_type
14
+ attr_reader :target
15
+ attr_reader :categories
16
+ attr_reader :insights
17
+ attr_reader :analyzed_at
18
+
19
+ def initialize(
20
+ id:,
21
+ created_at:,
22
+ updated_at:,
23
+ app_id:,
24
+ type:,
25
+ title:,
26
+ summary:,
27
+ target_type:,
28
+ target:,
29
+ categories:,
30
+ insights:,
31
+ analyzed_at:
32
+ )
33
+ @id = id
34
+ @created_at = created_at
35
+ @updated_at = updated_at
36
+ @app_id = app_id
37
+ @type = type
38
+ @title = title
39
+ @summary = summary
40
+ @target_type = target_type
41
+ @target = target
42
+ @categories = categories
43
+ @insights = insights
44
+ @analyzed_at = analyzed_at
45
+ end
46
+
47
+ def self.from(map:)
48
+ Report.new(
49
+ id: map["$id"],
50
+ created_at: map["$createdAt"],
51
+ updated_at: map["$updatedAt"],
52
+ app_id: map["appId"],
53
+ type: map["type"],
54
+ title: map["title"],
55
+ summary: map["summary"],
56
+ target_type: map["targetType"],
57
+ target: map["target"],
58
+ categories: map["categories"],
59
+ insights: map["insights"].map { |it| Insight.from(map: it) },
60
+ analyzed_at: map["analyzedAt"]
61
+ )
62
+ end
63
+
64
+ def to_map
65
+ {
66
+ "$id": @id,
67
+ "$createdAt": @created_at,
68
+ "$updatedAt": @updated_at,
69
+ "appId": @app_id,
70
+ "type": @type,
71
+ "title": @title,
72
+ "summary": @summary,
73
+ "targetType": @target_type,
74
+ "target": @target,
75
+ "categories": @categories,
76
+ "insights": @insights.map { |it| it.to_map },
77
+ "analyzedAt": @analyzed_at
78
+ }
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class ReportList
6
+ attr_reader :total
7
+ attr_reader :reports
8
+
9
+ def initialize(
10
+ total:,
11
+ reports:
12
+ )
13
+ @total = total
14
+ @reports = reports
15
+ end
16
+
17
+ def self.from(map:)
18
+ ReportList.new(
19
+ total: map["total"],
20
+ reports: map["reports"].map { |it| Report.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "reports": @reports.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,72 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class UsageEvent
6
+ attr_reader :metric
7
+ attr_reader :value
8
+ attr_reader :time
9
+ attr_reader :xpath
10
+ attr_reader :method
11
+ attr_reader :status
12
+ attr_reader :resource_type
13
+ attr_reader :resource_id
14
+ attr_reader :country_code
15
+ attr_reader :user_agent
16
+
17
+ def initialize(
18
+ metric:,
19
+ value:,
20
+ time:,
21
+ xpath:,
22
+ method:,
23
+ status:,
24
+ resource_type:,
25
+ resource_id:,
26
+ country_code:,
27
+ user_agent:
28
+ )
29
+ @metric = metric
30
+ @value = value
31
+ @time = time
32
+ @xpath = xpath
33
+ @method = method
34
+ @status = status
35
+ @resource_type = resource_type
36
+ @resource_id = resource_id
37
+ @country_code = country_code
38
+ @user_agent = user_agent
39
+ end
40
+
41
+ def self.from(map:)
42
+ UsageEvent.new(
43
+ metric: map["metric"],
44
+ value: map["value"],
45
+ time: map["time"],
46
+ xpath: map["path"],
47
+ method: map["method"],
48
+ status: map["status"],
49
+ resource_type: map["resourceType"],
50
+ resource_id: map["resourceId"],
51
+ country_code: map["countryCode"],
52
+ user_agent: map["userAgent"]
53
+ )
54
+ end
55
+
56
+ def to_map
57
+ {
58
+ "metric": @metric,
59
+ "value": @value,
60
+ "time": @time,
61
+ "path": @xpath,
62
+ "method": @method,
63
+ "status": @status,
64
+ "resourceType": @resource_type,
65
+ "resourceId": @resource_id,
66
+ "countryCode": @country_code,
67
+ "userAgent": @user_agent
68
+ }
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class UsageEventList
6
+ attr_reader :total
7
+ attr_reader :events
8
+
9
+ def initialize(
10
+ total:,
11
+ events:
12
+ )
13
+ @total = total
14
+ @events = events
15
+ end
16
+
17
+ def self.from(map:)
18
+ UsageEventList.new(
19
+ total: map["total"],
20
+ events: map["events"].map { |it| UsageEvent.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "events": @events.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,37 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class UsageGauge
6
+ attr_reader :metric
7
+ attr_reader :value
8
+ attr_reader :time
9
+
10
+ def initialize(
11
+ metric:,
12
+ value:,
13
+ time:
14
+ )
15
+ @metric = metric
16
+ @value = value
17
+ @time = time
18
+ end
19
+
20
+ def self.from(map:)
21
+ UsageGauge.new(
22
+ metric: map["metric"],
23
+ value: map["value"],
24
+ time: map["time"]
25
+ )
26
+ end
27
+
28
+ def to_map
29
+ {
30
+ "metric": @metric,
31
+ "value": @value,
32
+ "time": @time
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class UsageGaugeList
6
+ attr_reader :total
7
+ attr_reader :gauges
8
+
9
+ def initialize(
10
+ total:,
11
+ gauges:
12
+ )
13
+ @total = total
14
+ @gauges = gauges
15
+ end
16
+
17
+ def self.from(map:)
18
+ UsageGaugeList.new(
19
+ total: map["total"],
20
+ gauges: map["gauges"].map { |it| UsageGauge.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "gauges": @gauges.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1275,7 +1275,7 @@ module Appwrite
1275
1275
  # about session
1276
1276
  # limits](https://appwrite.io/docs/authentication-security#limits).
1277
1277
  #
1278
- # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
1278
+ # @param [OAuthProvider] provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
1279
1279
  # @param [String] success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1280
1280
  # @param [String] failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
1281
1281
  # @param [Array] scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
@@ -0,0 +1,173 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ class Advisor < Service
5
+
6
+ def initialize(client)
7
+ @client = client
8
+ end
9
+
10
+ # Get a list of all the project's analyzer reports. You can use the query
11
+ # params to filter your results.
12
+ #
13
+ #
14
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: appId, type, targetType, target, analyzedAt
15
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
16
+ #
17
+ # @return [ReportList]
18
+ def list_reports(queries: nil, total: nil)
19
+ api_path = '/reports'
20
+
21
+ api_params = {
22
+ queries: queries,
23
+ total: total,
24
+ }
25
+
26
+ api_headers = {
27
+ }
28
+
29
+ @client.call(
30
+ method: 'GET',
31
+ path: api_path,
32
+ headers: api_headers,
33
+ params: api_params,
34
+ response_type: Models::ReportList
35
+ )
36
+
37
+ end
38
+
39
+ # Get an analyzer report by its unique ID. The response includes the report's
40
+ # metadata and the nested insights it produced.
41
+ #
42
+ #
43
+ # @param [String] report_id Report ID.
44
+ #
45
+ # @return [Report]
46
+ def get_report(report_id:)
47
+ api_path = '/reports/{reportId}'
48
+ .gsub('{reportId}', report_id)
49
+
50
+ if report_id.nil?
51
+ raise Appwrite::Exception.new('Missing required parameter: "reportId"')
52
+ end
53
+
54
+ api_params = {
55
+ }
56
+
57
+ api_headers = {
58
+ }
59
+
60
+ @client.call(
61
+ method: 'GET',
62
+ path: api_path,
63
+ headers: api_headers,
64
+ params: api_params,
65
+ response_type: Models::Report
66
+ )
67
+
68
+ end
69
+
70
+ # Delete an analyzer report by its unique ID. Nested insights and CTA
71
+ # metadata are removed asynchronously by the deletes worker.
72
+ #
73
+ #
74
+ # @param [String] report_id Report ID.
75
+ #
76
+ # @return []
77
+ def delete_report(report_id:)
78
+ api_path = '/reports/{reportId}'
79
+ .gsub('{reportId}', report_id)
80
+
81
+ if report_id.nil?
82
+ raise Appwrite::Exception.new('Missing required parameter: "reportId"')
83
+ end
84
+
85
+ api_params = {
86
+ }
87
+
88
+ api_headers = {
89
+ "content-type": 'application/json',
90
+ }
91
+
92
+ @client.call(
93
+ method: 'DELETE',
94
+ path: api_path,
95
+ headers: api_headers,
96
+ params: api_params,
97
+ )
98
+
99
+ end
100
+
101
+ # List the insights produced under a single analyzer report. You can use the
102
+ # query params to filter your results further.
103
+ #
104
+ #
105
+ # @param [String] report_id Parent report ID.
106
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: type, severity, status, resourceType, resourceId, parentResourceType, parentResourceId, analyzedAt, dismissedAt, dismissedBy
107
+ # @param [] total When set to false, the total count returned will be 0 and will not be calculated.
108
+ #
109
+ # @return [InsightList]
110
+ def list_insights(report_id:, queries: nil, total: nil)
111
+ api_path = '/reports/{reportId}/insights'
112
+ .gsub('{reportId}', report_id)
113
+
114
+ if report_id.nil?
115
+ raise Appwrite::Exception.new('Missing required parameter: "reportId"')
116
+ end
117
+
118
+ api_params = {
119
+ queries: queries,
120
+ total: total,
121
+ }
122
+
123
+ api_headers = {
124
+ }
125
+
126
+ @client.call(
127
+ method: 'GET',
128
+ path: api_path,
129
+ headers: api_headers,
130
+ params: api_params,
131
+ response_type: Models::InsightList
132
+ )
133
+
134
+ end
135
+
136
+ # Get an insight by its unique ID, scoped to its parent report.
137
+ #
138
+ #
139
+ # @param [String] report_id Parent report ID.
140
+ # @param [String] insight_id Insight ID.
141
+ #
142
+ # @return [Insight]
143
+ def get_insight(report_id:, insight_id:)
144
+ api_path = '/reports/{reportId}/insights/{insightId}'
145
+ .gsub('{reportId}', report_id)
146
+ .gsub('{insightId}', insight_id)
147
+
148
+ if report_id.nil?
149
+ raise Appwrite::Exception.new('Missing required parameter: "reportId"')
150
+ end
151
+
152
+ if insight_id.nil?
153
+ raise Appwrite::Exception.new('Missing required parameter: "insightId"')
154
+ end
155
+
156
+ api_params = {
157
+ }
158
+
159
+ api_headers = {
160
+ }
161
+
162
+ @client.call(
163
+ method: 'GET',
164
+ path: api_path,
165
+ headers: api_headers,
166
+ params: api_params,
167
+ response_type: Models::Insight
168
+ )
169
+
170
+ end
171
+
172
+ end
173
+ end