late-sdk 0.0.905 → 0.0.907

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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -0
  3. data/docs/AccountWithFollowerStats.md +2 -2
  4. data/docs/AdAccountsApi.md +1 -1
  5. data/docs/AdCampaignsApi.md +71 -1
  6. data/docs/AdCreative.md +4 -0
  7. data/docs/ConnectAds200ResponseOneOf.md +2 -0
  8. data/docs/ConnectApi.md +79 -5
  9. data/docs/CreateStandaloneAdRequest.md +8 -6
  10. data/docs/GooglePmaxAssetGroup.md +28 -0
  11. data/docs/GooglePmaxAssetGroupAssetsInner.md +28 -0
  12. data/docs/GooglePmaxAssetGroupInput.md +32 -0
  13. data/docs/GooglePmaxAssetGroupInputImages.md +22 -0
  14. data/docs/LeadGenApi.md +5 -5
  15. data/docs/ListAdAccounts200ResponseAccountsInner.md +4 -0
  16. data/docs/ListGoogleAssetGroups200Response.md +22 -0
  17. data/docs/SocialAccount.md +2 -2
  18. data/lib/zernio-sdk/api/ad_accounts_api.rb +2 -2
  19. data/lib/zernio-sdk/api/ad_campaigns_api.rb +70 -2
  20. data/lib/zernio-sdk/api/connect_api.rb +91 -6
  21. data/lib/zernio-sdk/api/lead_gen_api.rb +8 -8
  22. data/lib/zernio-sdk/models/account_with_follower_stats.rb +2 -2
  23. data/lib/zernio-sdk/models/ad_creative.rb +21 -1
  24. data/lib/zernio-sdk/models/connect_ads200_response_one_of.rb +45 -1
  25. data/lib/zernio-sdk/models/create_standalone_ad200_response_results_inner.rb +2 -2
  26. data/lib/zernio-sdk/models/create_standalone_ad_request.rb +18 -9
  27. data/lib/zernio-sdk/models/google_pmax_asset_group.rb +299 -0
  28. data/lib/zernio-sdk/models/google_pmax_asset_group_assets_inner.rb +244 -0
  29. data/lib/zernio-sdk/models/google_pmax_asset_group_input.rb +453 -0
  30. data/lib/zernio-sdk/models/google_pmax_asset_group_input_images.rb +280 -0
  31. data/lib/zernio-sdk/models/list_ad_accounts200_response_accounts_inner.rb +21 -1
  32. data/lib/zernio-sdk/models/list_google_asset_groups200_response.rb +204 -0
  33. data/lib/zernio-sdk/models/social_account.rb +2 -2
  34. data/lib/zernio-sdk/version.rb +1 -1
  35. data/lib/zernio-sdk.rb +5 -0
  36. data/openapi.yaml +277 -14
  37. data/spec/api/ad_accounts_api_spec.rb +1 -1
  38. data/spec/api/ad_campaigns_api_spec.rb +13 -1
  39. data/spec/api/connect_api_spec.rb +19 -3
  40. data/spec/api/lead_gen_api_spec.rb +4 -4
  41. data/spec/models/ad_creative_spec.rb +12 -0
  42. data/spec/models/connect_ads200_response_one_of_spec.rb +10 -0
  43. data/spec/models/create_standalone_ad200_response_results_inner_spec.rb +1 -1
  44. data/spec/models/create_standalone_ad_request_spec.rb +7 -1
  45. data/spec/models/google_pmax_asset_group_assets_inner_spec.rb +66 -0
  46. data/spec/models/google_pmax_asset_group_input_images_spec.rb +48 -0
  47. data/spec/models/google_pmax_asset_group_input_spec.rb +78 -0
  48. data/spec/models/google_pmax_asset_group_spec.rb +66 -0
  49. data/spec/models/list_ad_accounts200_response_accounts_inner_spec.rb +12 -0
  50. data/spec/models/list_google_asset_groups200_response_spec.rb +48 -0
  51. data/zernio-sdk-0.0.907.gem +0 -0
  52. metadata +22 -2
  53. data/zernio-sdk-0.0.905.gem +0 -0
@@ -0,0 +1,22 @@
1
+ # Zernio::ListGoogleAssetGroups200Response
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **asset_groups** | [**Array<GooglePmaxAssetGroup>**](GooglePmaxAssetGroup.md) | | |
8
+ | **cached_at** | **Time** | | |
9
+ | **stale** | **Boolean** | | |
10
+
11
+ ## Example
12
+
13
+ ```ruby
14
+ require 'zernio-sdk'
15
+
16
+ instance = Zernio::ListGoogleAssetGroups200Response.new(
17
+ asset_groups: null,
18
+ cached_at: null,
19
+ stale: null
20
+ )
21
+ ```
22
+
@@ -15,9 +15,9 @@
15
15
  | **needs_reconnection** | **Boolean** | The platform definitively reported the stored OAuth token as dead. While true, GET /v1/connect/{platform}/ads returns a fresh authUrl (implicit force=true) instead of alreadyConnected, so re-running the connect flow recovers the account. Cleared automatically when the account is re-authorized. | [optional] |
16
16
  | **followers_count** | **Float** | Follower count (only included if user has analytics add-on) | [optional] |
17
17
  | **followers_last_updated** | **Time** | Last time follower count was updated (only included if user has analytics add-on) | [optional] |
18
- | **parent_account_id** | **String** | Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. | [optional] |
18
+ | **parent_account_id** | **String** | Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. Meta ads business-login accounts also have no parent. | [optional] |
19
19
  | **enabled** | **Boolean** | Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts. | [optional] |
20
- | **metadata** | **Object** | Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName. | [optional] |
20
+ | **metadata** | **Object** | Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token. For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName. | [optional] |
21
21
 
22
22
  ## Example
23
23
 
@@ -1787,7 +1787,7 @@ module Zernio
1787
1787
  end
1788
1788
 
1789
1789
  # List ad accounts
1790
- # Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
1790
+ # Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). Meta business-login accounts use their own system-user token. Fresh Meta discovery includes businessId and businessName from the owning Business Manager when available; cached entries gain these fields after the next discovery refresh. For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
1791
1791
  # @param account_id [String] Account ID
1792
1792
  # @param [Hash] opts the optional parameters
1793
1793
  # @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.
@@ -1799,7 +1799,7 @@ module Zernio
1799
1799
  end
1800
1800
 
1801
1801
  # List ad accounts
1802
- # Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
1802
+ # Returns the platform ad accounts available for the given account (e.g. Meta ad accounts, TikTok advertiser IDs, Google Ads customer IDs). Meta business-login accounts use their own system-user token. Fresh Meta discovery includes businessId and businessName from the owning Business Manager when available; cached entries gain these fields after the next discovery refresh. For TikTok agencies: enumerates every advertiser under every Business Center the token can read (paginated server-side), then chunks the lookup against TikTok's `/advertiser/info/` endpoint (which has a per-call cap of ≤100 IDs). Solo advertisers without a BC fall back to the OAuth-time `advertiser_ids` list. Cached for 1h on the SocialAccount; lazy-refreshed on first call after expiry. For Google Ads: responds `429` when Google's API quota is temporarily exhausted (instead of an empty list). Retry after a delay.
1803
1803
  # @param account_id [String] Account ID
