appwrite 30.6.0 → 30.8.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/enums/project_key_scopes.rb +0 -1
- 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/models/video.rb +9 -4
- data/lib/appwrite/services/analytics.rb +594 -0
- data/lib/appwrite/services/videos.rb +27 -28
- 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: 33d0e80cc05e1783003373d16a2e4b2e4792df6738318f6de5b95b1fd2e3a6ad
|
|
4
|
+
data.tar.gz: 3fcf50635cf5869d9a4a31c14887e1dc2837e77b4d6ee5b48122bb72ddbee380
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd2b47ccf0bceea18a33da99dbd9977ac67779f3c8f096f8dfea53cd29e60720cdda76cb6acc2c9b76d932a0cea00b0965e8fabee972cc5aa78985610592c557
|
|
7
|
+
data.tar.gz: a78cff62ff03d97cfc47cef916ae4e4e0ab1c02cc5261ec3d2d2783771f1848e35e0f5bbaf18efbda688e267af19b9515c448f02b74857ff34fe4b5ed012e84e
|
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.8.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
|
|
@@ -115,7 +115,6 @@ module Appwrite
|
|
|
115
115
|
REVIEWS_WRITE = 'reviews.write'
|
|
116
116
|
PRESENCES_READ = 'presences.read'
|
|
117
117
|
PRESENCES_WRITE = 'presences.write'
|
|
118
|
-
VIDEOS_PLAY = 'videos.play'
|
|
119
118
|
VIDEOS_READ = 'videos.read'
|
|
120
119
|
VIDEOS_WRITE = 'videos.write'
|
|
121
120
|
DEDICATEDDATABASES_EXECUTE = 'dedicatedDatabases.execute'
|
|
@@ -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
|
|
@@ -28,6 +28,7 @@ module Appwrite
|
|
|
28
28
|
attr_reader :audio_sample_rate
|
|
29
29
|
attr_reader :timeline_status
|
|
30
30
|
attr_reader :timeline_error
|
|
31
|
+
attr_reader :renditions
|
|
31
32
|
|
|
32
33
|
def initialize(
|
|
33
34
|
id:,
|
|
@@ -54,7 +55,8 @@ module Appwrite
|
|
|
54
55
|
audio_bit_rate:,
|
|
55
56
|
audio_sample_rate:,
|
|
56
57
|
timeline_status:,
|
|
57
|
-
timeline_error
|
|
58
|
+
timeline_error:,
|
|
59
|
+
renditions: []
|
|
58
60
|
)
|
|
59
61
|
@id = id
|
|
60
62
|
@created_at = created_at
|
|
@@ -81,10 +83,11 @@ module Appwrite
|
|
|
81
83
|
@audio_sample_rate = audio_sample_rate
|
|
82
84
|
@timeline_status = validate_timeline_status(timeline_status)
|
|
83
85
|
@timeline_error = timeline_error
|
|
86
|
+
@renditions = renditions
|
|
84
87
|
end
|
|
85
88
|
|
|
86
89
|
def self.from(map:)
|
|
87
|
-
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "$permissions" => [], "bucketId" => "", "fileId" => "", "name" => "", "size" => 0, "format" => "", "duration" => 0, "width" => 0, "height" => 0, "aspectRatio" => "", "videoCodec" => "", "videoFormat" => "", "videoFormatProfile" => "", "videoBitRate" => 0, "videoFrameRate" => 0, "videoFrameRateMode" => "", "audioCodec" => "", "audioFormat" => "", "audioBitRate" => 0, "audioSampleRate" => 0, "timelineStatus" => "pending", "timelineError" => "" }.merge(map)
|
|
90
|
+
map = { "$id" => "", "$createdAt" => "", "$updatedAt" => "", "$permissions" => [], "bucketId" => "", "fileId" => "", "name" => "", "size" => 0, "format" => "", "duration" => 0, "width" => 0, "height" => 0, "aspectRatio" => "", "videoCodec" => "", "videoFormat" => "", "videoFormatProfile" => "", "videoBitRate" => 0, "videoFrameRate" => 0, "videoFrameRateMode" => "", "audioCodec" => "", "audioFormat" => "", "audioBitRate" => 0, "audioSampleRate" => 0, "timelineStatus" => "pending", "timelineError" => "", "renditions" => [] }.merge(map)
|
|
88
91
|
Video.new(
|
|
89
92
|
id: map["$id"],
|
|
90
93
|
created_at: map["$createdAt"],
|
|
@@ -110,7 +113,8 @@ module Appwrite
|
|
|
110
113
|
audio_bit_rate: map["audioBitRate"],
|
|
111
114
|
audio_sample_rate: map["audioSampleRate"],
|
|
112
115
|
timeline_status: map["timelineStatus"],
|
|
113
|
-
timeline_error: map["timelineError"]
|
|
116
|
+
timeline_error: map["timelineError"],
|
|
117
|
+
renditions: map["renditions"].map { |it| VideoRendition.from(map: it) }
|
|
114
118
|
)
|
|
115
119
|
end
|
|
116
120
|
|
|
@@ -140,7 +144,8 @@ module Appwrite
|
|
|
140
144
|
"audioBitRate": @audio_bit_rate,
|
|
141
145
|
"audioSampleRate": @audio_sample_rate,
|
|
142
146
|
"timelineStatus": @timeline_status,
|
|
143
|
-
"timelineError": @timeline_error
|
|
147
|
+
"timelineError": @timeline_error,
|
|
148
|
+
"renditions": @renditions.map { |it| it.to_map }
|
|
144
149
|
}
|
|
145
150
|
end
|
|
146
151
|
|
|
@@ -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
|
|
@@ -6,12 +6,11 @@ module Appwrite
|
|
|
6
6
|
@client = client
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
# Get a list of videos in the current project. Sessions
|
|
10
|
-
# they can read according to each video's `$permissions`. API
|
|
11
|
-
# receive the full project catalog.
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
# `videos.read` and will not see it in this list.
|
|
9
|
+
# Get a list of videos in the current project. Sessions and guests receive
|
|
10
|
+
# only videos they can read according to each video's `$permissions`. API
|
|
11
|
+
# keys and admins receive the full project catalog. Each video includes its
|
|
12
|
+
# ready renditions. Guests hold `videos.read`, so a video that grants
|
|
13
|
+
# `read("any")` or `read("guests")` appears in this list and can be streamed.
|
|
15
14
|
#
|
|
16
15
|
#
|
|
17
16
|
# @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: bucketId, fileId, name, size, format, duration, width, height, videoCodec, videoBitRate, audioCodec, audioBitRate, search
|
|
@@ -55,8 +54,8 @@ module Appwrite
|
|
|
55
54
|
# `permissions` array sets the video document ACL (list, get, update, delete,
|
|
56
55
|
# manage child resources, and playback). By default, only the current user is
|
|
57
56
|
# granted all permissions; API keys and admins create with empty permissions
|
|
58
|
-
# when omitted. Guests
|
|
59
|
-
#
|
|
57
|
+
# when omitted. Guests can stream when the video grants them read
|
|
58
|
+
# (`read("any")` or `read("guests")`).
|
|
60
59
|
#
|
|
61
60
|
# Uploaded caption files stay listed alongside auto-extracted tracks for the
|
|
62
61
|
# same language; when the current default is an auto-extracted track with
|
|
@@ -140,7 +139,7 @@ module Appwrite
|
|
|
140
139
|
end
|
|
141
140
|
|
|
142
141
|
# Get a video by its unique ID. This endpoint response returns a JSON object
|
|
143
|
-
# with the video metadata.
|
|
142
|
+
# with the video metadata, including ready renditions.
|
|
144
143
|
#
|
|
145
144
|
#
|
|
146
145
|
# @param [String] video_id Video unique ID.
|
|
@@ -471,9 +470,9 @@ module Appwrite
|
|
|
471
470
|
# playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a
|
|
472
471
|
# player to begin adaptive playback.
|
|
473
472
|
#
|
|
474
|
-
# Guests can request this URL when they hold `videos.
|
|
475
|
-
#
|
|
476
|
-
#
|
|
473
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
474
|
+
# document grants them read. A video with `read("any")` or `read("guests")`
|
|
475
|
+
# is playable without a session.
|
|
477
476
|
#
|
|
478
477
|
# For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`.
|
|
479
478
|
# Both masters point at the same fMP4 segment set.
|
|
@@ -511,9 +510,9 @@ module Appwrite
|
|
|
511
510
|
# playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a
|
|
512
511
|
# player to begin adaptive playback.
|
|
513
512
|
#
|
|
514
|
-
# Guests can request this URL when they hold `videos.
|
|
515
|
-
#
|
|
516
|
-
#
|
|
513
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
514
|
+
# document grants them read. A video with `read("any")` or `read("guests")`
|
|
515
|
+
# is playable without a session.
|
|
517
516
|
#
|
|
518
517
|
# For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`.
|
|
519
518
|
# Both masters point at the same fMP4 segment set.
|
|
@@ -551,9 +550,9 @@ module Appwrite
|
|
|
551
550
|
# playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a
|
|
552
551
|
# player to begin adaptive playback.
|
|
553
552
|
#
|
|
554
|
-
# Guests can request this URL when they hold `videos.
|
|
555
|
-
#
|
|
556
|
-
#
|
|
553
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
554
|
+
# document grants them read. A video with `read("any")` or `read("guests")`
|
|
555
|
+
# is playable without a session.
|
|
557
556
|
#
|
|
558
557
|
# For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`.
|
|
559
558
|
# Both masters point at the same fMP4 segment set.
|
|
@@ -591,9 +590,9 @@ module Appwrite
|
|
|
591
590
|
# playlist (`master.m3u8`) or a DASH MPD (`master.mpd`). Hand this URL to a
|
|
592
591
|
# player to begin adaptive playback.
|
|
593
592
|
#
|
|
594
|
-
# Guests can request this URL when they hold `videos.
|
|
595
|
-
#
|
|
596
|
-
#
|
|
593
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
594
|
+
# document grants them read. A video with `read("any")` or `read("guests")`
|
|
595
|
+
# is playable without a session.
|
|
597
596
|
#
|
|
598
597
|
# For CMAF renditions, use `getCmafHlsManifest` or `getCmafDashManifest`.
|
|
599
598
|
# Both masters point at the same fMP4 segment set.
|
|
@@ -630,8 +629,8 @@ module Appwrite
|
|
|
630
629
|
# Get the playable caption resource for a video output: an HLS captions
|
|
631
630
|
# playlist, or the WebVTT file itself for DASH.
|
|
632
631
|
#
|
|
633
|
-
# Guests can request this URL when they hold `videos.
|
|
634
|
-
#
|
|
632
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
633
|
+
# document grants them read.
|
|
635
634
|
#
|
|
636
635
|
#
|
|
637
636
|
# @param [String] video_id Video unique ID.
|
|
@@ -874,8 +873,8 @@ module Appwrite
|
|
|
874
873
|
# Get a single thumbnail sheet from a video's timeline as an image. You can
|
|
875
874
|
# resize the returned image and choose its output format.
|
|
876
875
|
#
|
|
877
|
-
# Guests can request this URL when they hold `videos.
|
|
878
|
-
#
|
|
876
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
877
|
+
# document grants them read.
|
|
879
878
|
#
|
|
880
879
|
#
|
|
881
880
|
# @param [String] video_id Video unique ID.
|
|
@@ -930,9 +929,9 @@ module Appwrite
|
|
|
930
929
|
# Audio-only sources produce no timeline and this endpoint returns
|
|
931
930
|
# `video_timelines_not_found`.
|
|
932
931
|
#
|
|
933
|
-
# Guests can request this URL when they hold `videos.
|
|
934
|
-
#
|
|
935
|
-
#
|
|
932
|
+
# Guests can request this URL when they hold `videos.read` **and** the video
|
|
933
|
+
# document grants them read. A video with `read("any")` or `read("guests")`
|
|
934
|
+
# is playable without a session.
|
|
936
935
|
#
|
|
937
936
|
#
|
|
938
937
|
# @param [String] video_id Video unique ID.
|
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.8.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
|
+
date: 2026-12-01 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
|