zelf-sdk 1.1.0 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d948897bb81022c440c848f71c2ce80b9584399ba05f71c116851872dd02da00
4
- data.tar.gz: 527540f8d27cbf861e2f0ce5074ac3c0dac4e63df46066adcbcf6b001bdee478
3
+ metadata.gz: 1798e110726c0d5c4db798a7f722e2a16612b4ac8ebba151b9730a3d18dd50f1
4
+ data.tar.gz: 10f37bc7ba93a27619a04d02ce4b0d04f7da2337c58bba6269b54f53ae33ee9c
5
5
  SHA512:
6
- metadata.gz: 24a574903b9793393e2d1bee281af5c79bd160204bbb1371e4daadaf81a13fbe0299e86cdd369be6bc2f85f59f83ff860db329a531795633bc964e759f7fa60f
7
- data.tar.gz: 0ab78f10d9af08b4b357405fd2503a1a8d9dbefca7b93fdbca5c1f688c91b52d852fd8e1546d2dfc55cab6589d3a5fab047bcac4476097c935e5af90f1cc7c3f
6
+ metadata.gz: 7e975684d679027cdd19ab783be132ac664b0938c5c79e538d88814127a716f523e4f4ea3a28b9ba591e432ba698042b4780256011656a8b5a8b506e756ee02e
7
+ data.tar.gz: 11ab4d79a6a439d54b8950a434c18092574e4ab2223a98b485fa9e1c953fe755dcc7758164ce689aa74c01d06affc385d8b7ee4135f396778c911af8f00d4e90
data/lib/zelf/models.rb CHANGED
@@ -108,6 +108,8 @@ module Zelf
108
108
  class BrandStatistics < Zelf::Model; end
109
109
  class Comment < Zelf::Model; end
110
110
  class CommentAuthor < Zelf::Model; end
111
+ class CommentCategory < Zelf::Model; end
112
+ class CommentStatistics < Zelf::Model; end
111
113
  class Content < Zelf::Model; end
112
114
  class ContentActionRequestRequest < Zelf::Model; end
113
115
  class ContentActionResponse < Zelf::Model; end
@@ -143,8 +145,6 @@ module Zelf
143
145
  class FollowerTimeseries < Zelf::Model; end
144
146
  class PatchedBrandUpdateRequest < Zelf::Model; end
145
147
  class PatchedWebhookSubscriptionUpdateRequest < Zelf::Model; end
146
- class PostedCommentCategory < Zelf::Model; end
147
- class PostedComments < Zelf::Model; end
148
148
  class ResultFile < Zelf::Model; end
149
149
  class SafetyCheckRequest < Zelf::Model; end
150
150
  class Usage < Zelf::Model; end
@@ -433,6 +433,26 @@ module Zelf
433
433
  field :profile_picture_url, "profile_picture_url"
434
434
  end
435
435
 
436
+ # Comments the brand posted on one category of content.
437
+ class CommentCategory
438
+ # brand, owned, competitors, themes or other
439
+ field :category, "category"
440
+ # Comments posted on this category
441
+ field :comments, "comments"
442
+ # Likes those comments received
443
+ field :likes, "likes"
444
+ # Replies those comments received
445
+ field :replies, "replies"
446
+ end
447
+
448
+ # Comments the brand posted, split by the content they were posted on.
449
+ class CommentStatistics
450
+ # Comments the brand posted in the window, across every category
451
+ field :total_comments_posted, "total_comments_posted"
452
+ # One entry per category
453
+ field :categories, "categories", cast: [CommentCategory]
454
+ end
455
+
436
456
  # A piece of content (a post, video, or image) and its metrics.
437
457
  class Content
438
458
  # Unique identifier for this piece of content
@@ -487,10 +507,10 @@ module Zelf
487
507
  field :transcript, "transcript"
488
508
  # Direct URL to the post on its platform
489
509
  field :platform_url, "platform_url"
490
- # Short AI-generated summary of the content
491
- field :ai_summary, "ai_summary"
492
510
  # The search term the content was most recently found by
493
511
  field :last_keyword, "last_keyword"
512
+ # Short AI-generated summary of the content
513
+ field :ai_summary, "ai_summary"
494
514
  # Hashtags used in the post, normalized to lowercase and without the leading #
495
515
  field :hashtags, "hashtags"
496
516
  end
@@ -1011,26 +1031,6 @@ module Zelf
1011
1031
  field :enabled, "enabled"
1012
1032
  end
1013
1033
 
1014
- # Comments the brand posted on one category of content.
1015
- class PostedCommentCategory
1016
- # brand, owned, competitors, themes or other
1017
- field :category, "category"
1018
- # Comments posted on this category
1019
- field :comments, "comments"
1020
- # Likes those comments received
1021
- field :likes, "likes"
1022
- # Replies those comments received
1023
- field :replies, "replies"
1024
- end
1025
-
1026
- # Comments the brand posted, split by the content they were posted on.
1027
- class PostedComments
1028
- # Comments the brand posted in the window, across every category
1029
- field :total_comments_posted, "total_comments_posted"
1030
- # One entry per category
1031
- field :categories, "categories", cast: [PostedCommentCategory]
1032
- end
1033
-
1034
1034
  # Signed, time-limited download of an analysis run's result payload.
