Class: Late::TikTokPlatformData

Inherits:
ApiModelBase show all
Defined in:
lib/late-sdk/models/tik_tok_platform_data.rb

Overview

Photo carousels up to 35 images. Video titles up to 2200 chars, photo titles truncated to 90 chars. privacyLevel must match creator_info options. Both camelCase and snake_case accepted.

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ TikTokPlatformData

Initializes the object

Parameters:

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

    Model attributes in the form of hash



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 151

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Late::TikTokPlatformData` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Late::TikTokPlatformData`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'draft')
    self.draft = attributes[:'draft']
  end

  if attributes.key?(:'privacy_level')
    self.privacy_level = attributes[:'privacy_level']
  end

  if attributes.key?(:'allow_comment')
    self.allow_comment = attributes[:'allow_comment']
  end

  if attributes.key?(:'allow_duet')
    self.allow_duet = attributes[:'allow_duet']
  end

  if attributes.key?(:'allow_stitch')
    self.allow_stitch = attributes[:'allow_stitch']
  end

  if attributes.key?(:'commercial_content_type')
    self.commercial_content_type = attributes[:'commercial_content_type']
  end

  if attributes.key?(:'brand_partner_promote')
    self.brand_partner_promote = attributes[:'brand_partner_promote']
  end

  if attributes.key?(:'is_brand_organic_post')
    self.is_brand_organic_post = attributes[:'is_brand_organic_post']
  end

  if attributes.key?(:'content_preview_confirmed')
    self.content_preview_confirmed = attributes[:'content_preview_confirmed']
  end

  if attributes.key?(:'express_consent_given')
    self.express_consent_given = attributes[:'express_consent_given']
  end

  if attributes.key?(:'media_type')
    self.media_type = attributes[:'media_type']
  end

  if attributes.key?(:'video_cover_timestamp_ms')
    self.video_cover_timestamp_ms = attributes[:'video_cover_timestamp_ms']
  end

  if attributes.key?(:'photo_cover_index')
    self.photo_cover_index = attributes[:'photo_cover_index']
  end

  if attributes.key?(:'auto_add_music')
    self.auto_add_music = attributes[:'auto_add_music']
  end

  if attributes.key?(:'video_made_with_ai')
    self.video_made_with_ai = attributes[:'video_made_with_ai']
  end

  if attributes.key?(:'description')
    self.description = attributes[:'description']
  end
end

Instance Attribute Details

#allow_commentObject

Allow comments on the post



26
27
28
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 26

def allow_comment
  @allow_comment
end

#allow_duetObject

Allow duets (required for video posts)



29
30
31
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 29

def allow_duet
  @allow_duet
end

#allow_stitchObject

Allow stitches (required for video posts)



32
33
34
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 32

def allow_stitch
  @allow_stitch
end

#auto_add_musicObject

When true, TikTok may add recommended music (photos only)



59
60
61
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 59

def auto_add_music
  @auto_add_music
end

#brand_partner_promoteObject

Whether the post promotes a brand partner



38
39
40
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 38

def brand_partner_promote
  @brand_partner_promote
end

#commercial_content_typeObject

Type of commercial content disclosure



35
36
37
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 35

def commercial_content_type
  @commercial_content_type
end

#content_preview_confirmedObject

User has confirmed they previewed the content



44
45
46
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 44

def content_preview_confirmed
  @content_preview_confirmed
end

#descriptionObject

Optional long-form description for photo posts (max 4000 chars). Recommended when content exceeds 90 chars, as photo titles are auto-truncated.



65
66
67
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 65

def description
  @description
end

#draftObject

When true, sends the post to the TikTok Creator Inbox as a draft instead of publishing immediately.



20
21
22
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 20

def draft
  @draft
end

User has given express consent for posting



47
48
49
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 47

def express_consent_given
  @express_consent_given
end

#is_brand_organic_postObject

Whether the post is a brand organic post



41
42
43
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 41

def is_brand_organic_post
  @is_brand_organic_post
end

#media_typeObject

Optional override. Defaults based on provided media items.



50
51
52
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 50

def media_type
  @media_type
end

#photo_cover_indexObject

Optional for photo carousels. Index of image to use as cover, 0-based (defaults to 0/first image).



56
57
58
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 56

def photo_cover_index
  @photo_cover_index
end

#privacy_levelObject

One of the values returned by the TikTok creator info API for the account



23
24
25
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 23

def privacy_level
  @privacy_level
