Class: Zernio::TikTokPlatformData
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zernio::TikTokPlatformData
- Defined in:
- lib/zernio-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. Creator Inbox (draft mode): Set draft: true to send content to the TikTok Creator Inbox instead of publishing immediately. The creator receives an inbox notification and completes the post using TikTok's editing flow. This maps to TikTok's post_mode: "MEDIA_UPLOAD" internally. Important: The field publish_type is NOT supported. Use draft: true for Creator Inbox flow. Photo drafts use the /v2/post/publish/content/init/ endpoint with post_mode: "MEDIA_UPLOAD". Video drafts use the dedicated /v2/post/publish/inbox/video/init/ endpoint. When draft: true, the video.upload scope is required. When draft is false or omitted (direct post), the video.publish scope is required. For Creator Inbox, TikTok app version must be 31.8 or higher.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#allow_comment ⇒ Object
Allow comments on the post.
-
#allow_duet ⇒ Object
Allow duets (required for video posts).
-
#allow_stitch ⇒ Object
Allow stitches (required for video posts).
-
#auto_add_music ⇒ Object
When true, TikTok may add recommended music (photos only).
-
#brand_partner_promote ⇒ Object
Whether the post promotes a brand partner (branded content / paid partnership).
-
#commercial_content_type ⇒ Object
Type of commercial content disclosure.
-
#content_preview_confirmed ⇒ Object
User has confirmed they previewed the content.
-
#description ⇒ Object
Optional long-form caption for photo posts (max 4000 chars).
-
#draft ⇒ Object
When true, sends the post to the TikTok Creator Inbox as a draft instead of publishing immediately.
-
#express_consent_given ⇒ Object
User has given express consent for posting.
-
#is_ads_only ⇒ Object
Set true to publish the video as an "Only show in ads" post: it is kept off the profile and exists to be used as a Spark Ad.
-
#is_brand_organic_post ⇒ Object
Whether the post promotes the creator's own brand (brand organic).
-
#location_id ⇒ Object
Location tag to attach, as the id of a result from GET /v1/accounts/accountId/tiktok/locations.
-
#location_name ⇒ Object
Display name of the location tag, as returned next to its id.
-
#media_type ⇒ Object
Optional override.
-
#music_sound_info ⇒ Object
Returns the value of attribute music_sound_info.
-
#photo_cover_index ⇒ Object
Optional for photo carousels.
-
#privacy_level ⇒ Object
One of the values returned by the TikTok creator info API for the account.
-
#video_cover_image_url ⇒ Object
Optional for video posts.
-
#video_cover_timestamp_ms ⇒ Object
Optional for video posts.
-
#video_made_with_ai ⇒ Object
Set true to disclose AI-generated content.
-
#video_original_sound_volume ⇒ Object
Volume of the video's own sound when a commercial track is attached (0 to 100).
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ TikTokPlatformData
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ TikTokPlatformData
Initializes the object
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 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 180 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::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 `Zernio::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. = 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. = attributes[:'video_cover_timestamp_ms'] end if attributes.key?(:'video_cover_image_url') self.video_cover_image_url = attributes[:'video_cover_image_url'] 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?(:'music_sound_info') self.music_sound_info = attributes[:'music_sound_info'] end if attributes.key?(:'video_original_sound_volume') self.video_original_sound_volume = attributes[:'video_original_sound_volume'] end if attributes.key?(:'video_made_with_ai') self.video_made_with_ai = attributes[:'video_made_with_ai'] end if attributes.key?(:'location_id') self.location_id = attributes[:'location_id'] end if attributes.key?(:'location_name') self.location_name = attributes[:'location_name'] end if attributes.key?(:'is_ads_only') self.is_ads_only = attributes[:'is_ads_only'] end if attributes.key?(:'description') self.description = attributes[:'description'] end end |
Instance Attribute Details
#allow_comment ⇒ Object
Allow comments on the post
26 27 28 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 26 def allow_comment @allow_comment end |
#allow_duet ⇒ Object
Allow duets (required for video posts)
29 30 31 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 29 def allow_duet @allow_duet end |
#allow_stitch ⇒ Object
Allow stitches (required for video posts)
32 33 34 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 32 def allow_stitch @allow_stitch end |
#auto_add_music ⇒ Object
When true, TikTok may add recommended music (photos only). With the brand-organic or branded-content toggle on, TikTok allows Commercial Music Library tracks only, so this attaches nothing there; use musicSoundInfo instead.
62 63 64 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 62 def auto_add_music @auto_add_music end |
#brand_partner_promote ⇒ Object
Whether the post promotes a brand partner (branded content / paid partnership). Only needed to disclose BOTH types at once (set it alongside commercialContentType "brand_organic"), or to override the value implied by commercialContentType.
38 39 40 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 38 def brand_partner_promote @brand_partner_promote end |
#commercial_content_type ⇒ Object
Type of commercial content disclosure. Sufficient on its own: "brand_organic" ("Your Brand") implies isBrandOrganicPost and "brand_content" ("Branded Content", paid partnership) implies brandPartnerPromote, so you don't need to send the boolean flags separately. Branded content cannot be posted with privacyLevel SELF_ONLY.
35 36 37 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 35 def commercial_content_type @commercial_content_type end |
#content_preview_confirmed ⇒ Object
User has confirmed they previewed the content
44 45 46 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 44 def content_preview_confirmed @content_preview_confirmed end |
#description ⇒ Object
Optional long-form caption for photo posts (max 4000 chars). Recommended when content exceeds 90 chars, as photo titles are auto-truncated. Falls back to the post content when omitted.
82 83 84 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 82 def description @description end |
#draft ⇒ Object
When true, sends the post to the TikTok Creator Inbox as a draft instead of publishing immediately. The creator receives an inbox notification to complete posting via TikTok's editing flow. Maps to TikTok API post_mode: "MEDIA_UPLOAD" (photos) or the dedicated inbox endpoint (videos). When false or omitted, publishes directly via post_mode: "DIRECT_POST". Note: publish_type is not a supported field. Use this field instead.
20 21 22 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 20 def draft @draft end |
#express_consent_given ⇒ Object
User has given express consent for posting
47 48 49 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 47 def @express_consent_given end |
#is_ads_only ⇒ Object
Set true to publish the video as an "Only show in ads" post: it is kept off the profile and exists to be used as a Spark Ad. Accounts connected through the TikTok for Business app and video posts only, with the same rejections as locationId. Ignored on drafts.
79 80 81 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 79 def is_ads_only @is_ads_only end |
#is_brand_organic_post ⇒ Object
Whether the post promotes the creator's own brand (brand organic). Only needed to disclose BOTH types at once (set it alongside commercialContentType "brand_content"), or to override the value implied by commercialContentType.
41 42 43 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 41 def is_brand_organic_post @is_brand_organic_post end |
#location_id ⇒ Object
Location tag to attach, as the id of a result from GET /v1/accounts/accountId/tiktok/locations. Accounts connected through the TikTok for Business app and video posts only: a developer-app account rejects the post at publish time with a message that says so, and a direct photo post is rejected at creation since the business photo endpoint has no location field. Requires locationName. Ignored on drafts, where TikTok ignores every post_info field.
73 74 75 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 73 def location_id @location_id end |
#location_name ⇒ Object
Display name of the location tag, as returned next to its id. Required with locationId; a locationId without it is rejected at creation.
76 77 78 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 76 def location_name @location_name end |
#media_type ⇒ Object
Optional override. Defaults based on provided media items.
50 51 52 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 50 def media_type @media_type end |
#music_sound_info ⇒ Object
Returns the value of attribute music_sound_info.
64 65 66 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 64 def music_sound_info @music_sound_info end |
#photo_cover_index ⇒ Object
Optional for photo carousels. Index of image to use as cover, 0-based (defaults to 0/first image).
59 60 61 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 59 def photo_cover_index @photo_cover_index end |
#privacy_level ⇒ Object
One of the values returned by the TikTok creator info API for the account. Accounts connected through the TikTok for Business app publish videos as public only: a non-public value on a video post is rejected at creation unless draft is true (photo posts keep every level).
23 24 25 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 23 def privacy_level @privacy_level end |
#video_cover_image_url ⇒ Object
Optional for video posts. URL of a custom thumbnail image (JPG, PNG, or WebP, max 20MB). Any downloadable URL works: we rehost it ourselves. The image is stitched as a single frame at the start of the video to serve as the cover. Accounts connected through the TikTok for Business app hand it to TikTok as the cover instead, with no stitching, falling back to videoCoverTimestampMs without it. Overrides videoCoverTimestampMs when provided.
56 57 58 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 56 def video_cover_image_url @video_cover_image_url end |
#video_cover_timestamp_ms ⇒ Object
Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when videoCoverImageUrl is provided.
53 54 55 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 53 def @video_cover_timestamp_ms end |
#video_made_with_ai ⇒ Object
Set true to disclose AI-generated content. Accounts connected through the TikTok for Business app carry the disclosure on video posts only: the business photo endpoint has no AI disclosure field, so true on a direct photo post is rejected at creation rather than published undisclosed. Send draft true to publish such a photo post and set the disclosure in the TikTok app.
70 71 72 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 70 def video_made_with_ai @video_made_with_ai end |
#video_original_sound_volume ⇒ Object
Volume of the video's own sound when a commercial track is attached (0 to 100). Requires musicSoundInfo. Video posts only.
67 68 69 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 67 def video_original_sound_volume @video_original_sound_volume end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
135 136 137 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 135 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
140 141 142 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 140 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 107 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', :'video_cover_image_url' => :'videoCoverImageUrl', :'photo_cover_index' => :'photoCoverIndex', :'auto_add_music' => :'autoAddMusic', :'music_sound_info' => :'musicSoundInfo', :'video_original_sound_volume' => :'videoOriginalSoundVolume', :'video_made_with_ai' => :'videoMadeWithAi', :'location_id' => :'locationId', :'location_name' => :'locationName', :'is_ads_only' => :'isAdsOnly', :'description' => :'description' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 451 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_nullable ⇒ Object
List of attributes with nullable: true
173 174 175 176 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 173 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 145 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', :'video_cover_image_url' => :'String', :'photo_cover_index' => :'Integer', :'auto_add_music' => :'Boolean', :'music_sound_info' => :'TikTokPlatformDataMusicSoundInfo', :'video_original_sound_volume' => :'Integer', :'video_made_with_ai' => :'Boolean', :'location_id' => :'String', :'location_name' => :'String', :'is_ads_only' => :'Boolean', :'description' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 409 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 && == o. && media_type == o.media_type && == o. && video_cover_image_url == o.video_cover_image_url && photo_cover_index == o.photo_cover_index && auto_add_music == o.auto_add_music && music_sound_info == o.music_sound_info && video_original_sound_volume == o.video_original_sound_volume && video_made_with_ai == o.video_made_with_ai && location_id == o.location_id && location_name == o.location_name && is_ads_only == o.is_ads_only && description == o.description end |
#eql?(o) ⇒ Boolean
438 439 440 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 438 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
444 445 446 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 444 def hash [draft, privacy_level, allow_comment, allow_duet, allow_stitch, commercial_content_type, brand_partner_promote, is_brand_organic_post, content_preview_confirmed, , media_type, , video_cover_image_url, photo_cover_index, auto_add_music, music_sound_info, video_original_sound_volume, video_made_with_ai, location_id, location_name, is_ads_only, description].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 285 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 !@video_original_sound_volume.nil? && @video_original_sound_volume > 100 invalid_properties.push('invalid value for "video_original_sound_volume", must be smaller than or equal to 100.') end if !@video_original_sound_volume.nil? && @video_original_sound_volume < 0 invalid_properties.push('invalid value for "video_original_sound_volume", 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_hash ⇒ Hash
Returns the object in the form of hash
473 474 475 476 477 478 479 480 481 482 483 484 485 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 473 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
313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 313 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 !@video_original_sound_volume.nil? && @video_original_sound_volume > 100 return false if !@video_original_sound_volume.nil? && @video_original_sound_volume < 0 return false if !@description.nil? && @description.to_s.length > 4000 true end |