1035
1035
  class ResultFile
1036
1036
  # Unix epoch seconds after which download_url expires
@@ -8,10 +8,10 @@ module Zelf
8
8
  end
9
9
 
10
10
  # Compare Brand Performance. Returns one row of totals per brand: the top-level brand
11
- # named by `brand_id`, followed by each of its competitor sub-brands. The statistics
12
- # block matches `content.statistics`, so the same parsing works for both. `brand_id`
13
- # must name a top-level brand. A sub-brand is refused with the id of the parent to use
14
- # instead.
11
+ # named by `brand_id` first, then each of its competitor sub-brands by title. Theme
12
+ # sub-brands are not competitors and are left out. The statistics block matches
13
+ # `content.statistics`, so the same parsing works for both. `brand_id` must name a
14
+ # top-level brand. A sub-brand is refused with the id of the parent to use instead.
15
15
  #
16
16
  # Calls GET /api/v1/analytics/brand_comparison/ (analytics.brand_comparison).
17
17
  def brand_comparison(brand_id:, platform: nil, posted_after: nil, posted_before: nil, posted_within_days: nil, posted_within_hours: nil)
@@ -24,14 +24,14 @@ module Zelf
24
24
  "posted_within_hours" => posted_within_hours,
25
25
  }.reject { |_, value| value.nil? }
26
26
  envelope = @transport.request(:get, "/api/v1/analytics/brand_comparison/", query: query)
27
- Zelf.one(envelope, Models::BrandComparison, "BrandComparison")
27
+ Zelf.rows(envelope, Models::BrandComparison)
28
28
  end
29
29
 
30
30
  # Get Brand Follower Time Series. Returns follower history for the top-level brand
31
- # named by `brand_id` and each of its competitor sub-brands, bucketed by `period`. A
32
- # brand appears only for the periods in which one of its owned handles was measured.
33
- # Follower counts carry forward: a handle with no reading in a period keeps the last
34
- # one recorded before it.
31
+ # named by `brand_id` first, then each of its competitor sub-brands by title, bucketed
32
+ # by `period`. A brand appears only for the periods in which one of its owned handles
33
+ # was measured. Follower counts carry forward: a handle with no reading in a period
34
+ # keeps the last one recorded before it.
35
35
  #
36
36
  # Calls GET /api/v1/analytics/follower_timeseries/ (analytics.follower_timeseries).
37
37
  def follower_timeseries(brand_id:, period: nil, platform: nil, posted_after: nil, posted_before: nil, posted_within_days: nil, posted_within_hours: nil)
@@ -45,27 +45,7 @@ module Zelf
45
45
  "posted_within_hours" => posted_within_hours,
46
46
  }.reject { |_, value| value.nil? }
47
47
  envelope = @transport.request(:get, "/api/v1/analytics/follower_timeseries/", query: query)
48
- Zelf.one(envelope, Models::FollowerTimeseries, "FollowerTimeseries")
49
- end
50
-
51
- # Get Posted Comment Analytics. Returns the comments the brand posted in the window,
52
- # grouped by the kind of content they were posted on, together with the likes and
53
- # replies those comments received. These are comments the brand wrote, not comments
54
- # left on its content; `comments.list` returns the latter. The five categories add up
55
- # to `total_comments_posted`.
56
- #
57
- # Calls GET /api/v1/analytics/posted_comments/ (analytics.posted_comments).
58
- def posted_comments(brand_id:, platform: nil, posted_after: nil, posted_before: nil, posted_within_days: nil, posted_within_hours: nil)
59
- query = {
60
- "brand_id" => brand_id,
61
- "platform" => platform,
62
- "posted_after" => posted_after,
63
- "posted_before" => posted_before,
64
- "posted_within_days" => posted_within_days,
65
- "posted_within_hours" => posted_within_hours,
66
- }.reject { |_, value| value.nil? }
67
- envelope = @transport.request(:get, "/api/v1/analytics/posted_comments/", query: query)
68
- Zelf.one(envelope, Models::PostedComments, "PostedComments")
48
+ Zelf.rows(envelope, Models::FollowerTimeseries)
69
49
  end
70
50
  end
71
51
  end
@@ -23,7 +23,7 @@ module Zelf
23
23
  "brand_id" => brand_id,
24
24
  }.reject { |_, value| value.nil? }
25
25
  envelope = @transport.request(:post, "/api/v1/brands/accounts/", body: body)
26
- Zelf.rows(envelope, Models::BrandAccountGroups)
26
+ Zelf.one(envelope, Models::BrandAccountGroups, "BrandAccountGroups")
27
27
  end
28
28
 
29
29
  # List Brand Accounts. Returns a brand's tracked and influencer creator accounts, plus
@@ -39,7 +39,7 @@ module Zelf
39
39
  "brand_id" => brand_id,
40
40
  }.reject { |_, value| value.nil? }
