Class: Appwrite::Advisor

Inherits:
Service show all
Defined in:
lib/appwrite/services/advisor.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Advisor

Returns a new instance of Advisor.



6
7
8
# File 'lib/appwrite/services/advisor.rb', line 6

def initialize(client)
    @client = client
end

Instance Method Details

#delete_report(report_id:) ⇒ Object

Delete an analyzer report by its unique ID. Nested insights and CTA metadata are removed asynchronously by the deletes worker.

Parameters:

  • report_id (String)

    Report ID.

Returns:



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/appwrite/services/advisor.rb', line 77

def delete_report(report_id:)
    api_path = '/reports/{reportId}'
        .gsub('{reportId}', report_id)

    if report_id.nil?
      raise Appwrite::Exception.new('Missing required parameter: "reportId"')
    end

    api_params = {
    }
    
    api_headers = {
        "content-type": 'application/json',
    }

    @client.call(
        method: 'DELETE',
        path: api_path,
        headers: api_headers,
        params: api_params,
    )

end

#get_insight(report_id:, insight_id:) ⇒ Insight

Get an insight by its unique ID, scoped to its parent report.

Parameters:

  • report_id (String)

    Parent report ID.

  • insight_id (String)

    Insight ID.

Returns:

  • (Insight)


143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/appwrite/services/advisor.rb', line 143

def get_insight(report_id:, insight_id:)
    api_path = '/reports/{reportId}/insights/{insightId}'
        .gsub('{reportId}', report_id)
        .gsub('{insightId}', insight_id)

    if report_id.nil?
      raise Appwrite::Exception.new('Missing required parameter: "reportId"')
    end

    if insight_id.nil?
      raise Appwrite::Exception.new('Missing required parameter: "insightId"')
    end

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::Insight
    )

end

#get_report(report_id:) ⇒ Report

Get an analyzer report by its unique ID. The response includes the report’s metadata and the nested insights it produced.

Parameters:

  • report_id (String)

    Report ID.

Returns:

  • (Report)


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/appwrite/services/advisor.rb', line 46

def get_report(report_id:)
    api_path = '/reports/{reportId}'
        .gsub('{reportId}', report_id)

    if report_id.nil?
      raise Appwrite::Exception.new('Missing required parameter: "reportId"')
    end

    api_params = {
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::Report
    )

end

#list_insights(report_id:, queries: nil, total: nil) ⇒ InsightList

List the insights produced under a single analyzer report. You can use the query params to filter your results further.

Parameters:

  • report_id (String)

    Parent report ID.

  • queries (Array) (defaults to: nil)

    Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](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

  • []

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (InsightList)


110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/appwrite/services/advisor.rb', line 110

def list_insights(report_id:, queries: nil, total: nil)
    api_path = '/reports/{reportId}/insights'
        .gsub('{reportId}', report_id)

    if report_id.nil?
      raise Appwrite::Exception.new('Missing required parameter: "reportId"')
    end

    api_params = {
        queries: queries,
        total: total,
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::InsightList
    )

end

#list_reports(queries: nil, total: nil) ⇒ ReportList

Get a list of all the project’s analyzer reports. You can use the query params to filter your results.

Parameters:

  • queries (Array) (defaults to: nil)

    Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](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

  • []

    total When set to false, the total count returned will be 0 and will not be calculated.

Returns:

  • (ReportList)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/appwrite/services/advisor.rb', line 18

def list_reports(queries: nil, total: nil)
    api_path = '/reports'

    api_params = {
        queries: queries,
        total: total,
    }
    
    api_headers = {
    }

    @client.call(
        method: 'GET',
        path: api_path,
        headers: api_headers,
        params: api_params,
        response_type: Models::ReportList
    )

end