appwrite 30.6.0 → 30.7.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.
- checksums.yaml +4 -4
- data/lib/appwrite/client.rb +1 -1
- data/lib/appwrite/enums/analytics_dimension.rb +32 -0
- data/lib/appwrite/enums/analytics_interval.rb +10 -0
- data/lib/appwrite/enums/analytics_property_type.rb +9 -0
- data/lib/appwrite/models/analytics_annotation.rb +58 -0
- data/lib/appwrite/models/analytics_annotation_list.rb +33 -0
- data/lib/appwrite/models/analytics_metric.rb +88 -0
- data/lib/appwrite/models/analytics_metric_list.rb +33 -0
- data/lib/appwrite/models/analytics_property.rb +94 -0
- data/lib/appwrite/models/analytics_property_list.rb +33 -0
- data/lib/appwrite/services/analytics.rb +594 -0
- data/lib/appwrite.rb +10 -0
- metadata +12 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aa89c91c10cf108a838123f7c9ffaadd5e19644dedb73929746e85815f378f09
|
|
4
|
+
data.tar.gz: 548cea4bad55f57ba3159ecb59eed887ec1322ccf61c72e08dd84e9c552e7cf2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fd4fddd0a94e3d6d90daed745e72aee0a25987f0fe0b01f64a069f9e5f8d83b9c95cf3208000932bf7e9405ac9bdae3bee3a5de137e930b65ff9327435ca24eb
|
|
7
|
+
data.tar.gz: acb6232e4855a83daf6300e9bbdecff156f084e186b23f3643f81ed2c38420aad55e50f554c712f78cd153acb8cdeb4f42ceedab7f415f07fa0f9ff4f7720e0f
|
data/lib/appwrite/client.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Appwrite
|
|
|
14
14
|
'x-sdk-name' => 'Ruby',
|
|
15
15
|
'x-sdk-platform' => 'server',
|
|
16
16
|
'x-sdk-language' => 'ruby',
|
|
17
|
-
'x-sdk-version' => '30.
|
|
17
|
+
'x-sdk-version' => '30.7.0',
|
|
18
18
|
'X-Appwrite-Response-Format' => '2.7.2'
|
|
19
19
|
}
|
|
20
20
|
@endpoint = 'https://cloud.appwrite.io/v1'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Appwrite
|
|
2
|
+
module Enums
|
|
3
|
+
module AnalyticsDimension
|
|
4
|
+
COUNTRY = 'country'
|
|
5
|
+
REGION = 'region'
|
|
6
|
+
CITY = 'city'
|
|
7
|
+
BROWSER = 'browser'
|
|
8
|
+
BROWSERVERSION = 'browserVersion'
|
|
9
|
+
OPERATINGSYSTEM = 'operatingSystem'
|
|
10
|
+
OPERATINGSYSTEMVERSION = 'operatingSystemVersion'
|
|
11
|
+
DEVICE = 'device'
|
|
12
|
+
SCREENSIZE = 'screenSize'
|
|
13
|
+
REFERRERSOURCE = 'referrerSource'
|
|
14
|
+
CHANNEL = 'channel'
|
|
15
|
+
UTMSOURCE = 'utmSource'
|
|
16
|
+
UTMMEDIUM = 'utmMedium'
|
|
17
|
+
UTMCAMPAIGN = 'utmCampaign'
|
|
18
|
+
UTMCONTENT = 'utmContent'
|
|
19
|
+
UTMTERM = 'utmTerm'
|
|
20
|
+
PAGE = 'page'
|
|
21
|
+
HOSTNAME = 'hostname'
|
|
22
|
+
ENTRYPAGE = 'entryPage'
|
|
23
|
+
EXITPAGE = 'exitPage'
|
|
24
|
+
TRAFFICTYPE = 'trafficType'
|
|
25
|
+
BOTNAME = 'botName'
|
|
26
|
+
BOTCATEGORY = 'botCategory'
|
|
27
|
+
USERID = 'userId'
|
|
28
|
+
EVENTNAME = 'eventName'
|
|
29
|
+
PROPS = 'props'
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class AnalyticsAnnotation
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :property_id
|
|
10
|
+
attr_reader :date
|
|
11
|
+
attr_reader :content
|
|
12
|
+
attr_reader :user_id
|
|
13
|
+
|
|
14
|
+
def initialize(
|
|
15
|
+
id:,
|
|
16
|
+
created_at:,
|
|
17
|
+
updated_at:,
|
|
18
|
+
property_id:,
|
|
19
|
+
date:,
|
|
20
|
+
content:,
|
|
21
|
+
user_id:
|
|
22
|
+
)
|
|
23
|
+
@id = id
|
|
24
|
+
@created_at = created_at
|
|
25
|
+
@updated_at = updated_at
|
|
26
|
+
@property_id = property_id
|
|
27
|
+
@date = date
|
|
28
|
+
@content = content
|
|
29
|
+
@user_id = user_id
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.from(map:)
|
|
33
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "propertyId" => "", "date" => "", "content" => "", "userId" => "" }.merge(map)
|
|
34
|
+
AnalyticsAnnotation.new(
|
|
35
|
+
id: map["$id"],
|
|
36
|
+
created_at: map["$createdAt"],
|
|
37
|
+
updated_at: map["$updatedAt"],
|
|
38
|
+
property_id: map["propertyId"],
|
|
39
|
+
date: map["date"],
|
|
40
|
+
content: map["content"],
|
|
41
|
+
user_id: map["userId"]
|
|
42
|
+
)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def to_map
|
|
46
|
+
{
|
|
47
|
+
"$id": @id,
|
|
48
|
+
"$createdAt": @created_at,
|
|
49
|
+
"$updatedAt": @updated_at,
|
|
50
|
+
"propertyId": @property_id,
|
|
51
|
+
"date": @date,
|
|
52
|
+
"content": @content,
|
|
53
|
+
"userId": @user_id
|
|
54
|
+
}
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class AnalyticsAnnotationList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :annotations
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
annotations:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@annotations = annotations
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "annotations" => [] }.merge(map)
|
|
19
|
+
AnalyticsAnnotationList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
annotations: map["annotations"].map { |it| AnalyticsAnnotation.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"annotations": @annotations.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class AnalyticsMetric
|
|
6
|
+
attr_reader :value
|
|
7
|
+
attr_reader :date
|
|
8
|
+
attr_reader :visitors
|
|
9
|
+
attr_reader :sessions
|
|
10
|
+
attr_reader :pageviews
|
|
11
|
+
attr_reader :events
|
|
12
|
+
attr_reader :users
|
|
13
|
+
attr_reader :visits
|
|
14
|
+
attr_reader :bounce_rate
|
|
15
|
+
attr_reader :visit_duration
|
|
16
|
+
attr_reader :views_per_visit
|
|
17
|
+
attr_reader :scroll_depth
|
|
18
|
+
attr_reader :engagement_time
|
|
19
|
+
|
|
20
|
+
def initialize(
|
|
21
|
+
value: nil,
|
|
22
|
+
date: nil,
|
|
23
|
+
visitors:,
|
|
24
|
+
sessions:,
|
|
25
|
+
pageviews: nil,
|
|
26
|
+
events:,
|
|
27
|
+
users: nil,
|
|
28
|
+
visits: nil,
|
|
29
|
+
bounce_rate: nil,
|
|
30
|
+
visit_duration: nil,
|
|
31
|
+
views_per_visit: nil,
|
|
32
|
+
scroll_depth: nil,
|
|
33
|
+
engagement_time: nil
|
|
34
|
+
)
|
|
35
|
+
@value = value
|
|
36
|
+
@date = date
|
|
37
|
+
@visitors = visitors
|
|
38
|
+
@sessions = sessions
|
|
39
|
+
@pageviews = pageviews
|
|
40
|
+
@events = events
|
|
41
|
+
@users = users
|
|
42
|
+
@visits = visits
|
|
43
|
+
@bounce_rate = bounce_rate
|
|
44
|
+
@visit_duration = visit_duration
|
|
45
|
+
@views_per_visit = views_per_visit
|
|
46
|
+
@scroll_depth = scroll_depth
|
|
47
|
+
@engagement_time = engagement_time
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.from(map:)
|
|
51
|
+
map = { "visitors" => 0, "sessions" => 0, "events" => 0 }.merge(map)
|
|
52
|
+
AnalyticsMetric.new(
|
|
53
|
+
value: map["value"],
|
|
54
|
+
date: map["date"],
|
|
55
|
+
visitors: map["visitors"],
|
|
56
|
+
sessions: map["sessions"],
|
|
57
|
+
pageviews: map["pageviews"],
|
|
58
|
+
events: map["events"],
|
|
59
|
+
users: map["users"],
|
|
60
|
+
visits: map["visits"],
|
|
61
|
+
bounce_rate: map["bounceRate"],
|
|
62
|
+
visit_duration: map["visitDuration"],
|
|
63
|
+
views_per_visit: map["viewsPerVisit"],
|
|
64
|
+
scroll_depth: map["scrollDepth"],
|
|
65
|
+
engagement_time: map["engagementTime"]
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def to_map
|
|
70
|
+
{
|
|
71
|
+
"value": @value,
|
|
72
|
+
"date": @date,
|
|
73
|
+
"visitors": @visitors,
|
|
74
|
+
"sessions": @sessions,
|
|
75
|
+
"pageviews": @pageviews,
|
|
76
|
+
"events": @events,
|
|
77
|
+
"users": @users,
|
|
78
|
+
"visits": @visits,
|
|
79
|
+
"bounceRate": @bounce_rate,
|
|
80
|
+
"visitDuration": @visit_duration,
|
|
81
|
+
"viewsPerVisit": @views_per_visit,
|
|
82
|
+
"scrollDepth": @scroll_depth,
|
|
83
|
+
"engagementTime": @engagement_time
|
|
84
|
+
}
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class AnalyticsMetricList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :metrics
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
metrics:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@metrics = metrics
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "metrics" => [] }.merge(map)
|
|
19
|
+
AnalyticsMetricList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
metrics: map["metrics"].map { |it| AnalyticsMetric.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"metrics": @metrics.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class AnalyticsProperty
|
|
6
|
+
attr_reader :id
|
|
7
|
+
attr_reader :created_at
|
|
8
|
+
attr_reader :updated_at
|
|
9
|
+
attr_reader :name
|
|
10
|
+
attr_reader :domain
|
|
11
|
+
attr_reader :enabled
|
|
12
|
+
attr_reader :allowed_origins
|
|
13
|
+
attr_reader :type
|
|
14
|
+
attr_reader :identify_users
|
|
15
|
+
attr_reader :accessed_at
|
|
16
|
+
attr_reader :first_accessed_at
|
|
17
|
+
|
|
18
|
+
def initialize(
|
|
19
|
+
id:,
|
|
20
|
+
created_at:,
|
|
21
|
+
updated_at:,
|
|
22
|
+
name:,
|
|
23
|
+
domain:,
|
|
24
|
+
enabled:,
|
|
25
|
+
allowed_origins:,
|
|
26
|
+
type:,
|
|
27
|
+
identify_users:,
|
|
28
|
+
accessed_at:,
|
|
29
|
+
first_accessed_at:
|
|
30
|
+
)
|
|
31
|
+
@id = id
|
|
32
|
+
@created_at = created_at
|
|
33
|
+
@updated_at = updated_at
|
|
34
|
+
@name = name
|
|
35
|
+
@domain = domain
|
|
36
|
+
@enabled = enabled
|
|
37
|
+
@allowed_origins = allowed_origins
|
|
38
|
+
@type = validate_type(type)
|
|
39
|
+
@identify_users = identify_users
|
|
40
|
+
@accessed_at = accessed_at
|
|
41
|
+
@first_accessed_at = first_accessed_at
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.from(map:)
|
|
45
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "name" => "", "domain" => "", "enabled" => true, "allowedOrigins" => ["*"], "type" => "web", "identifyUsers" => false, "accessedAt" => "", "firstAccessedAt" => "" }.merge(map)
|
|
46
|
+
AnalyticsProperty.new(
|
|
47
|
+
id: map["$id"],
|
|
48
|
+
created_at: map["$createdAt"],
|
|
49
|
+
updated_at: map["$updatedAt"],
|
|
50
|
+
name: map["name"],
|
|
51
|
+
domain: map["domain"],
|
|
52
|
+
enabled: map["enabled"],
|
|
53
|
+
allowed_origins: map["allowedOrigins"],
|
|
54
|
+
type: map["type"],
|
|
55
|
+
identify_users: map["identifyUsers"],
|
|
56
|
+
accessed_at: map["accessedAt"],
|
|
57
|
+
first_accessed_at: map["firstAccessedAt"]
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def to_map
|
|
62
|
+
{
|
|
63
|
+
"$id": @id,
|
|
64
|
+
"$createdAt": @created_at,
|
|
65
|
+
"$updatedAt": @updated_at,
|
|
66
|
+
"name": @name,
|
|
67
|
+
"domain": @domain,
|
|
68
|
+
"enabled": @enabled,
|
|
69
|
+
"allowedOrigins": @allowed_origins,
|
|
70
|
+
"type": @type,
|
|
71
|
+
"identifyUsers": @identify_users,
|
|
72
|
+
"accessedAt": @accessed_at,
|
|
73
|
+
"firstAccessedAt": @first_accessed_at
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
def validate_type(type)
|
|
80
|
+
valid_type = [
|
|
81
|
+
Appwrite::Enums::AnalyticsPropertyType::WEB,
|
|
82
|
+
Appwrite::Enums::AnalyticsPropertyType::MOBILE,
|
|
83
|
+
Appwrite::Enums::AnalyticsPropertyType::AGENT,
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
unless valid_type.include?(type)
|
|
87
|
+
raise ArgumentError, "Invalid " + type + ". Must be one of: " + valid_type.join(', ')
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
type
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
module Models
|
|
5
|
+
class AnalyticsPropertyList
|
|
6
|
+
attr_reader :total
|
|
7
|
+
attr_reader :properties
|
|
8
|
+
|
|
9
|
+
def initialize(
|
|
10
|
+
total:,
|
|
11
|
+
properties:
|
|
12
|
+
)
|
|
13
|
+
@total = total
|
|
14
|
+
@properties = properties
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.from(map:)
|
|
18
|
+
map = { "total" => 0, "properties" => [] }.merge(map)
|
|
19
|
+
AnalyticsPropertyList.new(
|
|
20
|
+
total: map["total"],
|
|
21
|
+
properties: map["properties"].map { |it| AnalyticsProperty.from(map: it) }
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def to_map
|
|
26
|
+
{
|
|
27
|
+
"total": @total,
|
|
28
|
+
"properties": @properties.map { |it| it.to_map }
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Appwrite
|
|
4
|
+
class Analytics < Service
|
|
5
|
+
def initialize(client)
|
|
6
|
+
@client = client
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# List analytics properties for the current project.
|
|
10
|
+
#
|
|
11
|
+
# @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: name, domain, enabled, type
|
|
12
|
+
# @param [String] search Search term to filter your list results. Matches the property ID, name and domain. Max length: 256 chars.
|
|
13
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
14
|
+
#
|
|
15
|
+
# @return [AnalyticsPropertyList]
|
|
16
|
+
def list_properties(
|
|
17
|
+
queries: nil,
|
|
18
|
+
search: nil,
|
|
19
|
+
total: nil
|
|
20
|
+
)
|
|
21
|
+
api_path = '/analytics/properties'
|
|
22
|
+
|
|
23
|
+
api_params = {
|
|
24
|
+
queries: queries,
|
|
25
|
+
search: search,
|
|
26
|
+
total: total,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
api_headers = {
|
|
30
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
31
|
+
"accept": 'application/json',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@client.call(
|
|
35
|
+
method: 'GET',
|
|
36
|
+
path: api_path,
|
|
37
|
+
headers: api_headers,
|
|
38
|
+
params: api_params,
|
|
39
|
+
response_type: Models::AnalyticsPropertyList
|
|
40
|
+
)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Create a new analytics property to track a website or application.
|
|
44
|
+
#
|
|
45
|
+
# @param [String] property_id Unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Max length is 36 chars.
|
|
46
|
+
# @param [String] name Human-readable name for this property.
|
|
47
|
+
# @param [String] domain Primary domain to track (e.g. example.com). May be empty for mobile and agent properties.
|
|
48
|
+
# @param [] enabled Whether the property accepts events. Events sent to a disabled property are rejected as not found.
|
|
49
|
+
# @param [Array] allowed_origins Allowed origins for tracking. Use ["*"] to allow all.
|
|
50
|
+
# @param [] identify_users Record the signed-in user's ID on events sent from a client session, so traffic can be broken down and counted by user. Off by default.
|
|
51
|
+
# @param [AnalyticsPropertyType] type Kind of product this property tracks. Only changes which panels the dashboard shows; ingestion accepts the same events for every type.
|
|
52
|
+
#
|
|
53
|
+
# @return [AnalyticsProperty]
|
|
54
|
+
def create_property(
|
|
55
|
+
property_id:,
|
|
56
|
+
name:,
|
|
57
|
+
domain: nil,
|
|
58
|
+
enabled: nil,
|
|
59
|
+
allowed_origins: nil,
|
|
60
|
+
identify_users: nil,
|
|
61
|
+
type: nil
|
|
62
|
+
)
|
|
63
|
+
if property_id.nil?
|
|
64
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
if name.nil?
|
|
68
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
api_path = '/analytics/properties'
|
|
72
|
+
|
|
73
|
+
api_params = {
|
|
74
|
+
propertyId: property_id,
|
|
75
|
+
name: name,
|
|
76
|
+
domain: domain,
|
|
77
|
+
enabled: enabled,
|
|
78
|
+
allowedOrigins: allowed_origins,
|
|
79
|
+
identifyUsers: identify_users,
|
|
80
|
+
type: type,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
api_headers = {
|
|
84
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
85
|
+
"content-type": 'application/json',
|
|
86
|
+
"accept": 'application/json',
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@client.call(
|
|
90
|
+
method: 'POST',
|
|
91
|
+
path: api_path,
|
|
92
|
+
headers: api_headers,
|
|
93
|
+
params: api_params,
|
|
94
|
+
response_type: Models::AnalyticsProperty
|
|
95
|
+
)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# Get an analytics property by ID.
|
|
99
|
+
#
|
|
100
|
+
# @param [String] property_id Analytics property unique ID.
|
|
101
|
+
#
|
|
102
|
+
# @return [AnalyticsProperty]
|
|
103
|
+
def get_property(
|
|
104
|
+
property_id:
|
|
105
|
+
)
|
|
106
|
+
if property_id.nil? || property_id == ''
|
|
107
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
api_path = '/analytics/properties/{propertyId}'
|
|
111
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
112
|
+
|
|
113
|
+
api_params = {}
|
|
114
|
+
|
|
115
|
+
api_headers = {
|
|
116
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
117
|
+
"accept": 'application/json',
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@client.call(
|
|
121
|
+
method: 'GET',
|
|
122
|
+
path: api_path,
|
|
123
|
+
headers: api_headers,
|
|
124
|
+
params: api_params,
|
|
125
|
+
response_type: Models::AnalyticsProperty
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Update an analytics property. Only the attributes you pass are changed;
|
|
130
|
+
# omitted attributes keep their current value.
|
|
131
|
+
#
|
|
132
|
+
# @param [String] property_id Analytics property unique ID.
|
|
133
|
+
# @param [String] name Human-readable name for this property.
|
|
134
|
+
# @param [String] domain Primary domain to track (e.g. example.com). Pass an empty string to clear it.
|
|
135
|
+
# @param [] enabled Whether the property accepts events. Events sent to a disabled property are rejected as not found.
|
|
136
|
+
# @param [Array] allowed_origins Allowed origins for tracking. Use ["*"] to allow all. On a property linked to a site, Appwrite manages this list: it is rewritten from the site's production domains whenever they change.
|
|
137
|
+
# @param [] identify_users Record the signed-in user's ID on events sent from a client session, so traffic can be broken down and counted by user.
|
|
138
|
+
# @param [AnalyticsPropertyType] type Kind of product this property tracks. Only changes which panels the dashboard shows; stored events are kept.
|
|
139
|
+
#
|
|
140
|
+
# @return [AnalyticsProperty]
|
|
141
|
+
def update_property(
|
|
142
|
+
property_id:,
|
|
143
|
+
name: nil,
|
|
144
|
+
domain: nil,
|
|
145
|
+
enabled: nil,
|
|
146
|
+
allowed_origins: nil,
|
|
147
|
+
identify_users: nil,
|
|
148
|
+
type: nil
|
|
149
|
+
)
|
|
150
|
+
if property_id.nil? || property_id == ''
|
|
151
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
api_path = '/analytics/properties/{propertyId}'
|
|
155
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
156
|
+
|
|
157
|
+
api_params = {
|
|
158
|
+
name: name,
|
|
159
|
+
domain: domain,
|
|
160
|
+
enabled: enabled,
|
|
161
|
+
allowedOrigins: allowed_origins,
|
|
162
|
+
identifyUsers: identify_users,
|
|
163
|
+
type: type,
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
api_headers = {
|
|
167
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
168
|
+
"content-type": 'application/json',
|
|
169
|
+
"accept": 'application/json',
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@client.call(
|
|
173
|
+
method: 'PATCH',
|
|
174
|
+
path: api_path,
|
|
175
|
+
headers: api_headers,
|
|
176
|
+
params: api_params,
|
|
177
|
+
response_type: Models::AnalyticsProperty
|
|
178
|
+
)
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
# Delete an analytics property along with every event and session collected
|
|
182
|
+
# for it. This cannot be undone.
|
|
183
|
+
#
|
|
184
|
+
# @param [String] property_id Analytics property unique ID.
|
|
185
|
+
#
|
|
186
|
+
# @return []
|
|
187
|
+
def delete_property(
|
|
188
|
+
property_id:
|
|
189
|
+
)
|
|
190
|
+
if property_id.nil? || property_id == ''
|
|
191
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
api_path = '/analytics/properties/{propertyId}'
|
|
195
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
196
|
+
|
|
197
|
+
api_params = {}
|
|
198
|
+
|
|
199
|
+
api_headers = {
|
|
200
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
201
|
+
"content-type": 'application/json',
|
|
202
|
+
"accept": 'application/json',
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
@client.call(
|
|
206
|
+
method: 'DELETE',
|
|
207
|
+
path: api_path,
|
|
208
|
+
headers: api_headers,
|
|
209
|
+
params: api_params,
|
|
210
|
+
)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# List the annotations of an analytics property. Filter on `date` to fetch
|
|
214
|
+
# the annotations inside a chart's time range.
|
|
215
|
+
#
|
|
216
|
+
# @param [String] property_id Analytics property unique ID.
|
|
217
|
+
# @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: date
|
|
218
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
219
|
+
#
|
|
220
|
+
# @return [AnalyticsAnnotationList]
|
|
221
|
+
def list_annotations(
|
|
222
|
+
property_id:,
|
|
223
|
+
queries: nil,
|
|
224
|
+
total: nil
|
|
225
|
+
)
|
|
226
|
+
if property_id.nil? || property_id == ''
|
|
227
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
api_path = '/analytics/properties/{propertyId}/annotations'
|
|
231
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
232
|
+
|
|
233
|
+
api_params = {
|
|
234
|
+
queries: queries,
|
|
235
|
+
total: total,
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
api_headers = {
|
|
239
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
240
|
+
"accept": 'application/json',
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@client.call(
|
|
244
|
+
method: 'GET',
|
|
245
|
+
path: api_path,
|
|
246
|
+
headers: api_headers,
|
|
247
|
+
params: api_params,
|
|
248
|
+
response_type: Models::AnalyticsAnnotationList
|
|
249
|
+
)
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# Create an annotation that marks a point in time on an analytics property's
|
|
253
|
+
# charts.
|
|
254
|
+
#
|
|
255
|
+
# @param [String] property_id Analytics property unique ID.
|
|
256
|
+
# @param [String] annotation_id Unique ID. Choose a custom ID or generate a random ID with `ID.unique()`. Max length is 36 chars.
|
|
257
|
+
# @param [String] date Point in time the annotation marks, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
|
258
|
+
# @param [String] content Annotation text. Max length: 512 chars.
|
|
259
|
+
#
|
|
260
|
+
# @return [AnalyticsAnnotation]
|
|
261
|
+
def create_annotation(
|
|
262
|
+
property_id:,
|
|
263
|
+
annotation_id:,
|
|
264
|
+
date:,
|
|
265
|
+
content:
|
|
266
|
+
)
|
|
267
|
+
if property_id.nil? || property_id == ''
|
|
268
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
if annotation_id.nil?
|
|
272
|
+
raise Appwrite::Exception.new('Missing required parameter: "annotationId"')
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
if date.nil?
|
|
276
|
+
raise Appwrite::Exception.new('Missing required parameter: "date"')
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
if content.nil?
|
|
280
|
+
raise Appwrite::Exception.new('Missing required parameter: "content"')
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
api_path = '/analytics/properties/{propertyId}/annotations'
|
|
284
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
285
|
+
|
|
286
|
+
api_params = {
|
|
287
|
+
annotationId: annotation_id,
|
|
288
|
+
date: date,
|
|
289
|
+
content: content,
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
api_headers = {
|
|
293
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
294
|
+
"content-type": 'application/json',
|
|
295
|
+
"accept": 'application/json',
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@client.call(
|
|
299
|
+
method: 'POST',
|
|
300
|
+
path: api_path,
|
|
301
|
+
headers: api_headers,
|
|
302
|
+
params: api_params,
|
|
303
|
+
response_type: Models::AnalyticsAnnotation
|
|
304
|
+
)
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
# Get an analytics annotation by ID.
|
|
308
|
+
#
|
|
309
|
+
# @param [String] property_id Analytics property unique ID.
|
|
310
|
+
# @param [String] annotation_id Annotation unique ID.
|
|
311
|
+
#
|
|
312
|
+
# @return [AnalyticsAnnotation]
|
|
313
|
+
def get_annotation(
|
|
314
|
+
property_id:,
|
|
315
|
+
annotation_id:
|
|
316
|
+
)
|
|
317
|
+
if property_id.nil? || property_id == ''
|
|
318
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
if annotation_id.nil? || annotation_id == ''
|
|
322
|
+
raise Appwrite::Exception.new('Missing required parameter: "annotationId"')
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
api_path = '/analytics/properties/{propertyId}/annotations/{annotationId}'
|
|
326
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
327
|
+
.gsub('{annotationId}', @client.encode_path(annotation_id))
|
|
328
|
+
|
|
329
|
+
api_params = {}
|
|
330
|
+
|
|
331
|
+
api_headers = {
|
|
332
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
333
|
+
"accept": 'application/json',
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@client.call(
|
|
337
|
+
method: 'GET',
|
|
338
|
+
path: api_path,
|
|
339
|
+
headers: api_headers,
|
|
340
|
+
params: api_params,
|
|
341
|
+
response_type: Models::AnalyticsAnnotation
|
|
342
|
+
)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# Update an analytics annotation. Only the attributes you pass are changed;
|
|
346
|
+
# omitted attributes keep their current value.
|
|
347
|
+
#
|
|
348
|
+
# @param [String] property_id Analytics property unique ID.
|
|
349
|
+
# @param [String] annotation_id Annotation unique ID.
|
|
350
|
+
# @param [String] date Point in time the annotation marks, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
|
|
351
|
+
# @param [String] content Annotation text. Max length: 512 chars.
|
|
352
|
+
#
|
|
353
|
+
# @return [AnalyticsAnnotation]
|
|
354
|
+
def update_annotation(
|
|
355
|
+
property_id:,
|
|
356
|
+
annotation_id:,
|
|
357
|
+
date: nil,
|
|
358
|
+
content: nil
|
|
359
|
+
)
|
|
360
|
+
if property_id.nil? || property_id == ''
|
|
361
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
if annotation_id.nil? || annotation_id == ''
|
|
365
|
+
raise Appwrite::Exception.new('Missing required parameter: "annotationId"')
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
api_path = '/analytics/properties/{propertyId}/annotations/{annotationId}'
|
|
369
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
370
|
+
.gsub('{annotationId}', @client.encode_path(annotation_id))
|
|
371
|
+
|
|
372
|
+
api_params = {
|
|
373
|
+
date: date,
|
|
374
|
+
content: content,
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
api_headers = {
|
|
378
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
379
|
+
"content-type": 'application/json',
|
|
380
|
+
"accept": 'application/json',
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
@client.call(
|
|
384
|
+
method: 'PATCH',
|
|
385
|
+
path: api_path,
|
|
386
|
+
headers: api_headers,
|
|
387
|
+
params: api_params,
|
|
388
|
+
response_type: Models::AnalyticsAnnotation
|
|
389
|
+
)
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
# Delete an analytics annotation.
|
|
393
|
+
#
|
|
394
|
+
# @param [String] property_id Analytics property unique ID.
|
|
395
|
+
# @param [String] annotation_id Annotation unique ID.
|
|
396
|
+
#
|
|
397
|
+
# @return []
|
|
398
|
+
def delete_annotation(
|
|
399
|
+
property_id:,
|
|
400
|
+
annotation_id:
|
|
401
|
+
)
|
|
402
|
+
if property_id.nil? || property_id == ''
|
|
403
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
if annotation_id.nil? || annotation_id == ''
|
|
407
|
+
raise Appwrite::Exception.new('Missing required parameter: "annotationId"')
|
|
408
|
+
end
|
|
409
|
+
|
|
410
|
+
api_path = '/analytics/properties/{propertyId}/annotations/{annotationId}'
|
|
411
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
412
|
+
.gsub('{annotationId}', @client.encode_path(annotation_id))
|
|
413
|
+
|
|
414
|
+
api_params = {}
|
|
415
|
+
|
|
416
|
+
api_headers = {
|
|
417
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
418
|
+
"content-type": 'application/json',
|
|
419
|
+
"accept": 'application/json',
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
@client.call(
|
|
423
|
+
method: 'DELETE',
|
|
424
|
+
path: api_path,
|
|
425
|
+
headers: api_headers,
|
|
426
|
+
params: api_params,
|
|
427
|
+
)
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
# Send a tracking event from a browser, native app, or server-side SDK.
|
|
431
|
+
#
|
|
432
|
+
# @param [String] property_id Analytics property ID.
|
|
433
|
+
# @param [String] name Event name. "pageview" and "screen_view" are counted as views, every other name is a custom event.
|
|
434
|
+
# @param [String] url Full page URL or screen identifier.
|
|
435
|
+
# @param [String] domain Hostname (e.g. example.com).
|
|
436
|
+
# @param [String] referrer Referrer URL.
|
|
437
|
+
# @param [Integer] screen_width Viewport width in CSS pixels.
|
|
438
|
+
# @param [String] session_hash Optional session hash (provided by SDK).
|
|
439
|
+
# @param [Integer] scroll_depth Scroll depth percentage 0-100.
|
|
440
|
+
# @param [Integer] engagement_time Engagement time in seconds, 0-4294967295.
|
|
441
|
+
# @param [Array] props Custom string properties as a flat key=value list (max 32 entries, alternating key,value).
|
|
442
|
+
# @param [String] user_id Override user ID. Pass an opaque ID, not personal data such as an email. Requires API-key auth with analytics.write scope.
|
|
443
|
+
# @param [String] ip Override IP address. Requires API-key auth with analytics.write scope.
|
|
444
|
+
# @param [String] user_agent Override user agent. Requires API-key auth with analytics.write scope.
|
|
445
|
+
# @param [] interactive Whether this event is a visitor interaction that ends a bounce. Set false for telemetry such as heartbeats or background syncs. Defaults to true for custom events and false for the automatic engagement, scroll and app lifecycle events. Ignored for views.
|
|
446
|
+
#
|
|
447
|
+
# @return []
|
|
448
|
+
def create_event(
|
|
449
|
+
property_id:,
|
|
450
|
+
name:,
|
|
451
|
+
url:,
|
|
452
|
+
domain: nil,
|
|
453
|
+
referrer: nil,
|
|
454
|
+
screen_width: nil,
|
|
455
|
+
session_hash: nil,
|
|
456
|
+
scroll_depth: nil,
|
|
457
|
+
engagement_time: nil,
|
|
458
|
+
props: nil,
|
|
459
|
+
user_id: nil,
|
|
460
|
+
ip: nil,
|
|
461
|
+
user_agent: nil,
|
|
462
|
+
interactive: nil
|
|
463
|
+
)
|
|
464
|
+
if property_id.nil? || property_id == ''
|
|
465
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
if name.nil?
|
|
469
|
+
raise Appwrite::Exception.new('Missing required parameter: "name"')
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
if url.nil?
|
|
473
|
+
raise Appwrite::Exception.new('Missing required parameter: "url"')
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
api_path = '/analytics/properties/{propertyId}/events'
|
|
477
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
478
|
+
|
|
479
|
+
api_params = {
|
|
480
|
+
name: name,
|
|
481
|
+
url: url,
|
|
482
|
+
domain: domain,
|
|
483
|
+
referrer: referrer,
|
|
484
|
+
screenWidth: screen_width,
|
|
485
|
+
sessionHash: session_hash,
|
|
486
|
+
scrollDepth: scroll_depth,
|
|
487
|
+
engagementTime: engagement_time,
|
|
488
|
+
props: props,
|
|
489
|
+
userId: user_id,
|
|
490
|
+
ip: ip,
|
|
491
|
+
userAgent: user_agent,
|
|
492
|
+
interactive: interactive,
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
api_headers = {
|
|
496
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
497
|
+
"content-type": 'application/json',
|
|
498
|
+
"accept": 'application/json',
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
@client.call(
|
|
502
|
+
method: 'POST',
|
|
503
|
+
path: api_path,
|
|
504
|
+
headers: api_headers,
|
|
505
|
+
params: api_params,
|
|
506
|
+
)
|
|
507
|
+
end
|
|
508
|
+
|
|
509
|
+
# Read analytics metrics (visitors, sessions, pageviews, events, bounceRate,
|
|
510
|
+
# …) for a property over a date range.
|
|
511
|
+
#
|
|
512
|
+
# **Three response shapes**, chosen by `dimensions[]` and `interval`:
|
|
513
|
+
# - Neither: one row aggregating the whole window, with `value` and `date`
|
|
514
|
+
# null. Only this shape carries `visits`, `bounceRate`, `visitDuration`,
|
|
515
|
+
# `viewsPerVisit`, `scrollDepth` and `engagementTime`.
|
|
516
|
+
# - `dimensions[]`: one row per dimension value, ranked by visitors, with
|
|
517
|
+
# `value` set and `date` null.
|
|
518
|
+
# - `interval`: one row per time bucket in chronological order, with `date`
|
|
519
|
+
# set and `value` null.
|
|
520
|
+
#
|
|
521
|
+
# `pageviews` is carried by the flat aggregate and by `interval`, but not by
|
|
522
|
+
# a breakdown.
|
|
523
|
+
#
|
|
524
|
+
# `userId` and `users` cover identified traffic only: events sent with an API
|
|
525
|
+
# key's `userId`, or from a signed-in session on a property with
|
|
526
|
+
# `identifyUsers` on. A `userId` breakdown leaves out anonymous events;
|
|
527
|
+
# returned values are the project's user IDs.
|
|
528
|
+
#
|
|
529
|
+
# Custom event props: `dimensions[]=props` ranks the prop keys seen in the
|
|
530
|
+
# window, and adding `propKey` ranks the values of that one key. `queries[]`
|
|
531
|
+
# filters on a prop's value with the `props.<key>` attribute, e.g.
|
|
532
|
+
# `equal("props.plan", ["pro"])`.
|
|
533
|
+
#
|
|
534
|
+
# Combining `dimensions[]` with `interval` is not supported yet. `queries[]`
|
|
535
|
+
# filters the underlying events using standard Utopia query syntax.
|
|
536
|
+
#
|
|
537
|
+
# @param [String] property_id Analytics property unique ID.
|
|
538
|
+
# @param [Array] queries Up to 10 filter queries in Utopia syntax. Allowed attributes: country, region, city, browser, browserVersion, operatingSystem, operatingSystemVersion, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, trafficType, botName, botCategory, userId, eventName, and `props.<key>` for a custom prop. page, userId, eventName and `props.<key>` are only accepted alongside `interval`, or with a breakdown on a dimension other than entryPage, exitPage. Allowed methods: equal, notEqual, contains, startsWith, endsWith. Example: `queries[]=equal("country", ["US"])`.
|
|
539
|
+
# @param [AnalyticsInterval] interval Time bucket size. Omit (null) for a flat aggregate over the whole window. Allowed: 1h, 1d, 1w, 1m.
|
|
540
|
+
# @param [Array] dimensions Dimension to break the metrics down by. One at most for now; the parameter is a list so that cap can be raised without a breaking change. Allowed: country, region, city, browser, browserVersion, operatingSystem, operatingSystemVersion, device, screenSize, referrerSource, channel, utmSource, utmMedium, utmCampaign, utmContent, utmTerm, page, hostname, entryPage, exitPage, trafficType, botName, botCategory, userId, eventName, props.
|
|
541
|
+
# @param [String] prop_key Custom prop key whose values to rank, with `dimensions[]=props`. Omit to rank the prop keys themselves.
|
|
542
|
+
# @param [String] date_range Date range shorthand (e.g. 7d, 30d). Ignored for any bound you supply explicitly via startAt/endAt.
|
|
543
|
+
# @param [String] start_at Explicit window start in ISO 8601. Defaults to endAt minus dateRange.
|
|
544
|
+
# @param [String] end_at Explicit window end in ISO 8601. Defaults to the current time.
|
|
545
|
+
# @param [Integer] limit Maximum number of ranked values to return.
|
|
546
|
+
# @param [] total When set to false, the total count returned will be 0 and will not be calculated.
|
|
547
|
+
#
|
|
548
|
+
# @return [AnalyticsMetricList]
|
|
549
|
+
def list_metrics(
|
|
550
|
+
property_id:,
|
|
551
|
+
queries: nil,
|
|
552
|
+
interval: nil,
|
|
553
|
+
dimensions: nil,
|
|
554
|
+
prop_key: nil,
|
|
555
|
+
date_range: nil,
|
|
556
|
+
start_at: nil,
|
|
557
|
+
end_at: nil,
|
|
558
|
+
limit: nil,
|
|
559
|
+
total: nil
|
|
560
|
+
)
|
|
561
|
+
if property_id.nil? || property_id == ''
|
|
562
|
+
raise Appwrite::Exception.new('Missing required parameter: "propertyId"')
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
api_path = '/analytics/properties/{propertyId}/metrics'
|
|
566
|
+
.gsub('{propertyId}', @client.encode_path(property_id))
|
|
567
|
+
|
|
568
|
+
api_params = {
|
|
569
|
+
queries: queries,
|
|
570
|
+
interval: interval,
|
|
571
|
+
dimensions: dimensions,
|
|
572
|
+
propKey: prop_key,
|
|
573
|
+
dateRange: date_range,
|
|
574
|
+
startAt: start_at,
|
|
575
|
+
endAt: end_at,
|
|
576
|
+
limit: limit,
|
|
577
|
+
total: total,
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
api_headers = {
|
|
581
|
+
"X-Appwrite-Project": @client.get_config('project'),
|
|
582
|
+
"accept": 'application/json',
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
@client.call(
|
|
586
|
+
method: 'GET',
|
|
587
|
+
path: api_path,
|
|
588
|
+
headers: api_headers,
|
|
589
|
+
params: api_params,
|
|
590
|
+
response_type: Models::AnalyticsMetricList
|
|
591
|
+
)
|
|
592
|
+
end
|
|
593
|
+
end
|
|
594
|
+
end
|
data/lib/appwrite.rb
CHANGED
|
@@ -288,6 +288,10 @@ require_relative 'appwrite/models/video_rendition'
|
|
|
288
288
|
require_relative 'appwrite/models/video_caption'
|
|
289
289
|
require_relative 'appwrite/models/activity_event'
|
|
290
290
|
require_relative 'appwrite/models/additional_resource'
|
|
291
|
+
require_relative 'appwrite/models/analytics_annotation'
|
|
292
|
+
require_relative 'appwrite/models/analytics_metric'
|
|
293
|
+
require_relative 'appwrite/models/analytics_metric_list'
|
|
294
|
+
require_relative 'appwrite/models/analytics_property'
|
|
291
295
|
require_relative 'appwrite/models/backup_archive'
|
|
292
296
|
require_relative 'appwrite/models/dedicated_database_backup'
|
|
293
297
|
require_relative 'appwrite/models/dedicated_database_backup_list'
|
|
@@ -363,6 +367,8 @@ require_relative 'appwrite/models/oauth2_organization_list'
|
|
|
363
367
|
require_relative 'appwrite/models/oauth2_consent_list'
|
|
364
368
|
require_relative 'appwrite/models/oauth2_consent_token_list'
|
|
365
369
|
require_relative 'appwrite/models/activity_event_list'
|
|
370
|
+
require_relative 'appwrite/models/analytics_property_list'
|
|
371
|
+
require_relative 'appwrite/models/analytics_annotation_list'
|
|
366
372
|
require_relative 'appwrite/models/backup_archive_list'
|
|
367
373
|
require_relative 'appwrite/models/backup_policy_list'
|
|
368
374
|
require_relative 'appwrite/models/backup_restoration_list'
|
|
@@ -381,6 +387,9 @@ require_relative 'appwrite/enums/authenticator_type'
|
|
|
381
387
|
require_relative 'appwrite/enums/authentication_factor'
|
|
382
388
|
require_relative 'appwrite/enums/id_token_provider'
|
|
383
389
|
require_relative 'appwrite/enums/o_auth_provider'
|
|
390
|
+
require_relative 'appwrite/enums/analytics_property_type'
|
|
391
|
+
require_relative 'appwrite/enums/analytics_interval'
|
|
392
|
+
require_relative 'appwrite/enums/analytics_dimension'
|
|
384
393
|
require_relative 'appwrite/enums/browser'
|
|
385
394
|
require_relative 'appwrite/enums/credit_card'
|
|
386
395
|
require_relative 'appwrite/enums/flag'
|
|
@@ -489,6 +498,7 @@ require_relative 'appwrite/enums/waf_rule_action'
|
|
|
489
498
|
require_relative 'appwrite/services/account'
|
|
490
499
|
require_relative 'appwrite/services/activities'
|
|
491
500
|
require_relative 'appwrite/services/alerts'
|
|
501
|
+
require_relative 'appwrite/services/analytics'
|
|
492
502
|
require_relative 'appwrite/services/apps'
|
|
493
503
|
require_relative 'appwrite/services/avatars'
|
|
494
504
|
require_relative 'appwrite/services/backups'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appwrite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 30.
|
|
4
|
+
version: 30.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Appwrite Team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mime-types
|
|
@@ -36,6 +36,9 @@ files:
|
|
|
36
36
|
- lib/appwrite/enums/alert_comparator.rb
|
|
37
37
|
- lib/appwrite/enums/alert_metric.rb
|
|
38
38
|
- lib/appwrite/enums/alert_status.rb
|
|
39
|
+
- lib/appwrite/enums/analytics_dimension.rb
|
|
40
|
+
- lib/appwrite/enums/analytics_interval.rb
|
|
41
|
+
- lib/appwrite/enums/analytics_property_type.rb
|
|
39
42
|
- lib/appwrite/enums/appwrite_migration_resource.rb
|
|
40
43
|
- lib/appwrite/enums/attribute_status.rb
|
|
41
44
|
- lib/appwrite/enums/authentication_factor.rb
|
|
@@ -156,6 +159,12 @@ files:
|
|
|
156
159
|
- lib/appwrite/models/algo_scrypt.rb
|
|
157
160
|
- lib/appwrite/models/algo_scrypt_modified.rb
|
|
158
161
|
- lib/appwrite/models/algo_sha.rb
|
|
162
|
+
- lib/appwrite/models/analytics_annotation.rb
|
|
163
|
+
- lib/appwrite/models/analytics_annotation_list.rb
|
|
164
|
+
- lib/appwrite/models/analytics_metric.rb
|
|
165
|
+
- lib/appwrite/models/analytics_metric_list.rb
|
|
166
|
+
- lib/appwrite/models/analytics_property.rb
|
|
167
|
+
- lib/appwrite/models/analytics_property_list.rb
|
|
159
168
|
- lib/appwrite/models/app.rb
|
|
160
169
|
- lib/appwrite/models/app_installation.rb
|
|
161
170
|
- lib/appwrite/models/app_installation_list.rb
|
|
@@ -513,6 +522,7 @@ files:
|
|
|
513
522
|
- lib/appwrite/services/activities.rb
|
|
514
523
|
- lib/appwrite/services/advisor.rb
|
|
515
524
|
- lib/appwrite/services/alerts.rb
|
|
525
|
+
- lib/appwrite/services/analytics.rb
|
|
516
526
|
- lib/appwrite/services/apps.rb
|
|
517
527
|
- lib/appwrite/services/avatars.rb
|
|
518
528
|
- lib/appwrite/services/backups.rb
|