41
41
  envelope = @transport.request(:get, "/api/v1/brands/accounts/", query: query)
42
- Zelf.rows(envelope, Models::BrandAccountGroups)
42
+ Zelf.one(envelope, Models::BrandAccountGroups, "BrandAccountGroups")
43
43
  end
44
44
 
45
45
  # Remove Brand Accounts. Removes profiles from a brand's `tracked`, `influencer` or
@@ -58,7 +58,7 @@ module Zelf
58
58
  "brand_id" => brand_id,
59
59
  }.reject { |_, value| value.nil? }
60
60
  envelope = @transport.request(:delete, "/api/v1/brands/accounts/", body: body)
61
- Zelf.rows(envelope, Models::BrandAccountGroups)
61
+ Zelf.one(envelope, Models::BrandAccountGroups, "BrandAccountGroups")
62
62
  end
63
63
  end
64
64
  end
@@ -0,0 +1,31 @@
1
+ # Generated by codegen. Do not edit by hand.
2
+ module Zelf
3
+ module Resources
4
+ # The engage endpoints.
5
+ class Engage
6
+ def initialize(transport)
7
+ @transport = transport
8
+ end
9
+
10
+ # Get Comment Statistics. Returns the comments the brand posted in the window, grouped
11
+ # by the kind of content they were posted on, together with the likes and replies
12
+ # those comments received. These are comments the brand wrote, not comments left on
13
+ # its content; `comments.list` returns the latter. The five categories add up to
14
+ # `total_comments_posted`.
15
+ #
16
+ # Calls GET /api/v1/engage/comment_statistics/ (engage.comment_statistics).
17
+ def comment_statistics(brand_id:, platform: nil, posted_after: nil, posted_before: nil, posted_within_days: nil, posted_within_hours: nil)
18
+ query = {
19
+ "brand_id" => brand_id,
20
+ "platform" => platform,
21
+ "posted_after" => posted_after,
22
+ "posted_before" => posted_before,
23
+ "posted_within_days" => posted_within_days,
24
+ "posted_within_hours" => posted_within_hours,
25
+ }.reject { |_, value| value.nil? }
26
+ envelope = @transport.request(:get, "/api/v1/engage/comment_statistics/", query: query)
27
+ Zelf.one(envelope, Models::CommentStatistics, "CommentStatistics")
28
+ end
29
+ end
30
+ end
31
+ end
data/lib/zelf/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Generated by codegen. Do not edit by hand.
2
2
 
3
3
  module Zelf
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.2.0'.freeze
5
5
  end
data/lib/zelf.rb CHANGED
@@ -16,11 +16,12 @@ require_relative 'zelf/resources/creator_sync'
16
16
  require_relative 'zelf/resources/creator_vetting'
17
17
  require_relative 'zelf/resources/creators'
18
18
  require_relative 'zelf/resources/detection'
19
+ require_relative 'zelf/resources/engage'
19
20
  require_relative 'zelf/resources/sub_brands'
20
21
  require_relative 'zelf/resources/usage'
21
22
  require_relative 'zelf/resources/webhooks'
22
23
 
23
- # Ruby client for the ZelfAI APIs (spec version 1.1.0).
24
+ # Ruby client for the ZelfAI APIs (spec version 1.2.0).
24
25
  module Zelf
25
26
  # Client for the ZelfAI APIs.
26
27
  #
@@ -28,7 +29,7 @@ module Zelf
28
29
  # ZELF_API_KEY environment variable. It is sent as the x-api-key header
29
30
  # and is kept out of inspect output.
30
31
  class Client
31
- attr_reader :ai_analysis, :analytics, :brand_accounts, :brands, :comments, :content, :creator_sync, :creator_vetting, :creators, :detection, :sub_brands, :usage, :webhooks
32
+ attr_reader :ai_analysis, :analytics, :brand_accounts, :brands, :comments, :content, :creator_sync, :creator_vetting, :creators, :detection, :engage, :sub_brands, :usage, :webhooks
32
33
 
33
34
  def initialize(api_key: nil, base_url: nil, timeout: 60,
34
35
  max_retries: 2, retry_writes: false, headers: {})
@@ -45,6 +46,7 @@ module Zelf
45
46
  @creator_vetting = Resources::CreatorVetting.new(@transport)
46
47
  @creators = Resources::Creators.new(@transport)
47
48
  @detection = Resources::Detection.new(@transport)
49
+ @engage = Resources::Engage.new(@transport)
48
50
  @sub_brands = Resources::SubBrands.new(@transport)
49
51
  @usage = Resources::Usage.new(@transport)
50
52
  @webhooks = Resources::Webhooks.new(@transport)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zelf-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zelf
@@ -31,6 +31,7 @@ files:
31
31
  - lib/zelf/resources/creator_vetting.rb
32
32
  - lib/zelf/resources/creators.rb
33
33
  - lib/zelf/resources/detection.rb
34
+ - lib/zelf/resources/engage.rb
34
35
  - lib/zelf/resources/sub_brands.rb
35
36
  - lib/zelf/resources/usage.rb
36
37
  - lib/zelf/resources/webhooks.rb