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 description 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_brand_organic_post ⇒ Object
Whether the post promotes the creator's own brand (brand organic).
-
#media_type ⇒ Object
Optional override.
-
#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.
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
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 229 230 231 232 233 234 235 236 237 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 156 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?(:'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_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)
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 description for photo posts (max 4000 chars). Recommended when content exceeds 90 chars, as photo titles are auto-truncated.
68 69 70 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 68 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_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 |
#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 |
#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
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). The image is stitched as a single frame at the start of the video and used as the cover. 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
65 66 67 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 65 def video_made_with_ai @video_made_with_ai end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
116 117 118 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 116 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
121 122 123 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 121 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 93 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', :'video_made_with_ai' => :'videoMadeWithAi', :'description' => :'description' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 374 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
149 150 151 152 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 149 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 126 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', :'video_made_with_ai' => :'Boolean', :'description' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 337 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 && video_made_with_ai == o.video_made_with_ai && description == o.description end |
#eql?(o) ⇒ Boolean
361 362 363 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 361 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
367 368 369 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 367 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, video_made_with_ai, description].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 241 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_hash ⇒ Hash
Returns the object in the form of hash
396 397 398 399 400 401 402 403 404 405 406 407 408 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 396 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
261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/zernio-sdk/models/tik_tok_platform_data.rb', line 261 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 |