1804
1804
  # @param [Hash] opts the optional parameters
1805
1805
  # @option opts [String] :ad_account_id Filter response to a single platform ad account ID (e.g. `act_123` for Meta, advertiser_id for TikTok). Returns at most one item.
@@ -607,7 +607,7 @@ module Zernio
607
607
  end
608
608
 
609
609
  # Create standalone ad
610
- # Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads). Three mutually-exclusive request shapes are selected by the body: - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn). On LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. Meta accepts `promotion` and `creativeFeatures` on the single and attach shapes and as defaults for `creatives[]`. An item replaces the whole feature map; its `promotion` replaces the default offer, and `promotion: null` disables that default for the item. Reusing `existingCreativeId` uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads. Only ads supplied a `promotion` receive live readback; multi-create batches those reads in groups of up to 50 IDs without per-ad fallback. Inspect `ad.creative.promotionStatus` (or `ads[].creative.promotionStatus`). `not_returned` means Meta omitted the metadata; successful creation does not by itself prove the offer was applied or will display. Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content \"dark post\" authored by a Company Page (see `organizationId`). Supported goals are engagement, traffic, awareness, and video_views (video ads use the `video` field; video_views requires a video), and traffic ads require `linkUrl`. **Idempotency:** this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an `Idempotency-Key` header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.
610
+ # Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads). Google Performance Max: set `campaignType: \"pmax\"` and supply `assetGroup` with text, images by role, business name and finalUrl. Creates a daily budget, PAUSED campaign and asset group atomically. `validateOnly: true` validates the complete request with Google without creating or persisting resources. Read assets with `GET /v1/ads/campaigns/{campaignId}/asset-groups`. The logo is required; video is optional via `assetGroup.youtubeVideoId`. Brand guidelines are disabled at creation. PMax rejects ACTIVE creation, portfolio bidding, bid caps, legacy creative fields and attach shapes. Geo and language targeting are supported; omitted geo targets all locations. PMax does not require top-level goal, headline, body or linkUrl. Supported bidding: omitted or LOWEST_COST_WITHOUT_CAP for Maximize Conversions, COST_CAP plus bidAmount for target CPA, LOWEST_COST_WITH_MIN_ROAS plus roasAverageFloor for Maximize Conversion Value with target ROAS. Other mutually-exclusive request shapes are selected by the body: - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn). On LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. Meta accepts `promotion` and `creativeFeatures` on the single and attach shapes and as defaults for `creatives[]`. An item replaces the whole feature map; its `promotion` replaces the default offer, and `promotion: null` disables that default for the item. Reusing `existingCreativeId` uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads. Only ads supplied a `promotion` receive live readback; multi-create batches those reads in groups of up to 50 IDs without per-ad fallback. Inspect `ad.creative.promotionStatus` (or `ads[].creative.promotionStatus`). `not_returned` means Meta omitted the metadata; successful creation does not by itself prove the offer was applied or will display. Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content \"dark post\" authored by a Company Page (see `organizationId`). Supported goals are engagement, traffic, awareness, and video_views (video ads use the `video` field; video_views requires a video), and traffic ads require `linkUrl`. **Idempotency:** this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an `Idempotency-Key` header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.
611
611
  # @param create_standalone_ad_request [CreateStandaloneAdRequest]
612
612
  # @param [Hash] opts the optional parameters
613
613
  # @option opts [String] :idempotency_key Optional client-generated unique key (e.g. a UUID) that makes retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.
@@ -618,7 +618,7 @@ module Zernio
618
618
  end
619
619
 
620
620
  # Create standalone ad
621
- # Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads). Three mutually-exclusive request shapes are selected by the body: - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn). On LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. Meta accepts `promotion` and `creativeFeatures` on the single and attach shapes and as defaults for `creatives[]`. An item replaces the whole feature map; its `promotion` replaces the default offer, and `promotion: null` disables that default for the item. Reusing `existingCreativeId` uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads. Only ads supplied a `promotion` receive live readback; multi-create batches those reads in groups of up to 50 IDs without per-ad fallback. Inspect `ad.creative.promotionStatus` (or `ads[].creative.promotionStatus`). `not_returned` means Meta omitted the metadata; successful creation does not by itself prove the offer was applied or will display. Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content \"dark post\" authored by a Company Page (see `organizationId`). Supported goals are engagement, traffic, awareness, and video_views (video ads use the `video` field; video_views requires a video), and traffic ads require `linkUrl`. **Idempotency:** this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an `Idempotency-Key` header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.
621
+ # Create a paid ad with custom creative across Meta, Google Ads, Pinterest, TikTok, X, LinkedIn, and OpenAI Ads (ChatGPT Ads). Google Performance Max: set `campaignType: \"pmax\"` and supply `assetGroup` with text, images by role, business name and finalUrl. Creates a daily budget, PAUSED campaign and asset group atomically. `validateOnly: true` validates the complete request with Google without creating or persisting resources. Read assets with `GET /v1/ads/campaigns/{campaignId}/asset-groups`. The logo is required; video is optional via `assetGroup.youtubeVideoId`. Brand guidelines are disabled at creation. PMax rejects ACTIVE creation, portfolio bidding, bid caps, legacy creative fields and attach shapes. Geo and language targeting are supported; omitted geo targets all locations. PMax does not require top-level goal, headline, body or linkUrl. Supported bidding: omitted or LOWEST_COST_WITHOUT_CAP for Maximize Conversions, COST_CAP plus bidAmount for target CPA, LOWEST_COST_WITH_MIN_ROAS plus roasAverageFloor for Maximize Conversion Value with target ROAS. Other mutually-exclusive request shapes are selected by the body: - Legacy single-creative shape (all platforms, the default). - Meta-only multi-creative shape via the creatives array: one ad set with N ads sharing budget and targeting. - Attach shape via adSetId: adds one new ad to an existing ad set, inheriting its budget, targeting, and schedule (Meta, Google Ads, TikTok, and LinkedIn). On LinkedIn adSetId is the existing Campaign id, and the budget, schedule, targeting and bidding fields must be omitted. Meta accepts `promotion` and `creativeFeatures` on the single and attach shapes and as defaults for `creatives[]`. An item replaces the whole feature map; its `promotion` replaces the default offer, and `promotion: null` disables that default for the item. Reusing `existingCreativeId` uses the existing creative settings instead of new settings. Requested settings are persisted for lists, exports, and default ad-detail reads. Only ads supplied a `promotion` receive live readback; multi-create batches those reads in groups of up to 50 IDs without per-ad fallback. Inspect `ad.creative.promotionStatus` (or `ads[].creative.promotionStatus`). `not_returned` means Meta omitted the metadata; successful creation does not by itself prove the offer was applied or will display. Per-platform required fields, budget minimums, and video-ad rules are documented on each property below. LinkedIn creates a Single Image or Single Video Ad backed by a Direct Sponsored Content \"dark post\" authored by a Company Page (see `organizationId`). Supported goals are engagement, traffic, awareness, and video_views (video ads use the `video` field; video_views requires a video), and traffic ads require `linkUrl`. **Idempotency:** this endpoint is not idempotent at the platform level (a blind retry creates a second campaign/ad set/ad). Send an `Idempotency-Key` header to make retries safe: the first request with a given key creates the ad and we store the response; a retry with the same key replays that exact response (with `Idempotent-Replayed: true`) instead of creating duplicates. Reusing a key with a different body returns 422; a key whose first request is still in flight returns 409 (retry after a short backoff). Keys are scoped to your credential and expire after 24h.
622
622
  # @param create_standalone_ad_request [CreateStandaloneAdRequest]
