Class: Zernio::MentionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/zernio-sdk/api/mentions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MentionsApi

Returns a new instance of MentionsApi.



19
20
21
# File 'lib/zernio-sdk/api/mentions_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/zernio-sdk/api/mentions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#list_inbox_mentions(opts = {}) ⇒ ListInboxMentions200Response

List mentions Returns mentions of your connected organization accounts, delivered via platform webhooks. Currently supports LinkedIn organization mentions. Requires Inbox addon.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :account_id (String)

    Filter by social account ID

  • :profile_id (String)

    Filter by profile ID

  • :sort_order (String)

    Sort order by publishedAt (default to 'desc')

  • :limit (Integer) — default: default to 25
  • :cursor (String)

    Cursor for pagination (ID of the last item from the previous page)

Returns:



31
32
33
34
# File 'lib/zernio-sdk/api/mentions_api.rb', line 31

def list_inbox_mentions(opts = {})
  data, _status_code, _headers = list_inbox_mentions_with_http_info(opts)
  data
end

#list_inbox_mentions_with_http_info(opts = {}) ⇒ Array<(ListInboxMentions200Response, Integer, Hash)>

List mentions Returns mentions of your connected organization accounts, delivered via platform webhooks. Currently supports LinkedIn organization mentions. Requires Inbox addon.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :account_id (String)

    Filter by social account ID

  • :profile_id (String)

    Filter by profile ID

  • :sort_order (String)

    Sort order by publishedAt (default to 'desc')

  • :limit (Integer) — default: default to 25
  • :cursor (String)

    Cursor for pagination (ID of the last item from the previous page)

Returns:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/zernio-sdk/api/mentions_api.rb', line 45

def list_inbox_mentions_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MentionsApi.list_inbox_mentions ...'
  end
  allowable_values = ["asc", "desc"]
  if @api_client.config.client_side_validation && opts[:'sort_order'] && !allowable_values.include?(opts[:'sort_order'])
    fail ArgumentError, "invalid value for \"sort_order\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MentionsApi.list_inbox_mentions, must be smaller than or equal to 100.'
  end

  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MentionsApi.list_inbox_mentions, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = '/v1/inbox/mentions'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
  query_params[:'profileId'] = opts[:'profile_id'] if !opts[:'profile_id'].nil?
  query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ListInboxMentions200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MentionsApi.list_inbox_mentions",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MentionsApi#list_inbox_mentions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#reply_to_mention(reply_to_mention_request, opts = {}) ⇒ ReplyToMention200Response

Reply to a mention Reply to a mention of the connected account. Supported on Instagram only. Two shapes, selected by whether commentId is present: - Comment mention (someone @mentioned the account inside a comment): pass both mediaId and commentId. Instagram posts a reply under that comment. - Caption mention (someone @mentioned the account in their media caption, so no comment exists): pass mediaId only. Instagram posts a comment on their media. Story mentions are not supported by Instagram's API. Note that GET /v1/inbox/mentions currently returns LinkedIn mentions only and does not surface Instagram mentions. Source mediaId and commentId from Instagram's comments webhook, which is where mention notifications are delivered for accounts connected through Instagram Login.

Parameters:

  • reply_to_mention_request (ReplyToMentionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



111
112
113
114
# File 'lib/zernio-sdk/api/mentions_api.rb', line 111

def reply_to_mention(reply_to_mention_request, opts = {})
  data, _status_code, _headers = reply_to_mention_with_http_info(reply_to_mention_request, opts)
  data
end

#reply_to_mention_with_http_info(reply_to_mention_request, opts = {}) ⇒ Array<(ReplyToMention200Response, Integer, Hash)>

Reply to a mention Reply to a mention of the connected account. Supported on Instagram only. Two shapes, selected by whether `commentId` is present: - Comment mention (someone @mentioned the account inside a comment): pass both `mediaId` and `commentId`. Instagram posts a reply under that comment. - Caption mention (someone @mentioned the account in their media caption, so no comment exists): pass `mediaId` only. Instagram posts a comment on their media. Story mentions are not supported by Instagram's API. Note that `GET /v1/inbox/mentions` currently returns LinkedIn mentions only and does not surface Instagram mentions. Source `mediaId` and `commentId` from Instagram's `comments` webhook, which is where mention notifications are delivered for accounts connected through Instagram Login.

Parameters:

  • reply_to_mention_request (ReplyToMentionRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ReplyToMention200Response, Integer, Hash)>)

    ReplyToMention200Response data, response status code and response headers



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/zernio-sdk/api/mentions_api.rb', line 121

def reply_to_mention_with_http_info(reply_to_mention_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: MentionsApi.reply_to_mention ...'
  end
  # verify the required parameter 'reply_to_mention_request' is set
  if @api_client.config.client_side_validation && reply_to_mention_request.nil?
    fail ArgumentError, "Missing the required parameter 'reply_to_mention_request' when calling MentionsApi.reply_to_mention"
  end
  # resource path
  local_var_path = '/v1/inbox/mentions/reply'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(reply_to_mention_request)

  # return_type
  return_type = opts[:debug_return_type] || 'ReplyToMention200Response'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['bearerAuth']

  new_options = opts.merge(
    :operation => :"MentionsApi.reply_to_mention",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MentionsApi#reply_to_mention\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end