end

#video_cover_timestamp_msObject

Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second).



53
54
55
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 53

def video_cover_timestamp_ms
  @video_cover_timestamp_ms
end

#video_made_with_aiObject

Set true to disclose AI-generated content



62
63
64
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 62

def video_made_with_ai
  @video_made_with_ai
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



112
113
114
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 112

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



117
118
119
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 117

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 90

def self.attribute_map
  {
    :'draft' => :'draft',
    :'privacy_level' => :'privacyLevel',
    :'allow_comment' => :'allowComment',
    :'allow_duet' => :'allowDuet',
    :'allow_stitch' => :'allowStitch',
    :'commercial_content_type' => :'commercialContentType',
    :'brand_partner_promote' => :'brandPartnerPromote',
    :'is_brand_organic_post' => :'isBrandOrganicPost',
    :'content_preview_confirmed' => :'contentPreviewConfirmed',
    :'express_consent_given' => :'expressConsentGiven',
    :'media_type' => :'mediaType',
    :'video_cover_timestamp_ms' => :'videoCoverTimestampMs',
    :'photo_cover_index' => :'photoCoverIndex',
    :'auto_add_music' => :'autoAddMusic',
    :'video_made_with_ai' => :'videoMadeWithAi',
    :'description' => :'description'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 364

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



144
145
146
147
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 144

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 122

def self.openapi_types
  {
    :'draft' => :'Boolean',
    :'privacy_level' => :'String',
    :'allow_comment' => :'Boolean',
    :'allow_duet' => :'Boolean',
    :'allow_stitch' => :'Boolean',
    :'commercial_content_type' => :'String',
    :'brand_partner_promote' => :'Boolean',
    :'is_brand_organic_post' => :'Boolean',
    :'content_preview_confirmed' => :'Boolean',
    :'express_consent_given' => :'Boolean',
    :'media_type' => :'String',
    :'video_cover_timestamp_ms' => :'Integer',
    :'photo_cover_index' => :'Integer',
    :'auto_add_music' => :'Boolean',
    :'video_made_with_ai' => :'Boolean',
    :'description' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 328

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      draft == o.draft &&
      privacy_level == o.privacy_level &&
      allow_comment == o.allow_comment &&
      allow_duet == o.allow_duet &&
      allow_stitch == o.allow_stitch &&
      commercial_content_type == o.commercial_content_type &&
      brand_partner_promote == o.brand_partner_promote &&
      is_brand_organic_post == o.is_brand_organic_post &&
      content_preview_confirmed == o.content_preview_confirmed &&
      express_consent_given == o.express_consent_given &&
      media_type == o.media_type &&
      video_cover_timestamp_ms == o.video_cover_timestamp_ms &&
      photo_cover_index == o.photo_cover_index &&
      auto_add_music == o.auto_add_music &&
      video_made_with_ai == o.video_made_with_ai &&
      description == o.description
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


351
352
353
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 351

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



357
358
359
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 357

def hash
  [draft, privacy_level, allow_comment, allow_duet, allow_stitch, commercial_content_type, brand_partner_promote, is_brand_organic_post, content_preview_confirmed, express_consent_given, media_type, video_cover_timestamp_ms, photo_cover_index, auto_add_music, video_made_with_ai, description].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 232

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if !@video_cover_timestamp_ms.nil? && @video_cover_timestamp_ms < 0
    invalid_properties.push('invalid value for "video_cover_timestamp_ms", must be greater than or equal to 0.')
  end

  if !@photo_cover_index.nil? && @photo_cover_index < 0
    invalid_properties.push('invalid value for "photo_cover_index", must be greater than or equal to 0.')
  end

  if !@description.nil? && @description.to_s.length > 4000
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 4000.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 386

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



252
253
254
255
256
257
258
259
260
261
262
# File 'lib/late-sdk/models/tik_tok_platform_data.rb', line 252

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  commercial_content_type_validator = EnumAttributeValidator.new('String', ["none", "brand_organic", "brand_content"])
  return false unless commercial_content_type_validator.valid?(@commercial_content_type)
  media_type_validator = EnumAttributeValidator.new('String', ["video", "photo"])
  return false unless media_type_validator.valid?(@media_type)
  return false if !@video_cover_timestamp_ms.nil? && @video_cover_timestamp_ms < 0
  return false if !@photo_cover_index.nil? && @photo_cover_index < 0
  return false if !@description.nil? && @description.to_s.length > 4000
  true
end