623
623
  # @param [Hash] opts the optional parameters
624
624
  # @option opts [String] :idempotency_key Optional client-generated unique key (e.g. a UUID) that makes retries safe. Same key + same body replays the original response; same key + different body → 422; key still processing → 409.
@@ -2464,6 +2464,74 @@ module Zernio
2464
2464
  return data, status_code, headers
2465
2465
  end
2466
2466
 
2467
+ # List Performance Max asset groups
2468
+ # Read Performance Max asset groups and their linked text, image and YouTube assets. campaignId is the platform campaign id returned by creation or the campaign list. The campaign must be visible to the caller. Uses a 10-minute cache, with the last successful response served as stale when Google quota is exhausted. Removed groups and asset links are excluded. Campaign-level brand assets on campaigns with brand guidelines enabled are not included.
2469
+ # @param campaign_id [String] Google Ads campaign id.
2470
+ # @param [Hash] opts the optional parameters
2471
+ # @return [ListGoogleAssetGroups200Response]
2472
+ def list_google_asset_groups(campaign_id, opts = {})
2473
+ data, _status_code, _headers = list_google_asset_groups_with_http_info(campaign_id, opts)
2474
+ data
2475
+ end
2476
+
2477
+ # List Performance Max asset groups
2478
+ # Read Performance Max asset groups and their linked text, image and YouTube assets. campaignId is the platform campaign id returned by creation or the campaign list. The campaign must be visible to the caller. Uses a 10-minute cache, with the last successful response served as stale when Google quota is exhausted. Removed groups and asset links are excluded. Campaign-level brand assets on campaigns with brand guidelines enabled are not included.
2479
+ # @param campaign_id [String] Google Ads campaign id.
2480
+ # @param [Hash] opts the optional parameters
2481
+ # @return [Array<(ListGoogleAssetGroups200Response, Integer, Hash)>] ListGoogleAssetGroups200Response data, response status code and response headers
2482
+ def list_google_asset_groups_with_http_info(campaign_id, opts = {})
2483
+ if @api_client.config.debugging
2484
+ @api_client.config.logger.debug 'Calling API: AdCampaignsApi.list_google_asset_groups ...'
2485
+ end
2486
+ # verify the required parameter 'campaign_id' is set
2487
+ if @api_client.config.client_side_validation && campaign_id.nil?
2488
+ fail ArgumentError, "Missing the required parameter 'campaign_id' when calling AdCampaignsApi.list_google_asset_groups"
2489
+ end
2490
+ pattern = Regexp.new(/^\d+$/)
2491
+ if @api_client.config.client_side_validation && campaign_id !~ pattern
2492
+ fail ArgumentError, "invalid value for 'campaign_id' when calling AdCampaignsApi.list_google_asset_groups, must conform to the pattern #{pattern}."
2493
+ end
2494
+
2495
+ # resource path
2496
+ local_var_path = '/v1/ads/campaigns/{campaignId}/asset-groups'.sub('{' + 'campaignId' + '}', CGI.escape(campaign_id.to_s))
2497
+
2498
+ # query parameters
2499
+ query_params = opts[:query_params] || {}
2500
+
2501
+ # header parameters
2502
+ header_params = opts[:header_params] || {}
2503
+ # HTTP header 'Accept' (if needed)
2504
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2505
+
2506
+ # form parameters
2507
+ form_params = opts[:form_params] || {}
2508
+
2509
+ # http body (model)
2510
+ post_body = opts[:debug_body]
2511
+
2512
+ # return_type
2513
+ return_type = opts[:debug_return_type] || 'ListGoogleAssetGroups200Response'
2514
+
2515
+ # auth_names
2516
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
2517
+
2518
+ new_options = opts.merge(
2519
+ :operation => :"AdCampaignsApi.list_google_asset_groups",
2520
+ :header_params => header_params,
2521
+ :query_params => query_params,
2522
+ :form_params => form_params,
2523
+ :body => post_body,
2524
+ :auth_names => auth_names,
2525
+ :return_type => return_type
2526
+ )
2527
+
2528
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2529
+ if @api_client.config.debugging
2530
+ @api_client.config.logger.debug "API called: AdCampaignsApi#list_google_asset_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2531
+ end
2532
+ return data, status_code, headers
2533
+ end
2534
+
2467
2535
  # Remove ad-group assets
2468
2536
  # Removes the specified attachments only. Google assets cannot be deleted. Other attachments remain. assetResourceNames is retained for compatibility.
2469
2537
  # @param ad_set_id [String] Numeric Google platform id.
@@ -93,6 +93,76 @@ module Zernio
93
93
  return data, status_code, headers
94
94
  end
95
95
 
96
+ # Complete Meta business login
97
+ # Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser.
98
+ # @param state [String] Authenticated state from the initial connectAds response.
99
+ # @param [Hash] opts the optional parameters
100
+ # @option opts [String] :code Single-use authorization code returned by Meta.
101
+ # @option opts [String] :error Meta authorization error when the user declines the dialog.
102
+ # @return [nil]
103
+ def complete_meta_ads_business_login(state, opts = {})
104
+ complete_meta_ads_business_login_with_http_info(state, opts)
105
+ nil
106
+ end
107
+
108
+ # Complete Meta business login
109
+ # Facebook Login for Business redirect target. Meta supplies the single-use authorization code and the authenticated state returned by connectAds. The state expires after 30 minutes and binds the user, profile, Page selection and ad-account scope. No bearer token is sent by the browser. Success reconnects only metaads and redirects to the original redirect_url. Invalid state returns 400; inaccessible profiles or missing ads access cannot connect. No token is returned to the browser.
110
+ # @param state [String] Authenticated state from the initial connectAds response.
111
+ # @param [Hash] opts the optional parameters
112
+ # @option opts [String] :code Single-use authorization code returned by Meta.
113
+ # @option opts [String] :error Meta authorization error when the user declines the dialog.
114
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
115
+ def complete_meta_ads_business_login_with_http_info(state, opts = {})
116
+ if @api_client.config.debugging
117
+ @api_client.config.logger.debug 'Calling API: ConnectApi.complete_meta_ads_business_login ...'
118
+ end
119
+ # verify the required parameter 'state' is set
120
+ if @api_client.config.client_side_validation && state.nil?
121
+ fail ArgumentError, "Missing the required parameter 'state' when calling ConnectApi.complete_meta_ads_business_login"
122
+ end
123
+ # resource path
124
+ local_var_path = '/v1/connect/meta-ads/callback'
125
+
126
+ # query parameters
127
+ query_params = opts[:query_params] || {}
128
+ query_params[:'state'] = state
129
+ query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
130
+ query_params[:'error'] = opts[:'error'] if !opts[:'error'].nil?
131
+
132
+ # header parameters
133
+ header_params = opts[:header_params] || {}
134
+ # HTTP header 'Accept' (if needed)
135
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
136
+
137
+ # form parameters
138
+ form_params = opts[:form_params] || {}
139
+
140
+ # http body (model)
141
+ post_body = opts[:debug_body]
142
+
143
+ # return_type
144
+ return_type = opts[:debug_return_type]
145
+
146
+ # auth_names
147
+ auth_names = opts[:debug_auth_names] || []
148
+
149
+ new_options = opts.merge(
150
+ :operation => :"ConnectApi.complete_meta_ads_business_login",
151
+ :header_params => header_params,
152
+ :query_params => query_params,
153
+ :form_params => form_params,
154
+ :body => post_body,
155
+ :auth_names => auth_names,
156
+ :return_type => return_type
157
+ )
158
+
159
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
160
+ if @api_client.config.debugging
161
+ @api_client.config.logger.debug "API called: ConnectApi#complete_meta_ads_business_login\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
162
+ end
163
+ return data, status_code, headers
164
+ end
165
+
96
166
  # Check Telegram status
97
167
  # Poll this endpoint to check if a Telegram access code has been used to connect a channel/group. Recommended polling interval: 3 seconds. Status values: pending (waiting for user), connected (channel/group linked), expired (generate a new code).
98
168
  # @param code [String] The access code to check status for
@@ -297,15 +367,17 @@ module Zernio
297
367
  end
298
368
 
299
369
  # Connect ads for a platform
300
- # Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
301
- # @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. &#x60;instagram&#x60; requires an Instagram account connected with loginMethod&#x3D;facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
370
+ # Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Meta business login (opt-in).** Set `loginMode=business` for `facebook` or `instagram` to use Facebook Login for Business and a Business Integration System User token. No posting account is created or required. This mode always returns an authUrl; it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a browser. The callback creates or reconnects only the metaads account, preserving its ID, history and scopedAdAccountIds. Non-empty successful subscription results replace subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant every previously scoped ad account (or every previous grant for an unscoped connection). Missing or unverifiable grants return 409 before changing the account. Pass `pageId` to select a granted Page for creatives and lead forms. Otherwise the previous Page or sole granted Page is selected. Multiple Pages without a selection return 400 with available Page IDs; restart with pageId. With no Pages granted the account can manage campaigns and sync insights but cannot create Page-based creatives or list Page forms. Success redirects with connected=metaads, profileId and accountId. Business login reports metadata.tokenType=system-user in GET /v1/accounts. An absent Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs. Subsequent classic requests can change the ad-account scope using the business token; force=true requires loginMode=business to reconnect that connection. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod=facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error=no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId=null and standalone ads use a synthetic CUSTOMIZED_USER (\"Brand Identity\"); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There's no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
371
+ # @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, &#x60;instagram&#x60; requires an Instagram account connected with loginMethod&#x3D;facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
302
372
  # @param profile_id [String] Your Zernio profile ID
303
373
  # @param [Hash] opts the optional parameters
374
+ # @option opts [String] :login_mode Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow. (default to 'classic')
375
+ # @option opts [String] :page_id Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms.
304
376
  # @option opts [String] :account_id Existing SocialAccount ID. Required for &#x60;twitter&#x60; (X Ads). Optional for &#x60;tiktok&#x60;: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (&#x60;facebook&#x60;, &#x60;instagram&#x60;, &#x60;linkedin&#x60;, &#x60;pinterest&#x60;) and standalone (&#x60;googleads&#x60;) platforms.
305
377
  # @option opts [String] :redirect_url Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (&#x60;tiktok&#x60;, &#x60;twitter&#x60;) and standalone (&#x60;googleads&#x60;) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success &#x60;tiktok&#x60;, &#x60;twitter&#x60; and &#x60;googleads&#x60; land on the URL unchanged, while the same-token platforms (&#x60;facebook&#x60;, &#x60;instagram&#x60;, &#x60;linkedin&#x60;, &#x60;pinterest&#x60;) append &#x60;connected&#x60;, &#x60;profileId&#x60;, &#x60;accountId&#x60;, &#x60;username&#x60; and, on API-key calls, &#x60;connect_token&#x60;. On failure the same error contract applies as on GET /v1/connect/{platform}: &#x60;error&#x60; and &#x60;platform&#x60; are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows &#x60;platform&#x60; carries the ads platform id (&#x60;tiktokads&#x60;, &#x60;xads&#x60;, &#x60;googleads&#x60;), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard.
306
378
  # @option opts [Boolean] :headless Enable headless mode (same-token platforms only) (default to false)
307
379
  # @option opts [Boolean] :force Force a fresh OAuth even when an account already exists. Normally the endpoint returns &#x60;alreadyConnected: true&#x60; whenever a connected account is found, keying off its active state rather than token liveness. Set &#x60;force&#x3D;true&#x60; to bypass that and always receivean &#x60;authUrl&#x60;. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place. (default to false)
308
- # @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on &#x60;facebook&#x60;/&#x60;instagram&#x60; (Meta, &#x60;act_&lt;digits&gt;&#x60;), &#x60;linkedin&#x60; (bare numeric sponsored-account id), &#x60;googleads&#x60; (bare customer id digits) and &#x60;twitter&#x60; (X Ads, base36 account id). &#x60;tiktok&#x60; scopes advertisers at OAuth and &#x60;pinterest&#x60; has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use &#x60;adAccountIds&#x60; instead.
380
+ # @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on &#x60;facebook&#x60;/&#x60;instagram&#x60; (Meta, &#x60;act_&lt;digits&gt;&#x60;), &#x60;linkedin&#x60; (bare numeric sponsored-account id), &#x60;googleads&#x60; (bare customer id digits) and &#x60;twitter&#x60; (X Ads, base36 account id). &#x60;tiktok&#x60; scopes advertisers at OAuth and &#x60;pinterest&#x60; has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use &#x60;adAccountIds&#x60; instead.
309
381
  # @option opts [Array<String>] :ad_account_ids Scope ad sync to multiple platform ad accounts (same platform support and id shapes as &#x60;adAccountId&#x60;). Repeat the param (&#x60;?adAccountIds&#x3D;act_1&amp;adAccountIds&#x3D;act_2&#x60;) or comma-separate (&#x60;?adAccountIds&#x3D;act_1,act_2&#x60;). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both &#x60;adAccountId&#x60; and &#x60;adAccountIds&#x60; keeps any previously persisted scope unchanged.
310
382
  # @return [ConnectAds200Response]
311
383
  def connect_ads(platform, profile_id, opts = {})
@@ -314,15 +386,17 @@ module Zernio
314
386
  end
315
387
 
316
388
  # Connect ads for a platform
317
- # Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod&#x3D;facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error&#x3D;no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId&#x3D;null and standalone ads use a synthetic CUSTOMIZED_USER (\&quot;Brand Identity\&quot;); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There&#39;s no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
318
- # @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. &#x60;instagram&#x60; requires an Instagram account connected with loginMethod&#x3D;facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
389
+ # Unified ads connection endpoint. Creates a dedicated ads SocialAccount for the specified platform. **Meta business login (opt-in).** Set &#x60;loginMode&#x3D;business&#x60; for &#x60;facebook&#x60; or &#x60;instagram&#x60; to use Facebook Login for Business and a Business Integration System User token. No posting account is created or required. This mode always returns an authUrl; it returns 503 when the server has no META_ADS_CONFIG_ID. Complete the dialog in a browser. The callback creates or reconnects only the metaads account, preserving its ID, history and scopedAdAccountIds. Non-empty successful subscription results replace subscribedAdAccountIds to remove stale grants; an empty result leaves routing unchanged. A reconnect must grant every previously scoped ad account (or every previous grant for an unscoped connection). Missing or unverifiable grants return 409 before changing the account. Pass &#x60;pageId&#x60; to select a granted Page for creatives and lead forms. Otherwise the previous Page or sole granted Page is selected. Multiple Pages without a selection return 400 with available Page IDs; restart with pageId. With no Pages granted the account can manage campaigns and sync insights but cannot create Page-based creatives or list Page forms. Success redirects with connected&#x3D;metaads, profileId and accountId. Business login reports metadata.tokenType&#x3D;system-user in GET /v1/accounts. An absent Meta expires_in leaves tokenExpiresAt absent; no personal-token re-exchange occurs. Subsequent classic requests can change the ad-account scope using the business token; force&#x3D;true requires loginMode&#x3D;business to reconnect that connection. **Same-token platforms (facebook, instagram, linkedin, pinterest).** The ads SocialAccount (metaads, linkedinads, pinterestads) reuses the OAuth token of the parent posting account, but only when an active parent exists and, for facebook and instagram, its stored token carries ads_management and ads_read (linkedin and pinterest need no extra scope). In that case no extra OAuth happens and the response is alreadyConnected: true. When no such parent exists, or the scopes are missing, the endpoint returns an authUrl and a full OAuth round trip is required. When a parent exists but carries no token usable for ad accounts, the call fails with 400 RECONNECT_REQUIRED. Independently of the branch, the call can return 403 ADS_ADDON_REQUIRED without the ads add-on and 402 PAYMENT_REQUIRED when the billing gate is closed. Meta Ads prerequisite: connecting Meta Ads (via facebook or instagram) requires a Facebook Page. Not because the ad account is read through a Page, but because both parent posting accounts are: the facebook flow only offers Pages you manage, and the instagram flow with loginMethod&#x3D;facebook_login only offers Instagram accounts linked to one of those Pages. Without a Page there is no parent account to inherit a token from. A user who manages no Facebook Page cannot complete this connection, and the facebook flow ends with error&#x3D;no_facebook_pages. **Separate-token platforms (tiktok, twitter).** Starts the platform-specific marketing API OAuth flow and creates an ads SocialAccount (tiktokads, xads) with its own token. If the ads account already exists, returns alreadyConnected: true. - tiktok: accountId is OPTIONAL. With accountId, the new tiktokads account links to that posting account (parentAccountId set), so Spark Ads + standalone ads using the posting TT_USER identity become available. Without accountId, ads-only mode kicks in: the new tiktokads account has parentAccountId&#x3D;null and standalone ads use a synthetic CUSTOMIZED_USER (\&quot;Brand Identity\&quot;); Spark Ads are unavailable because TikTok requires a posting account for them. The Brand Identity is configured separately via PATCH /v1/connect/tiktok-ads (or inline on POST /v1/ads/create via the brandIdentity field). - twitter (X Ads): accountId is REQUIRED. There&#39;s no ads-only mode, because tweets need to be authored by a real X user. **Standalone platforms (googleads).** Starts the Google Ads OAuth flow and creates a standalone ads SocialAccount (googleads) with no parent. If the account already exists, returns alreadyConnected: true. Ads accounts appear as regular SocialAccount documents with ads platform values (e.g., metaads, tiktokads) in GET /v1/accounts.
390
+ # @param platform [String] Platform to connect ads for. Only platforms with ads support are accepted. In classic mode, &#x60;instagram&#x60; requires an Instagram account connected with loginMethod&#x3D;facebook_login whose token carries ads_management and ads_read. With an account connected through the default instagram_login flow no ads account can be created; do not use this value for those accounts.
319
391
  # @param profile_id [String] Your Zernio profile ID
320
392
  # @param [Hash] opts the optional parameters
393
+ # @option opts [String] :login_mode Meta ads authorization mode. Business login is opt-in for Facebook and Instagram; classic preserves the posting-account flow. (default to 'classic')
394
+ # @option opts [String] :page_id Business login only. Facebook Page ID to select from the token grants for ad creatives and lead forms.
321
395
  # @option opts [String] :account_id Existing SocialAccount ID. Required for &#x60;twitter&#x60; (X Ads). Optional for &#x60;tiktok&#x60;: omit to enter ads-only mode (no TikTok posting account linked; ad creation uses a Brand Identity instead of a TT_USER). Ignored for same-token (&#x60;facebook&#x60;, &#x60;instagram&#x60;, &#x60;linkedin&#x60;, &#x60;pinterest&#x60;) and standalone (&#x60;googleads&#x60;) platforms.
322
396
  # @option opts [String] :redirect_url Custom URL the browser is sent to once the OAuth flow finishes. Honored on every ads platform, including the separate-token (&#x60;tiktok&#x60;, &#x60;twitter&#x60;) and standalone (&#x60;googleads&#x60;) flows. MUST be an absolute http(s) URL or a custom app scheme for mobile deeplinks (e.g. myapp://callback); a relative path is rejected with 400 INVALID_REDIRECT_URL. On success &#x60;tiktok&#x60;, &#x60;twitter&#x60; and &#x60;googleads&#x60; land on the URL unchanged, while the same-token platforms (&#x60;facebook&#x60;, &#x60;instagram&#x60;, &#x60;linkedin&#x60;, &#x60;pinterest&#x60;) append &#x60;connected&#x60;, &#x60;profileId&#x60;, &#x60;accountId&#x60;, &#x60;username&#x60; and, on API-key calls, &#x60;connect_token&#x60;. On failure the same error contract applies as on GET /v1/connect/{platform}: &#x60;error&#x60; and &#x60;platform&#x60; are always appended, other params are optional, and the value list there is not exhaustive. On the tiktok, twitter and googleads flows &#x60;platform&#x60; carries the ads platform id (&#x60;tiktokads&#x60;, &#x60;xads&#x60;, &#x60;googleads&#x60;), not the value used in the request path. When omitted, the browser lands on the Zernio dashboard.
323
397
  # @option opts [Boolean] :headless Enable headless mode (same-token platforms only) (default to false)
324
398
  # @option opts [Boolean] :force Force a fresh OAuth even when an account already exists. Normally the endpoint returns &#x60;alreadyConnected: true&#x60; whenever a connected account is found, keying off its active state rather than token liveness. Set &#x60;force&#x3D;true&#x60; to bypass that and always receivean &#x60;authUrl&#x60;. Completing the returned OAuth refreshes the stored token on the existing posting and ads accounts in place. (default to false)
325
- # @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Supported on &#x60;facebook&#x60;/&#x60;instagram&#x60; (Meta, &#x60;act_&lt;digits&gt;&#x60;), &#x60;linkedin&#x60; (bare numeric sponsored-account id), &#x60;googleads&#x60; (bare customer id digits) and &#x60;twitter&#x60; (X Ads, base36 account id). &#x60;tiktok&#x60; scopes advertisers at OAuth and &#x60;pinterest&#x60; has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use &#x60;adAccountIds&#x60; instead.
399
+ # @option opts [String] :ad_account_id Scope ad sync to a single platform ad account. Without this param, sync covers every ad account the connected token can see. Business-login reconnects preserve the existing scope; supplied IDs are checked against the new grant. To change that scope after migration, call this endpoint with the IDs and omit loginMode. Supported on &#x60;facebook&#x60;/&#x60;instagram&#x60; (Meta, &#x60;act_&lt;digits&gt;&#x60;), &#x60;linkedin&#x60; (bare numeric sponsored-account id), &#x60;googleads&#x60; (bare customer id digits) and &#x60;twitter&#x60; (X Ads, base36 account id). &#x60;tiktok&#x60; scopes advertisers at OAuth and &#x60;pinterest&#x60; has no ads discovery, so both ignore it. Meta ids are additionally validated against the connected token; unreachable IDs return 400. Setting a scope also removes already synced ads from de-scoped ad accounts. For multiple accounts use &#x60;adAccountIds&#x60; instead.
326
400
  # @option opts [Array<String>] :ad_account_ids Scope ad sync to multiple platform ad accounts (same platform support and id shapes as &#x60;adAccountId&#x60;). Repeat the param (&#x60;?adAccountIds&#x3D;act_1&amp;adAccountIds&#x3D;act_2&#x60;) or comma-separate (&#x60;?adAccountIds&#x3D;act_1,act_2&#x60;). Persisted server-side; latest call wins, and de-scoped ad accounts have their synced ads removed. Omitting both &#x60;adAccountId&#x60; and &#x60;adAccountIds&#x60; keeps any previously persisted scope unchanged.
327
401
  # @return [Array<(ConnectAds200Response, Integer, Hash)>] ConnectAds200Response data, response status code and response headers
328
402
  def connect_ads_with_http_info(platform, profile_id, opts = {})
@@ -342,12 +416,23 @@ module Zernio
342
416
  if @api_client.config.client_side_validation && profile_id.nil?
343
417
  fail ArgumentError, "Missing the required parameter 'profile_id' when calling ConnectApi.connect_ads"
344
418
  end
419
+ allowable_values = ["classic", "business"]
420
+ if @api_client.config.client_side_validation && opts[:'login_mode'] && !allowable_values.include?(opts[:'login_mode'])
421
+ fail ArgumentError, "invalid value for \"login_mode\", must be one of #{allowable_values}"
422
+ end
423
+ pattern = Regexp.new(/^\d+$/)
424
+ if @api_client.config.client_side_validation && !opts[:'page_id'].nil? && opts[:'page_id'] !~ pattern
425
+ fail ArgumentError, "invalid value for 'opts[:\"page_id\"]' when calling ConnectApi.connect_ads, must conform to the pattern #{pattern}."
426
+ end
427
+
345
428
  # resource path
346
429
  local_var_path = '/v1/connect/{platform}/ads'.sub('{' + 'platform' + '}', CGI.escape(platform.to_s))
347
430
 
348
431
  # query parameters
349
432
  query_params = opts[:query_params] || {}
350
433
  query_params[:'profileId'] = profile_id
434
+ query_params[:'loginMode'] = opts[:'login_mode'] if !opts[:'login_mode'].nil?
435
+ query_params[:'pageId'] = opts[:'page_id'] if !opts[:'page_id'].nil?
351
436
  query_params[:'accountId'] = opts[:'account_id'] if !opts[:'account_id'].nil?
352
437
  query_params[:'redirect_url'] = opts[:'redirect_url'] if !opts[:'redirect_url'].nil?
353
438
  query_params[:'headless'] = opts[:'headless'] if !opts[:'headless'].nil?
@@ -90,7 +90,7 @@ module Zernio
90
90
  end
91
91
 
92
92
  # Create a lead form
93
- # Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
93
+ # Creates a Lead Gen form. The form content goes inside `platformSpecificData` for both platforms (the shape is selected by the accountId's platform). Meta: created on the connected Facebook Page (a facebook account or a metaads business-login account with a selected Page) (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account's Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
94
94
  # @param create_lead_form_request [CreateLeadFormRequest]
95
95
  # @param [Hash] opts the optional parameters
96
96
  # @return [CreateLeadForm200Response]
@@ -100,7 +100,7 @@ module Zernio
100
100
  end
101
101
 
102
102
  # Create a lead form
103
- # Creates a Lead Gen form. The form content goes inside &#x60;platformSpecificData&#x60; for both platforms (the shape is selected by the accountId&#39;s platform). Meta: created on the connected Facebook Page (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account&#39;s Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
103
+ # Creates a Lead Gen form. The form content goes inside &#x60;platformSpecificData&#x60; for both platforms (the shape is selected by the accountId&#39;s platform). Meta: created on the connected Facebook Page (a facebook account or a metaads business-login account with a selected Page) (POST /{page-id}/leadgen_forms); the old top-level Meta fields (questions, thankYou*, contextCard, …) are DEPRECATED but still accepted while platformSpecificData is absent; mixing both shapes is a 400. LinkedIn: created on the ad account&#39;s Company Page. NOT idempotent: a retry creates a second form. Meta prefilled question types (EMAIL, PHONE, FULL_NAME, …) must omit label/key; CUSTOM questions require both. LinkedIn exposes only free-text and multiple-choice questions via API (prefilled-from-profile fields are Campaign Manager UI-only). Requires the Ads add-on.
104
104
  # @param create_lead_form_request [CreateLeadFormRequest]
105
105
  # @param [Hash] opts the optional parameters
106
106
  # @return [Array<(CreateLeadForm200Response, Integer, Hash)>] CreateLeadForm200Response data, response status code and response headers
@@ -300,7 +300,7 @@ module Zernio
300
300
  end
301
301
 
302
302
  # List leads for a single form
303
- # Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
303
+ # Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read. Accepts a Facebook account or a metaads business-login account with leads_retrieval access to the form; the latter uses its system-user token without a posting parent.
304
304
  # @param form_id [String]
305
305
  # @param account_id [String]
306
306
  # @param [Hash] opts the optional parameters
@@ -314,7 +314,7 @@ module Zernio
314
314
  end
315
315
 
316
316
  # List leads for a single form
317
- # Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read.
317
+ # Returns leads for one form. Serves persisted leads (ingested via the leadgen webhook) when available, falling back to a live Graph read. Accepts a Facebook account or a metaads business-login account with leads_retrieval access to the form; the latter uses its system-user token without a posting parent.
318
318
  # @param form_id [String]
319
319
  # @param account_id [String]
320
320
  # @param [Hash] opts the optional parameters
@@ -387,8 +387,8 @@ module Zernio
387
387
  end
388
388
 
389
389
  # List lead forms
390
- # Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
391
- # @param account_id [String] Connected facebook or linkedin ads account id.
390
+ # Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account's Company Page. Pass `adAccountId` (LinkedIn forms are org-owned). Requires the Ads add-on.
391
+ # @param account_id [String] Connected Facebook, Meta ads business-login or LinkedIn ads account ID.
392
392
  # @param [Hash] opts the optional parameters
393
393
  # @option opts [String] :ad_account_id LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn.
394
394
  # @option opts [Integer] :limit (default to 25)
@@ -400,8 +400,8 @@ module Zernio
400
400
  end
401
401
 
402
402
  # List lead forms
403
- # Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page. LinkedIn: forms owned by the ad account&#39;s Company Page. Pass &#x60;adAccountId&#x60; (LinkedIn forms are org-owned). Requires the Ads add-on.
404
- # @param account_id [String] Connected facebook or linkedin ads account id.
403
+ # Lists the Lead Gen forms owned by the account. Meta: forms on the connected Facebook Page, including a Page selected on a metaads business-login connection. LinkedIn: forms owned by the ad account&#39;s Company Page. Pass &#x60;adAccountId&#x60; (LinkedIn forms are org-owned). Requires the Ads add-on.
404
+ # @param account_id [String] Connected Facebook, Meta ads business-login or LinkedIn ads account ID.
405
405
  # @param [Hash] opts the optional parameters
406
406
  # @option opts [String] :ad_account_id LinkedIn only: the LinkedIn ad account id (used to resolve the owning organization). Required for LinkedIn.
407
407
  # @option opts [Integer] :limit (default to 25)
@@ -42,13 +42,13 @@ module Zernio
42
42
  # Last time follower count was updated (only included if user has analytics add-on)
43
43
  attr_accessor :followers_last_updated
44
44
 
45
- # Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts.
45
+ # Reference to the parent posting SocialAccount. Set for ads accounts that share or derive from a posting account's OAuth token. null for standalone ads (Google Ads) and all posting accounts. Meta ads business-login accounts also have no parent.
46
46
  attr_accessor :parent_account_id
47
47
 
48
48
  # Whether the user explicitly activated this account. false means the account was created as a side effect (e.g., posting account auto-created when user connected ads first). Such accounts are hidden from this list, cannot be posted to (`ACCOUNT_NOT_ENABLED_FOR_POSTING`), and are not billed as connected accounts.
49
49
  attr_accessor :enabled
50
50
 
51
- # Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
51
+ # Platform-specific metadata. Fields vary by platform. For WhatsApp accounts, includes: - qualityRating: Phone number quality rating from Meta (GREEN, YELLOW, RED, or UNKNOWN) - nameStatus: Display name review status (APPROVED, PENDING_REVIEW, DECLINED, or NONE). A declined or pending display name does not by itself block sending; sendability is reported separately via health_status (can_send_message). - messagingLimitTier: Maximum unique business-initiated conversations per 24h rolling window (TIER_250, TIER_1K, TIER_10K, TIER_100K, or TIER_UNLIMITED). Scales automatically as quality rating improves. - verifiedName: Meta-verified business display name - displayPhoneNumber: Formatted phone number (e.g., \"+1 555-123-4567\") - wabaId: WhatsApp Business Account ID - phoneNumberId: Meta phone number ID For Meta ads business-login accounts: - tokenType: system-user - businessId: The owning Business Manager ID when there is one owner; null for multiple owners. - businessIds: Owning Business Manager IDs discovered from granted ad accounts. - grantedAdAccountIds: Ad-account IDs granted to the token. - adAccountBusinesses: Map from ad-account ID to its owning business ID or null. - availablePages: Granted Page IDs and names. No Page tokens are exposed. - selectedPageId: The Page selected for creatives and lead forms, or null. - scopedAdAccountIds: Existing sync scope preserved on reconnect. Non-expiring tokens have no tokenExpiresAt field. Parent posting reconnects do not replace this token. For LinkedIn accounts, profileData carries the profile details refreshed on each daily snapshot: - profileData.bio: The member's headline for personal accounts, or the organization description for organization accounts. null when the member has not set one. - profileData.extraData.vanityName: The member's profile slug, i.e. the /in/{vanityName} segment of profileUrl. Personal accounts only; an organization's own slug is in metadata.organizationInfo.vanityName.
52
52
  attr_accessor :metadata
53
53
 
54
54
  # Current follower count
@@ -16,6 +16,12 @@ require 'time'
16
16
  module Zernio
17
17
  # Platform-specific creative data. Fields vary by platform.
18
18
  class AdCreative < ApiModelBase
19
+ # Initial Performance Max asset group input. Use the asset-groups endpoint for current Google assets.
20
+ attr_accessor :asset_group
21
+
22
+ # Google resource name of the created Performance Max asset group.
23
+ attr_accessor :asset_group_resource_name
24
+
19
25
  # Google RSA only. Replaces the complete headline list. No padding or truncation on update.
20
26
  attr_accessor :headlines
21
27
 
@@ -121,6 +127,8 @@ module Zernio
121
127
  # Attribute mapping from ruby-style variable name to JSON key.
122
128
  def self.attribute_map
123
129
  {
130
+ :'asset_group' => :'assetGroup',
131
+ :'asset_group_resource_name' => :'assetGroupResourceName',
124
132
  :'headlines' => :'headlines',
125
133
  :'descriptions' => :'descriptions',
126
134
  :'final_urls' => :'finalUrls',
@@ -165,6 +173,8 @@ module Zernio
165
173
  # Attribute type mapping.
166
174
  def self.openapi_types
167
175
  {
176
+ :'asset_group' => :'GooglePmaxAssetGroupInput',
177
+ :'asset_group_resource_name' => :'String',
168
178
  :'headlines' => :'Array<GoogleRsaHeadline>',
169
179
  :'descriptions' => :'Array<GoogleRsaDescription>',
170
180
  :'final_urls' => :'Array<String>',
@@ -229,6 +239,14 @@ module Zernio
229
239
  h[k.to_sym] = v
230
240
  }
231
241
 
242
+ if attributes.key?(:'asset_group')
243
+ self.asset_group = attributes[:'asset_group']
244
+ end
245
+
246
+ if attributes.key?(:'asset_group_resource_name')
247
+ self.asset_group_resource_name = attributes[:'asset_group_resource_name']
248
+ end
249
+
232
250
  if attributes.key?(:'headlines')
233
251
  if (value = attributes[:'headlines']).is_a?(Array)
234
252
  self.headlines = value
@@ -447,6 +465,8 @@ module Zernio
447
465
  def ==(o)
448
466
  return true if self.equal?(o)
449
467
  self.class == o.class &&
468
+ asset_group == o.asset_group &&
469
+ asset_group_resource_name == o.asset_group_resource_name &&
450
470
  headlines == o.headlines &&
451
471
  descriptions == o.descriptions &&
452
472
  final_urls == o.final_urls &&
@@ -486,7 +506,7 @@ module Zernio
486
506
  # Calculates hash code according to all attributes.
487
507
  # @return [Integer] Hash code
488
508
  def hash
489
- [headlines, descriptions, final_urls, thumbnail_url, image_url, video_id, video_url, promotion, promotion_status, creative_id, object_type, object_story_id, effective_object_story_id, page_id, effective_instagram_media_id, instagram_user_id, instagram_permalink_url, media_urls, is_serving, serving_hold_reasons, body, google_headline, google_description, link_url, whatsapp_phone_number, pinterest_image_url, pinterest_title, pinterest_description].hash
509
+ [asset_group, asset_group_resource_name, headlines, descriptions, final_urls, thumbnail_url, image_url, video_id, video_url, promotion, promotion_status, creative_id, object_type, object_story_id, effective_object_story_id, page_id, effective_instagram_media_id, instagram_user_id, instagram_permalink_url, media_urls, is_serving, serving_hold_reasons, body, google_headline, google_description, link_url, whatsapp_phone_number, pinterest_image_url, pinterest_title, pinterest_description].hash
490
510
  end
491
511
 
492
512
  # Builds the object from hash
@@ -26,9 +26,34 @@ module Zernio
26
26
 
27
27
  attr_accessor :display_name
28
28
 
29
+ # Present for an existing business-login connection.
30
+ attr_accessor :token_type
31
+
29
32
  # Echo of the persisted ad-account scope when the caller passed `adAccountId` / `adAccountIds`. Omitted when no scope is set.
30
33
  attr_accessor :scoped_ad_account_ids
31
34
 
35
+ class EnumAttributeValidator
36
+ attr_reader :datatype
37
+ attr_reader :allowable_values
38
+
39
+ def initialize(datatype, allowable_values)
40
+ @allowable_values = allowable_values.map do |value|
41
+ case datatype.to_s
42
+ when /Integer/i
43
+ value.to_i
44
+ when /Float/i
45
+ value.to_f
46
+ else
47
+ value
48
+ end
49
+ end
50
+ end
51
+
52
+ def valid?(value)
53
+ !value || allowable_values.include?(value)
54
+ end
55
+ end
56
+
32
57
  # Attribute mapping from ruby-style variable name to JSON key.
33
58
  def self.attribute_map
34
59
  {
@@ -37,6 +62,7 @@ module Zernio
37
62
  :'platform' => :'platform',
38
63
  :'username' => :'username',
39
64
  :'display_name' => :'displayName',
65
+ :'token_type' => :'tokenType',
40
66
  :'scoped_ad_account_ids' => :'scopedAdAccountIds'
41
67
  }
42
68
  end
@@ -59,6 +85,7 @@ module Zernio
59
85
  :'platform' => :'String',
60
86
  :'username' => :'String',
61
87
  :'display_name' => :'String',
88
+ :'token_type' => :'String',
62
89
  :'scoped_ad_account_ids' => :'Array<String>'
63
90
  }
64
91
  end
@@ -105,6 +132,10 @@ module Zernio
105
132
  self.display_name = attributes[:'display_name']
106
133
  end
107
134
 
135
+ if attributes.key?(:'token_type')
136
+ self.token_type = attributes[:'token_type']
137
+ end
138
+
108
139
  if attributes.key?(:'scoped_ad_account_ids')
109
140
  if (value = attributes[:'scoped_ad_account_ids']).is_a?(Array)
110
141
  self.scoped_ad_account_ids = value
@@ -124,9 +155,21 @@ module Zernio
124
155
  # @return true if the model is valid
125
156
  def valid?
126
157
  warn '[DEPRECATED] the `valid?` method is obsolete'
158
+ token_type_validator = EnumAttributeValidator.new('String', ["system-user"])
159
+ return false unless token_type_validator.valid?(@token_type)
127
160
  true
128
161
  end
129
162
 
163
+ # Custom attribute writer method checking allowed values (enum).
164
+ # @param [Object] token_type Object to be assigned
165
+ def token_type=(token_type)
166
+ validator = EnumAttributeValidator.new('String', ["system-user"])
167
+ unless validator.valid?(token_type)
168
+ fail ArgumentError, "invalid value for \"token_type\", must be one of #{validator.allowable_values}."
169
+ end
170
+ @token_type = token_type
171
+ end
172
+
130
173
  # Checks equality by comparing each attribute.
131
174
  # @param [Object] Object to be compared
132
175
  def ==(o)
@@ -137,6 +180,7 @@ module Zernio
137
180
  platform == o.platform &&
138
181
  username == o.username &&
139
182
  display_name == o.display_name &&
183
+ token_type == o.token_type &&
140
184
  scoped_ad_account_ids == o.scoped_ad_account_ids
141
185
  end
142
186
 
@@ -149,7 +193,7 @@ module Zernio
149
193
  # Calculates hash code according to all attributes.
150
194
  # @return [Integer] Hash code
151
195
  def hash
152
- [already_connected, account_id, platform, username, display_name, scoped_ad_account_ids].hash
196
+ [already_connected, account_id, platform, username, display_name, token_type, scoped_ad_account_ids].hash
153
197
  end
154
198
 
155
199
  # Builds the object from hash