pinterest_sdk 1.0.0

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 (488) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +70 -0
  4. data/README.md +319 -0
  5. data/Rakefile +10 -0
  6. data/bin/bundle +114 -0
  7. data/bin/byebug +27 -0
  8. data/bin/coderay +27 -0
  9. data/bin/htmldiff +27 -0
  10. data/bin/ldiff +27 -0
  11. data/bin/pry +27 -0
  12. data/bin/rake +27 -0
  13. data/bin/rspec +27 -0
  14. data/bin/rubocop +27 -0
  15. data/bin/ruby-parse +27 -0
  16. data/bin/ruby-rewrite +27 -0
  17. data/docs/Account.md +24 -0
  18. data/docs/ActionType.md +15 -0
  19. data/docs/AdAccount.md +26 -0
  20. data/docs/AdAccountOwner.md +18 -0
  21. data/docs/AdAccountsApi.md +929 -0
  22. data/docs/AdGroupResponse.md +62 -0
  23. data/docs/AdGroupResponseAllOf.md +48 -0
  24. data/docs/AdGroupResponseAllOf1.md +30 -0
  25. data/docs/AdGroupSummaryStatus.md +15 -0
  26. data/docs/AdResponse.md +70 -0
  27. data/docs/AdResponseAllOf.md +48 -0
  28. data/docs/AdResponseAllOf1.md +38 -0
  29. data/docs/AdsAnalyticsCreateAsyncRequest.md +62 -0
  30. data/docs/AdsAnalyticsCreateAsyncRequestAllOf.md +32 -0
  31. data/docs/AdsAnalyticsCreateAsyncRequestAllOf1.md +22 -0
  32. data/docs/AdsAnalyticsCreateAsyncResponse.md +22 -0
  33. data/docs/AdsAnalyticsFilterColumn.md +15 -0
  34. data/docs/AdsAnalyticsFilterOperator.md +15 -0
  35. data/docs/AdsAnalyticsGetAsyncResponse.md +22 -0
  36. data/docs/AdsAnalyticsMetricsFilter.md +22 -0
  37. data/docs/AdsAnalyticsTargetingType.md +15 -0
  38. data/docs/AnalyticsMetricsResponse.md +20 -0
  39. data/docs/AnalyticsMetricsResponseDailyMetrics.md +22 -0
  40. data/docs/AvailabilityFilter.md +18 -0
  41. data/docs/BatchOperation.md +15 -0
  42. data/docs/BatchOperationStatus.md +15 -0
  43. data/docs/Board.md +26 -0
  44. data/docs/BoardOwner.md +18 -0
  45. data/docs/BoardSection.md +20 -0
  46. data/docs/BoardUpdate.md +22 -0
  47. data/docs/BoardsApi.md +811 -0
  48. data/docs/BrandFilter.md +18 -0
  49. data/docs/CampaignCommon.md +34 -0
  50. data/docs/CampaignResponse.md +44 -0
  51. data/docs/CampaignResponseAllOf.md +18 -0
  52. data/docs/CampaignResponseAllOf1.md +24 -0
  53. data/docs/CampaignSummaryStatus.md +15 -0
  54. data/docs/CatalogsApi.md +939 -0
  55. data/docs/CatalogsDbItem.md +22 -0
  56. data/docs/CatalogsFeed.md +42 -0
  57. data/docs/CatalogsFeedCredentials.md +20 -0
  58. data/docs/CatalogsFeedIngestionDetails.md +20 -0
  59. data/docs/CatalogsFeedIngestionErrors.md +26 -0
  60. data/docs/CatalogsFeedIngestionInfo.md +22 -0
  61. data/docs/CatalogsFeedProcessingResult.md +30 -0
  62. data/docs/CatalogsFeedProcessingResultFields.md +24 -0
  63. data/docs/CatalogsFeedProcessingSchedule.md +20 -0
  64. data/docs/CatalogsFeedProcessingStatus.md +15 -0
  65. data/docs/CatalogsFeedProductCounts.md +18 -0
  66. data/docs/CatalogsFeedValidationDetails.md +20 -0
  67. data/docs/CatalogsFeedValidationErrors.md +84 -0
  68. data/docs/CatalogsFeedValidationWarnings.md +106 -0
  69. data/docs/CatalogsFeedsCreateRequest.md +34 -0
  70. data/docs/CatalogsFeedsUpdateRequest.md +32 -0
  71. data/docs/CatalogsFormat.md +15 -0
  72. data/docs/CatalogsItems.md +18 -0
  73. data/docs/CatalogsItemsBatch.md +26 -0
  74. data/docs/CatalogsItemsBatchRequest.md +24 -0
  75. data/docs/CatalogsProductGroup.md +34 -0
  76. data/docs/CatalogsProductGroupCreateRequest.md +24 -0
  77. data/docs/CatalogsProductGroupCurrencyCriteria.md +20 -0
  78. data/docs/CatalogsProductGroupFilterKeys.md +68 -0
  79. data/docs/CatalogsProductGroupFilters.md +20 -0
  80. data/docs/CatalogsProductGroupFiltersAllOf.md +18 -0
  81. data/docs/CatalogsProductGroupFiltersAnyOf.md +18 -0
  82. data/docs/CatalogsProductGroupMultipleStringCriteria.md +20 -0
  83. data/docs/CatalogsProductGroupMultipleStringListCriteria.md +20 -0
  84. data/docs/CatalogsProductGroupPricingCriteria.md +22 -0
  85. data/docs/CatalogsProductGroupStatus.md +15 -0
  86. data/docs/CatalogsProductGroupType.md +15 -0
  87. data/docs/CatalogsProductGroupUpdateRequest.md +24 -0
  88. data/docs/CatalogsStatus.md +15 -0
  89. data/docs/ConditionFilter.md +18 -0
  90. data/docs/ConversionAttributionWindowDays.md +15 -0
  91. data/docs/ConversionReportAttributionType.md +15 -0
  92. data/docs/ConversionReportTimeType.md +15 -0
  93. data/docs/Country.md +15 -0
  94. data/docs/Currency.md +15 -0
  95. data/docs/CurrencyFilter.md +18 -0
  96. data/docs/CustomLabel0Filter.md +18 -0
  97. data/docs/CustomLabel1Filter.md +18 -0
  98. data/docs/CustomLabel2Filter.md +18 -0
  99. data/docs/CustomLabel3Filter.md +18 -0
  100. data/docs/CustomLabel4Filter.md +18 -0
  101. data/docs/DataOutputFormat.md +15 -0
  102. data/docs/EntityStatus.md +15 -0
  103. data/docs/Error.md +20 -0
  104. data/docs/FeedFields.md +36 -0
  105. data/docs/GenderFilter.md +18 -0
  106. data/docs/GoogleProductCategory0Filter.md +18 -0
  107. data/docs/GoogleProductCategory1Filter.md +18 -0
  108. data/docs/GoogleProductCategory2Filter.md +18 -0
  109. data/docs/GoogleProductCategory3Filter.md +18 -0
  110. data/docs/GoogleProductCategory4Filter.md +18 -0
  111. data/docs/GoogleProductCategory5Filter.md +18 -0
  112. data/docs/GoogleProductCategory6Filter.md +18 -0
  113. data/docs/Granularity.md +15 -0
  114. data/docs/ImageDetails.md +22 -0
  115. data/docs/ItemAttributes.md +104 -0
  116. data/docs/ItemBatchRecord.md +20 -0
  117. data/docs/ItemGroupIdFilter.md +18 -0
  118. data/docs/ItemIdFilter.md +18 -0
  119. data/docs/ItemProcessingRecord.md +24 -0
  120. data/docs/ItemProcessingStatus.md +15 -0
  121. data/docs/ItemValidationEvent.md +22 -0
  122. data/docs/Language.md +15 -0
  123. data/docs/MaxPriceFilter.md +18 -0
  124. data/docs/MediaApi.md +221 -0
  125. data/docs/MediaUpload.md +24 -0
  126. data/docs/MediaUploadAllOf.md +24 -0
  127. data/docs/MediaUploadAllOfUploadParameters.md +32 -0
  128. data/docs/MediaUploadDetails.md +22 -0
  129. data/docs/MediaUploadRequest.md +18 -0
  130. data/docs/MediaUploadStatus.md +15 -0
  131. data/docs/MediaUploadType.md +15 -0
  132. data/docs/MetricsReportingLevel.md +15 -0
  133. data/docs/MinPriceFilter.md +18 -0
  134. data/docs/NonNullableCatalogsCurrency.md +15 -0
  135. data/docs/NullableCurrency.md +15 -0
  136. data/docs/OauthAccessTokenRequest.md +18 -0
  137. data/docs/OauthAccessTokenRequestCode.md +20 -0
  138. data/docs/OauthAccessTokenRequestCodeAllOf.md +20 -0
  139. data/docs/OauthAccessTokenRequestRefresh.md +20 -0
  140. data/docs/OauthAccessTokenRequestRefreshAllOf.md +20 -0
  141. data/docs/OauthAccessTokenResponse.md +26 -0
  142. data/docs/OauthAccessTokenResponseCode.md +20 -0
  143. data/docs/OauthAccessTokenResponseCodeAllOf.md +20 -0
  144. data/docs/OauthAccessTokenResponseRefresh.md +15 -0
  145. data/docs/OauthApi.md +72 -0
  146. data/docs/ObjectiveType.md +15 -0
  147. data/docs/PacingDeliveryType.md +15 -0
  148. data/docs/Paginated.md +20 -0
  149. data/docs/Pin.md +38 -0
  150. data/docs/PinMedia.md +18 -0
  151. data/docs/PinMediaSource.md +81 -0
  152. data/docs/PinMediaSourceImageBase64.md +22 -0
  153. data/docs/PinMediaSourceImageURL.md +20 -0
  154. data/docs/PinMediaSourceVideoID.md +22 -0
  155. data/docs/PinMediaWithImage.md +18 -0
  156. data/docs/PinMediaWithImageAllOf.md +18 -0
  157. data/docs/PinPromotionSummaryStatus.md +15 -0
  158. data/docs/PinsApi.md +304 -0
  159. data/docs/PlacementGroupType.md +15 -0
  160. data/docs/ProductAvailabilityType.md +15 -0
  161. data/docs/ProductGroupSummaryStatus.md +15 -0
  162. data/docs/ProductType0Filter.md +18 -0
  163. data/docs/ProductType1Filter.md +18 -0
  164. data/docs/ProductType2Filter.md +18 -0
  165. data/docs/ProductType3Filter.md +18 -0
  166. data/docs/ProductType4Filter.md +18 -0
  167. data/docs/ReportingColumnAsync.md +15 -0
  168. data/docs/TargetingTypeFilter.md +18 -0
  169. data/docs/TrackingUrls.md +26 -0
  170. data/docs/UserAccountApi.md +165 -0
  171. data/git_push.sh +57 -0
  172. data/lib/pinterest_sdk/api/ad_accounts_api.rb +1287 -0
  173. data/lib/pinterest_sdk/api/boards_api.rb +888 -0
  174. data/lib/pinterest_sdk/api/catalogs_api.rb +965 -0
  175. data/lib/pinterest_sdk/api/media_api.rb +229 -0
  176. data/lib/pinterest_sdk/api/oauth_api.rb +96 -0
  177. data/lib/pinterest_sdk/api/pins_api.rb +330 -0
  178. data/lib/pinterest_sdk/api/user_account_api.rb +201 -0
  179. data/lib/pinterest_sdk/api_client.rb +390 -0
  180. data/lib/pinterest_sdk/api_error.rb +57 -0
  181. data/lib/pinterest_sdk/configuration.rb +285 -0
  182. data/lib/pinterest_sdk/models/account.rb +280 -0
  183. data/lib/pinterest_sdk/models/action_type.rb +39 -0
  184. data/lib/pinterest_sdk/models/ad_account.rb +254 -0
  185. data/lib/pinterest_sdk/models/ad_account_owner.rb +219 -0
  186. data/lib/pinterest_sdk/models/ad_group_response.rb +555 -0
  187. data/lib/pinterest_sdk/models/ad_group_response_all_of.rb +427 -0
  188. data/lib/pinterest_sdk/models/ad_group_response_all_of1.rb +329 -0
  189. data/lib/pinterest_sdk/models/ad_group_summary_status.rb +41 -0
  190. data/lib/pinterest_sdk/models/ad_response.rb +640 -0
  191. data/lib/pinterest_sdk/models/ad_response_all_of.rb +455 -0
  192. data/lib/pinterest_sdk/models/ad_response_all_of1.rb +409 -0
  193. data/lib/pinterest_sdk/models/ads_analytics_create_async_request.rb +831 -0
  194. data/lib/pinterest_sdk/models/ads_analytics_create_async_request_all_of.rb +356 -0
  195. data/lib/pinterest_sdk/models/ads_analytics_create_async_request_all_of1.rb +253 -0
  196. data/lib/pinterest_sdk/models/ads_analytics_create_async_response.rb +237 -0
  197. data/lib/pinterest_sdk/models/ads_analytics_filter_column.rb +37 -0
  198. data/lib/pinterest_sdk/models/ads_analytics_filter_operator.rb +37 -0
  199. data/lib/pinterest_sdk/models/ads_analytics_get_async_response.rb +238 -0
  200. data/lib/pinterest_sdk/models/ads_analytics_metrics_filter.rb +254 -0
  201. data/lib/pinterest_sdk/models/ads_analytics_targeting_type.rb +48 -0
  202. data/lib/pinterest_sdk/models/analytics_metrics_response.rb +233 -0
  203. data/lib/pinterest_sdk/models/analytics_metrics_response_daily_metrics.rb +275 -0
  204. data/lib/pinterest_sdk/models/availability_filter.rb +223 -0
  205. data/lib/pinterest_sdk/models/batch_operation.rb +38 -0
  206. data/lib/pinterest_sdk/models/batch_operation_status.rb +37 -0
  207. data/lib/pinterest_sdk/models/board.rb +301 -0
  208. data/lib/pinterest_sdk/models/board_owner.rb +218 -0
  209. data/lib/pinterest_sdk/models/board_section.rb +252 -0
  210. data/lib/pinterest_sdk/models/board_update.rb +272 -0
  211. data/lib/pinterest_sdk/models/brand_filter.rb +223 -0
  212. data/lib/pinterest_sdk/models/campaign_common.rb +352 -0
  213. data/lib/pinterest_sdk/models/campaign_response.rb +435 -0
  214. data/lib/pinterest_sdk/models/campaign_response_all_of.rb +245 -0
  215. data/lib/pinterest_sdk/models/campaign_response_all_of1.rb +248 -0
  216. data/lib/pinterest_sdk/models/campaign_summary_status.rb +41 -0
  217. data/lib/pinterest_sdk/models/catalogs_db_item.rb +236 -0
  218. data/lib/pinterest_sdk/models/catalogs_feed.rb +368 -0
  219. data/lib/pinterest_sdk/models/catalogs_feed_credentials.rb +240 -0
  220. data/lib/pinterest_sdk/models/catalogs_feed_ingestion_details.rb +237 -0
  221. data/lib/pinterest_sdk/models/catalogs_feed_ingestion_errors.rb +288 -0
  222. data/lib/pinterest_sdk/models/catalogs_feed_ingestion_info.rb +236 -0
  223. data/lib/pinterest_sdk/models/catalogs_feed_processing_result.rb +296 -0
  224. data/lib/pinterest_sdk/models/catalogs_feed_processing_result_fields.rb +261 -0
  225. data/lib/pinterest_sdk/models/catalogs_feed_processing_schedule.rb +291 -0
  226. data/lib/pinterest_sdk/models/catalogs_feed_processing_status.rb +43 -0
  227. data/lib/pinterest_sdk/models/catalogs_feed_product_counts.rb +220 -0
  228. data/lib/pinterest_sdk/models/catalogs_feed_validation_details.rb +237 -0
  229. data/lib/pinterest_sdk/models/catalogs_feed_validation_errors.rb +515 -0
  230. data/lib/pinterest_sdk/models/catalogs_feed_validation_warnings.rb +614 -0
  231. data/lib/pinterest_sdk/models/catalogs_feeds_create_request.rb +313 -0
  232. data/lib/pinterest_sdk/models/catalogs_feeds_update_request.rb +288 -0
  233. data/lib/pinterest_sdk/models/catalogs_format.rb +38 -0
  234. data/lib/pinterest_sdk/models/catalogs_items.rb +222 -0
  235. data/lib/pinterest_sdk/models/catalogs_items_batch.rb +262 -0
  236. data/lib/pinterest_sdk/models/catalogs_items_batch_request.rb +249 -0
  237. data/lib/pinterest_sdk/models/catalogs_product_group.rb +345 -0
  238. data/lib/pinterest_sdk/models/catalogs_product_group_create_request.rb +284 -0
  239. data/lib/pinterest_sdk/models/catalogs_product_group_currency_criteria.rb +237 -0
  240. data/lib/pinterest_sdk/models/catalogs_product_group_filter_keys.rb +617 -0
  241. data/lib/pinterest_sdk/models/catalogs_product_group_filters.rb +252 -0
  242. data/lib/pinterest_sdk/models/catalogs_product_group_filters_all_of.rb +220 -0
  243. data/lib/pinterest_sdk/models/catalogs_product_group_filters_any_of.rb +220 -0
  244. data/lib/pinterest_sdk/models/catalogs_product_group_multiple_string_criteria.rb +239 -0
  245. data/lib/pinterest_sdk/models/catalogs_product_group_multiple_string_list_criteria.rb +239 -0
  246. data/lib/pinterest_sdk/models/catalogs_product_group_pricing_criteria.rb +251 -0
  247. data/lib/pinterest_sdk/models/catalogs_product_group_status.rb +37 -0
  248. data/lib/pinterest_sdk/models/catalogs_product_group_type.rb +42 -0
  249. data/lib/pinterest_sdk/models/catalogs_product_group_update_request.rb +284 -0
  250. data/lib/pinterest_sdk/models/catalogs_status.rb +37 -0
  251. data/lib/pinterest_sdk/models/condition_filter.rb +223 -0
  252. data/lib/pinterest_sdk/models/conversion_attribution_window_days.rb +39 -0
  253. data/lib/pinterest_sdk/models/conversion_report_attribution_type.rb +37 -0
  254. data/lib/pinterest_sdk/models/conversion_report_time_type.rb +37 -0
  255. data/lib/pinterest_sdk/models/country.rb +282 -0
  256. data/lib/pinterest_sdk/models/currency.rb +60 -0
  257. data/lib/pinterest_sdk/models/currency_filter.rb +223 -0
  258. data/lib/pinterest_sdk/models/custom_label0_filter.rb +223 -0
  259. data/lib/pinterest_sdk/models/custom_label1_filter.rb +223 -0
  260. data/lib/pinterest_sdk/models/custom_label2_filter.rb +223 -0
  261. data/lib/pinterest_sdk/models/custom_label3_filter.rb +223 -0
  262. data/lib/pinterest_sdk/models/custom_label4_filter.rb +223 -0
  263. data/lib/pinterest_sdk/models/data_output_format.rb +37 -0
  264. data/lib/pinterest_sdk/models/entity_status.rb +38 -0
  265. data/lib/pinterest_sdk/models/error.rb +237 -0
  266. data/lib/pinterest_sdk/models/feed_fields.rb +332 -0
  267. data/lib/pinterest_sdk/models/gender_filter.rb +223 -0
  268. data/lib/pinterest_sdk/models/google_product_category0_filter.rb +223 -0
  269. data/lib/pinterest_sdk/models/google_product_category1_filter.rb +223 -0
  270. data/lib/pinterest_sdk/models/google_product_category2_filter.rb +223 -0
  271. data/lib/pinterest_sdk/models/google_product_category3_filter.rb +223 -0
  272. data/lib/pinterest_sdk/models/google_product_category4_filter.rb +223 -0
  273. data/lib/pinterest_sdk/models/google_product_category5_filter.rb +223 -0
  274. data/lib/pinterest_sdk/models/google_product_category6_filter.rb +223 -0
  275. data/lib/pinterest_sdk/models/granularity.rb +40 -0
  276. data/lib/pinterest_sdk/models/image_details.rb +281 -0
  277. data/lib/pinterest_sdk/models/item_attributes.rb +833 -0
  278. data/lib/pinterest_sdk/models/item_batch_record.rb +229 -0
  279. data/lib/pinterest_sdk/models/item_group_id_filter.rb +223 -0
  280. data/lib/pinterest_sdk/models/item_id_filter.rb +223 -0
  281. data/lib/pinterest_sdk/models/item_processing_record.rb +253 -0
  282. data/lib/pinterest_sdk/models/item_processing_status.rb +38 -0
  283. data/lib/pinterest_sdk/models/item_validation_event.rb +240 -0
  284. data/lib/pinterest_sdk/models/language.rb +96 -0
  285. data/lib/pinterest_sdk/models/max_price_filter.rb +223 -0
  286. data/lib/pinterest_sdk/models/media_upload.rb +255 -0
  287. data/lib/pinterest_sdk/models/media_upload_all_of.rb +247 -0
  288. data/lib/pinterest_sdk/models/media_upload_all_of_upload_parameters.rb +282 -0
  289. data/lib/pinterest_sdk/models/media_upload_details.rb +254 -0
  290. data/lib/pinterest_sdk/models/media_upload_request.rb +224 -0
  291. data/lib/pinterest_sdk/models/media_upload_status.rb +39 -0
  292. data/lib/pinterest_sdk/models/media_upload_type.rb +36 -0
  293. data/lib/pinterest_sdk/models/metrics_reporting_level.rb +47 -0
  294. data/lib/pinterest_sdk/models/min_price_filter.rb +223 -0
  295. data/lib/pinterest_sdk/models/non_nullable_catalogs_currency.rb +198 -0
  296. data/lib/pinterest_sdk/models/nullable_currency.rb +199 -0
  297. data/lib/pinterest_sdk/models/oauth_access_token_request_code.rb +272 -0
  298. data/lib/pinterest_sdk/models/oauth_access_token_request_code_all_of.rb +237 -0
  299. data/lib/pinterest_sdk/models/oauth_access_token_request_refresh.rb +267 -0
  300. data/lib/pinterest_sdk/models/oauth_access_token_request_refresh_all_of.rb +232 -0
  301. data/lib/pinterest_sdk/models/oauth_access_token_response.rb +316 -0
  302. data/lib/pinterest_sdk/models/oauth_access_token_response_code.rb +272 -0
  303. data/lib/pinterest_sdk/models/oauth_access_token_response_code_all_of.rb +237 -0
  304. data/lib/pinterest_sdk/models/oauth_access_token_response_refresh.rb +243 -0
  305. data/lib/pinterest_sdk/models/objective_type.rb +43 -0
  306. data/lib/pinterest_sdk/models/pacing_delivery_type.rb +37 -0
  307. data/lib/pinterest_sdk/models/paginated.rb +235 -0
  308. data/lib/pinterest_sdk/models/pin.rb +359 -0
  309. data/lib/pinterest_sdk/models/pin_media.rb +224 -0
  310. data/lib/pinterest_sdk/models/pin_media_source.rb +58 -0
  311. data/lib/pinterest_sdk/models/pin_media_source_image_base64.rb +319 -0
  312. data/lib/pinterest_sdk/models/pin_media_source_image_url.rb +272 -0
  313. data/lib/pinterest_sdk/models/pin_media_source_video_id.rb +307 -0
  314. data/lib/pinterest_sdk/models/pin_media_with_image.rb +233 -0
  315. data/lib/pinterest_sdk/models/pin_media_with_image_all_of.rb +220 -0
  316. data/lib/pinterest_sdk/models/pin_promotion_summary_status.rb +41 -0
  317. data/lib/pinterest_sdk/models/placement_group_type.rb +39 -0
  318. data/lib/pinterest_sdk/models/product_availability_type.rb +39 -0
  319. data/lib/pinterest_sdk/models/product_group_summary_status.rb +39 -0
  320. data/lib/pinterest_sdk/models/product_type0_filter.rb +223 -0
  321. data/lib/pinterest_sdk/models/product_type1_filter.rb +223 -0
  322. data/lib/pinterest_sdk/models/product_type2_filter.rb +223 -0
  323. data/lib/pinterest_sdk/models/product_type3_filter.rb +223 -0
  324. data/lib/pinterest_sdk/models/product_type4_filter.rb +223 -0
  325. data/lib/pinterest_sdk/models/reporting_column_async.rb +549 -0
  326. data/lib/pinterest_sdk/models/targeting_type_filter.rb +245 -0
  327. data/lib/pinterest_sdk/models/tracking_urls.rb +340 -0
  328. data/lib/pinterest_sdk/version.rb +15 -0
  329. data/lib/pinterest_sdk.rb +192 -0
  330. data/pinterest_sdk.gemspec +38 -0
  331. data/spec/api/ad_accounts_api_spec.rb +234 -0
  332. data/spec/api/boards_api_spec.rb +181 -0
  333. data/spec/api/catalogs_api_spec.rb +200 -0
  334. data/spec/api/media_api_spec.rb +72 -0
  335. data/spec/api/oauth_api_spec.rb +47 -0
  336. data/spec/api/pins_api_spec.rb +90 -0
  337. data/spec/api/user_account_api_spec.rb +66 -0
  338. data/spec/api_client_spec.rb +226 -0
  339. data/spec/configuration_spec.rb +42 -0
  340. data/spec/models/account_spec.rb +56 -0
  341. data/spec/models/action_type_spec.rb +28 -0
  342. data/spec/models/ad_account_owner_spec.rb +34 -0
  343. data/spec/models/ad_account_spec.rb +58 -0
  344. data/spec/models/ad_group_response_all_of1_spec.rb +70 -0
  345. data/spec/models/ad_group_response_all_of_spec.rb +132 -0
  346. data/spec/models/ad_group_response_spec.rb +174 -0
  347. data/spec/models/ad_group_summary_status_spec.rb +28 -0
  348. data/spec/models/ad_response_all_of1_spec.rb +102 -0
  349. data/spec/models/ad_response_all_of_spec.rb +128 -0
  350. data/spec/models/ad_response_spec.rb +202 -0
  351. data/spec/models/ads_analytics_create_async_request_all_of1_spec.rb +46 -0
  352. data/spec/models/ads_analytics_create_async_request_all_of_spec.rb +76 -0
  353. data/spec/models/ads_analytics_create_async_request_spec.rb +166 -0
  354. data/spec/models/ads_analytics_create_async_response_spec.rb +46 -0
  355. data/spec/models/ads_analytics_filter_column_spec.rb +28 -0
  356. data/spec/models/ads_analytics_filter_operator_spec.rb +28 -0
  357. data/spec/models/ads_analytics_get_async_response_spec.rb +46 -0
  358. data/spec/models/ads_analytics_metrics_filter_spec.rb +46 -0
  359. data/spec/models/ads_analytics_targeting_type_spec.rb +28 -0
  360. data/spec/models/analytics_metrics_response_daily_metrics_spec.rb +50 -0
  361. data/spec/models/analytics_metrics_response_spec.rb +40 -0
  362. data/spec/models/availability_filter_spec.rb +34 -0
  363. data/spec/models/batch_operation_spec.rb +28 -0
  364. data/spec/models/batch_operation_status_spec.rb +28 -0
  365. data/spec/models/board_owner_spec.rb +34 -0
  366. data/spec/models/board_section_spec.rb +40 -0
  367. data/spec/models/board_spec.rb +62 -0
  368. data/spec/models/board_update_spec.rb +50 -0
  369. data/spec/models/brand_filter_spec.rb +34 -0
  370. data/spec/models/campaign_common_spec.rb +82 -0
  371. data/spec/models/campaign_response_all_of1_spec.rb +52 -0
  372. data/spec/models/campaign_response_all_of_spec.rb +34 -0
  373. data/spec/models/campaign_response_spec.rb +112 -0
  374. data/spec/models/campaign_summary_status_spec.rb +28 -0
  375. data/spec/models/catalogs_db_item_spec.rb +46 -0
  376. data/spec/models/catalogs_feed_credentials_spec.rb +40 -0
  377. data/spec/models/catalogs_feed_ingestion_details_spec.rb +40 -0
  378. data/spec/models/catalogs_feed_ingestion_errors_spec.rb +62 -0
  379. data/spec/models/catalogs_feed_ingestion_info_spec.rb +46 -0
  380. data/spec/models/catalogs_feed_processing_result_fields_spec.rb +52 -0
  381. data/spec/models/catalogs_feed_processing_result_spec.rb +70 -0
  382. data/spec/models/catalogs_feed_processing_schedule_spec.rb +44 -0
  383. data/spec/models/catalogs_feed_processing_status_spec.rb +28 -0
  384. data/spec/models/catalogs_feed_product_counts_spec.rb +34 -0
  385. data/spec/models/catalogs_feed_spec.rb +106 -0
  386. data/spec/models/catalogs_feed_validation_details_spec.rb +40 -0
  387. data/spec/models/catalogs_feed_validation_errors_spec.rb +232 -0
  388. data/spec/models/catalogs_feed_validation_warnings_spec.rb +298 -0
  389. data/spec/models/catalogs_feeds_create_request_spec.rb +82 -0
  390. data/spec/models/catalogs_feeds_update_request_spec.rb +76 -0
  391. data/spec/models/catalogs_format_spec.rb +28 -0
  392. data/spec/models/catalogs_items_batch_request_spec.rb +52 -0
  393. data/spec/models/catalogs_items_batch_spec.rb +58 -0
  394. data/spec/models/catalogs_items_spec.rb +34 -0
  395. data/spec/models/catalogs_product_group_create_request_spec.rb +52 -0
  396. data/spec/models/catalogs_product_group_currency_criteria_spec.rb +40 -0
  397. data/spec/models/catalogs_product_group_filter_keys_spec.rb +184 -0
  398. data/spec/models/catalogs_product_group_filters_all_of_spec.rb +34 -0
  399. data/spec/models/catalogs_product_group_filters_any_of_spec.rb +34 -0
  400. data/spec/models/catalogs_product_group_filters_spec.rb +40 -0
  401. data/spec/models/catalogs_product_group_multiple_string_criteria_spec.rb +40 -0
  402. data/spec/models/catalogs_product_group_multiple_string_list_criteria_spec.rb +40 -0
  403. data/spec/models/catalogs_product_group_pricing_criteria_spec.rb +46 -0
  404. data/spec/models/catalogs_product_group_spec.rb +82 -0
  405. data/spec/models/catalogs_product_group_status_spec.rb +28 -0
  406. data/spec/models/catalogs_product_group_type_spec.rb +28 -0
  407. data/spec/models/catalogs_product_group_update_request_spec.rb +52 -0
  408. data/spec/models/catalogs_status_spec.rb +28 -0
  409. data/spec/models/condition_filter_spec.rb +34 -0
  410. data/spec/models/conversion_attribution_window_days_spec.rb +28 -0
  411. data/spec/models/conversion_report_attribution_type_spec.rb +28 -0
  412. data/spec/models/conversion_report_time_type_spec.rb +28 -0
  413. data/spec/models/country_spec.rb +28 -0
  414. data/spec/models/currency_filter_spec.rb +34 -0
  415. data/spec/models/currency_spec.rb +28 -0
  416. data/spec/models/custom_label0_filter_spec.rb +34 -0
  417. data/spec/models/custom_label1_filter_spec.rb +34 -0
  418. data/spec/models/custom_label2_filter_spec.rb +34 -0
  419. data/spec/models/custom_label3_filter_spec.rb +34 -0
  420. data/spec/models/custom_label4_filter_spec.rb +34 -0
  421. data/spec/models/data_output_format_spec.rb +28 -0
  422. data/spec/models/entity_status_spec.rb +28 -0
  423. data/spec/models/error_spec.rb +40 -0
  424. data/spec/models/feed_fields_spec.rb +88 -0
  425. data/spec/models/gender_filter_spec.rb +34 -0
  426. data/spec/models/google_product_category0_filter_spec.rb +34 -0
  427. data/spec/models/google_product_category1_filter_spec.rb +34 -0
  428. data/spec/models/google_product_category2_filter_spec.rb +34 -0
  429. data/spec/models/google_product_category3_filter_spec.rb +34 -0
  430. data/spec/models/google_product_category4_filter_spec.rb +34 -0
  431. data/spec/models/google_product_category5_filter_spec.rb +34 -0
  432. data/spec/models/google_product_category6_filter_spec.rb +34 -0
  433. data/spec/models/granularity_spec.rb +28 -0
  434. data/spec/models/image_details_spec.rb +46 -0
  435. data/spec/models/item_attributes_spec.rb +292 -0
  436. data/spec/models/item_batch_record_spec.rb +40 -0
  437. data/spec/models/item_group_id_filter_spec.rb +34 -0
  438. data/spec/models/item_id_filter_spec.rb +34 -0
  439. data/spec/models/item_processing_record_spec.rb +52 -0
  440. data/spec/models/item_processing_status_spec.rb +28 -0
  441. data/spec/models/item_validation_event_spec.rb +46 -0
  442. data/spec/models/language_spec.rb +28 -0
  443. data/spec/models/max_price_filter_spec.rb +34 -0
  444. data/spec/models/media_upload_all_of_spec.rb +52 -0
  445. data/spec/models/media_upload_all_of_upload_parameters_spec.rb +76 -0
  446. data/spec/models/media_upload_details_spec.rb +46 -0
  447. data/spec/models/media_upload_request_spec.rb +34 -0
  448. data/spec/models/media_upload_spec.rb +52 -0
  449. data/spec/models/media_upload_status_spec.rb +28 -0
  450. data/spec/models/media_upload_type_spec.rb +28 -0
  451. data/spec/models/metrics_reporting_level_spec.rb +28 -0
  452. data/spec/models/min_price_filter_spec.rb +34 -0
  453. data/spec/models/non_nullable_catalogs_currency_spec.rb +28 -0
  454. data/spec/models/nullable_currency_spec.rb +28 -0
  455. data/spec/models/oauth_access_token_request_code_all_of_spec.rb +40 -0
  456. data/spec/models/oauth_access_token_request_code_spec.rb +40 -0
  457. data/spec/models/oauth_access_token_request_refresh_all_of_spec.rb +40 -0
  458. data/spec/models/oauth_access_token_request_refresh_spec.rb +40 -0
  459. data/spec/models/oauth_access_token_request_spec.rb +38 -0
  460. data/spec/models/oauth_access_token_response_code_all_of_spec.rb +40 -0
  461. data/spec/models/oauth_access_token_response_code_spec.rb +40 -0
  462. data/spec/models/oauth_access_token_response_refresh_spec.rb +28 -0
  463. data/spec/models/oauth_access_token_response_spec.rb +62 -0
  464. data/spec/models/objective_type_spec.rb +28 -0
  465. data/spec/models/pacing_delivery_type_spec.rb +28 -0
  466. data/spec/models/paginated_spec.rb +40 -0
  467. data/spec/models/pin_media_source_image_base64_spec.rb +54 -0
  468. data/spec/models/pin_media_source_image_url_spec.rb +44 -0
  469. data/spec/models/pin_media_source_spec.rb +43 -0
  470. data/spec/models/pin_media_source_video_id_spec.rb +50 -0
  471. data/spec/models/pin_media_spec.rb +34 -0
  472. data/spec/models/pin_media_with_image_all_of_spec.rb +34 -0
  473. data/spec/models/pin_media_with_image_spec.rb +34 -0
  474. data/spec/models/pin_promotion_summary_status_spec.rb +28 -0
  475. data/spec/models/pin_spec.rb +94 -0
  476. data/spec/models/placement_group_type_spec.rb +28 -0
  477. data/spec/models/product_availability_type_spec.rb +28 -0
  478. data/spec/models/product_group_summary_status_spec.rb +28 -0
  479. data/spec/models/product_type0_filter_spec.rb +34 -0
  480. data/spec/models/product_type1_filter_spec.rb +34 -0
  481. data/spec/models/product_type2_filter_spec.rb +34 -0
  482. data/spec/models/product_type3_filter_spec.rb +34 -0
  483. data/spec/models/product_type4_filter_spec.rb +34 -0
  484. data/spec/models/reporting_column_async_spec.rb +28 -0
  485. data/spec/models/targeting_type_filter_spec.rb +34 -0
  486. data/spec/models/tracking_urls_spec.rb +58 -0
  487. data/spec/spec_helper.rb +111 -0
  488. metadata +726 -0
@@ -0,0 +1,1287 @@
1
+ =begin
2
+ #Pinterest REST API
3
+
4
+ #Pinterest's REST API
5
+
6
+ The version of the OpenAPI document: 5.3.0
7
+ Contact: pinterest-api@pinterest.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.4.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module PinterestSdkClient
16
+ class AdAccountsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get ad account analytics
23
+ # Get analytics for the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
24
+ # @param ad_account_id [String] Unique identifier of an ad account.
25
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
26
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
27
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
28
+ # @param granularity [Granularity] Granularity
29
+ # @param [Hash] opts the optional parameters
30
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
31
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
32
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)
33
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')
34
+ # @return [Array<Hash<String, Object>>]
35
+ def ad_account_analytics(ad_account_id, start_date, end_date, columns, granularity, opts = {})
36
+ data, _status_code, _headers = ad_account_analytics_with_http_info(ad_account_id, start_date, end_date, columns, granularity, opts)
37
+ data
38
+ end
39
+
40
+ # Get ad account analytics
41
+ # Get analytics for the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
42
+ # @param ad_account_id [String] Unique identifier of an ad account.
43
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
44
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
45
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
46
+ # @param granularity [Granularity] Granularity
47
+ # @param [Hash] opts the optional parameters
48
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
49
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
50
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.
51
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.
52
+ # @return [Array<(Array<Hash<String, Object>>, Integer, Hash)>] Array<Hash<String, Object>> data, response status code and response headers
53
+ def ad_account_analytics_with_http_info(ad_account_id, start_date, end_date, columns, granularity, opts = {})
54
+ if @api_client.config.debugging
55
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_account_analytics ...'
56
+ end
57
+ # verify the required parameter 'ad_account_id' is set
58
+ if @api_client.config.client_side_validation && ad_account_id.nil?
59
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_account_analytics"
60
+ end
61
+ pattern = Regexp.new(/^\d+$/)
62
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
63
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_account_analytics, must conform to the pattern #{pattern}."
64
+ end
65
+
66
+ # verify the required parameter 'start_date' is set
67
+ if @api_client.config.client_side_validation && start_date.nil?
68
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ad_account_analytics"
69
+ end
70
+ # verify the required parameter 'end_date' is set
71
+ if @api_client.config.client_side_validation && end_date.nil?
72
+ fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ad_account_analytics"
73
+ end
74
+ # verify the required parameter 'columns' is set
75
+ if @api_client.config.client_side_validation && columns.nil?
76
+ fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ad_account_analytics"
77
+ end
78
+ # verify the required parameter 'granularity' is set
79
+ if @api_client.config.client_side_validation && granularity.nil?
80
+ fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ad_account_analytics"
81
+ end
82
+ allowable_values = [1, 7, 30, 60]
83
+ if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
84
+ fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
85
+ end
86
+ allowable_values = [1, 7, 30, 60]
87
+ if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
88
+ fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
89
+ end
90
+ allowable_values = [1, 7, 30, 60]
91
+ if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
92
+ fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
93
+ end
94
+ allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
95
+ if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
96
+ fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
97
+ end
98
+ # resource path
99
+ local_var_path = '/ad_accounts/{ad_account_id}/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
100
+
101
+ # query parameters
102
+ query_params = opts[:query_params] || {}
103
+ query_params[:'start_date'] = start_date
104
+ query_params[:'end_date'] = end_date
105
+ query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
106
+ query_params[:'granularity'] = granularity
107
+ query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
108
+ query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
109
+ query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
110
+ query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
111
+
112
+ # header parameters
113
+ header_params = opts[:header_params] || {}
114
+ # HTTP header 'Accept' (if needed)
115
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
116
+
117
+ # form parameters
118
+ form_params = opts[:form_params] || {}
119
+
120
+ # http body (model)
121
+ post_body = opts[:debug_body]
122
+
123
+ # return_type
124
+ return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'
125
+
126
+ # auth_names
127
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
128
+
129
+ new_options = opts.merge(
130
+ :operation => :"AdAccountsApi.ad_account_analytics",
131
+ :header_params => header_params,
132
+ :query_params => query_params,
133
+ :form_params => form_params,
134
+ :body => post_body,
135
+ :auth_names => auth_names,
136
+ :return_type => return_type
137
+ )
138
+
139
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
140
+ if @api_client.config.debugging
141
+ @api_client.config.logger.debug "API called: AdAccountsApi#ad_account_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
142
+ end
143
+ return data, status_code, headers
144
+ end
145
+
146
+ # List ad accounts
147
+ # Get a list of the ad_accounts that the \"operation user_account\" has access to. - This includes ad_accounts they own and ad_accounts that are owned by others who have granted them <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>.
148
+ # @param [Hash] opts the optional parameters
149
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
150
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)
151
+ # @option opts [Boolean] :include_shared_accounts Include shared ad accounts (default to true)
152
+ # @return [Paginated]
153
+ def ad_accounts_list(opts = {})
154
+ data, _status_code, _headers = ad_accounts_list_with_http_info(opts)
155
+ data
156
+ end
157
+
158
+ # List ad accounts
159
+ # Get a list of the ad_accounts that the \&quot;operation user_account\&quot; has access to. - This includes ad_accounts they own and ad_accounts that are owned by others who have granted them &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;.
160
+ # @param [Hash] opts the optional parameters
161
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
162
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.
163
+ # @option opts [Boolean] :include_shared_accounts Include shared ad accounts
164
+ # @return [Array<(Paginated, Integer, Hash)>] Paginated data, response status code and response headers
165
+ def ad_accounts_list_with_http_info(opts = {})
166
+ if @api_client.config.debugging
167
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_accounts_list ...'
168
+ end
169
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
170
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_accounts_list, must be smaller than or equal to 100.'
171
+ end
172
+
173
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
174
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_accounts_list, must be greater than or equal to 1.'
175
+ end
176
+
177
+ # resource path
178
+ local_var_path = '/ad_accounts'
179
+
180
+ # query parameters
181
+ query_params = opts[:query_params] || {}
182
+ query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
183
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
184
+ query_params[:'include_shared_accounts'] = opts[:'include_shared_accounts'] if !opts[:'include_shared_accounts'].nil?
185
+
186
+ # header parameters
187
+ header_params = opts[:header_params] || {}
188
+ # HTTP header 'Accept' (if needed)
189
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
190
+
191
+ # form parameters
192
+ form_params = opts[:form_params] || {}
193
+
194
+ # http body (model)
195
+ post_body = opts[:debug_body]
196
+
197
+ # return_type
198
+ return_type = opts[:debug_return_type] || 'Paginated'
199
+
200
+ # auth_names
201
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
202
+
203
+ new_options = opts.merge(
204
+ :operation => :"AdAccountsApi.ad_accounts_list",
205
+ :header_params => header_params,
206
+ :query_params => query_params,
207
+ :form_params => form_params,
208
+ :body => post_body,
209
+ :auth_names => auth_names,
210
+ :return_type => return_type
211
+ )
212
+
213
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
214
+ if @api_client.config.debugging
215
+ @api_client.config.logger.debug "API called: AdAccountsApi#ad_accounts_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
216
+ end
217
+ return data, status_code, headers
218
+ end
219
+
220
+ # Get ad group analytics
221
+ # Get analytics for the specified ad groups in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
222
+ # @param ad_account_id [String] Unique identifier of an ad account.
223
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
224
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
225
+ # @param ad_group_ids [Array<String>] List of Ad group Ids to use to filter the results.
226
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
227
+ # @param granularity [Granularity] Granularity
228
+ # @param [Hash] opts the optional parameters
229
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
230
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
231
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)
232
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')
233
+ # @return [Array<Hash<String, Object>>]
234
+ def ad_groups_analytics(ad_account_id, start_date, end_date, ad_group_ids, columns, granularity, opts = {})
235
+ data, _status_code, _headers = ad_groups_analytics_with_http_info(ad_account_id, start_date, end_date, ad_group_ids, columns, granularity, opts)
236
+ data
237
+ end
238
+
239
+ # Get ad group analytics
240
+ # Get analytics for the specified ad groups in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
241
+ # @param ad_account_id [String] Unique identifier of an ad account.
242
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
243
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
244
+ # @param ad_group_ids [Array<String>] List of Ad group Ids to use to filter the results.
245
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
246
+ # @param granularity [Granularity] Granularity
247
+ # @param [Hash] opts the optional parameters
248
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
249
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
250
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.
251
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.
252
+ # @return [Array<(Array<Hash<String, Object>>, Integer, Hash)>] Array<Hash<String, Object>> data, response status code and response headers
253
+ def ad_groups_analytics_with_http_info(ad_account_id, start_date, end_date, ad_group_ids, columns, granularity, opts = {})
254
+ if @api_client.config.debugging
255
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_groups_analytics ...'
256
+ end
257
+ # verify the required parameter 'ad_account_id' is set
258
+ if @api_client.config.client_side_validation && ad_account_id.nil?
259
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_groups_analytics"
260
+ end
261
+ pattern = Regexp.new(/^\d+$/)
262
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
263
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_groups_analytics, must conform to the pattern #{pattern}."
264
+ end
265
+
266
+ # verify the required parameter 'start_date' is set
267
+ if @api_client.config.client_side_validation && start_date.nil?
268
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ad_groups_analytics"
269
+ end
270
+ # verify the required parameter 'end_date' is set
271
+ if @api_client.config.client_side_validation && end_date.nil?
272
+ fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ad_groups_analytics"
273
+ end
274
+ # verify the required parameter 'ad_group_ids' is set
275
+ if @api_client.config.client_side_validation && ad_group_ids.nil?
276
+ fail ArgumentError, "Missing the required parameter 'ad_group_ids' when calling AdAccountsApi.ad_groups_analytics"
277
+ end
278
+ if @api_client.config.client_side_validation && ad_group_ids.length > 100
279
+ fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdAccountsApi.ad_groups_analytics, number of items must be less than or equal to 100.'
280
+ end
281
+
282
+ if @api_client.config.client_side_validation && ad_group_ids.length < 1
283
+ fail ArgumentError, 'invalid value for "ad_group_ids" when calling AdAccountsApi.ad_groups_analytics, number of items must be greater than or equal to 1.'
284
+ end
285
+
286
+ # verify the required parameter 'columns' is set
287
+ if @api_client.config.client_side_validation && columns.nil?
288
+ fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ad_groups_analytics"
289
+ end
290
+ # verify the required parameter 'granularity' is set
291
+ if @api_client.config.client_side_validation && granularity.nil?
292
+ fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ad_groups_analytics"
293
+ end
294
+ allowable_values = [1, 7, 30, 60]
295
+ if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
296
+ fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
297
+ end
298
+ allowable_values = [1, 7, 30, 60]
299
+ if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
300
+ fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
301
+ end
302
+ allowable_values = [1, 7, 30, 60]
303
+ if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
304
+ fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
305
+ end
306
+ allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
307
+ if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
308
+ fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
309
+ end
310
+ # resource path
311
+ local_var_path = '/ad_accounts/{ad_account_id}/ad_groups/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
312
+
313
+ # query parameters
314
+ query_params = opts[:query_params] || {}
315
+ query_params[:'start_date'] = start_date
316
+ query_params[:'end_date'] = end_date
317
+ query_params[:'ad_group_ids'] = @api_client.build_collection_param(ad_group_ids, :multi)
318
+ query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
319
+ query_params[:'granularity'] = granularity
320
+ query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
321
+ query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
322
+ query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
323
+ query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
324
+
325
+ # header parameters
326
+ header_params = opts[:header_params] || {}
327
+ # HTTP header 'Accept' (if needed)
328
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
329
+
330
+ # form parameters
331
+ form_params = opts[:form_params] || {}
332
+
333
+ # http body (model)
334
+ post_body = opts[:debug_body]
335
+
336
+ # return_type
337
+ return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'
338
+
339
+ # auth_names
340
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
341
+
342
+ new_options = opts.merge(
343
+ :operation => :"AdAccountsApi.ad_groups_analytics",
344
+ :header_params => header_params,
345
+ :query_params => query_params,
346
+ :form_params => form_params,
347
+ :body => post_body,
348
+ :auth_names => auth_names,
349
+ :return_type => return_type
350
+ )
351
+
352
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
353
+ if @api_client.config.debugging
354
+ @api_client.config.logger.debug "API called: AdAccountsApi#ad_groups_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
355
+ end
356
+ return data, status_code, headers
357
+ end
358
+
359
+ # List ad groups
360
+ # Get a list of the ad groups in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
361
+ # @param ad_account_id [String] Unique identifier of an ad account.
362
+ # @param [Hash] opts the optional parameters
363
+ # @option opts [Array<String>] :campaign_ids List of Campaign Ids to use to filter the results.
364
+ # @option opts [Array<String>] :ad_group_ids List of Ad group Ids to use to filter the results.
365
+ # @option opts [Array<String>] :entity_statuses Entity status
366
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)
367
+ # @option opts [String] :order The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.
368
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
369
+ # @option opts [Boolean] :translate_interests_to_names Return interests as text names (if value is true) rather than topic IDs. (default to false)
370
+ # @return [Paginated]
371
+ def ad_groups_list(ad_account_id, opts = {})
372
+ data, _status_code, _headers = ad_groups_list_with_http_info(ad_account_id, opts)
373
+ data
374
+ end
375
+
376
+ # List ad groups
377
+ # Get a list of the ad groups in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
378
+ # @param ad_account_id [String] Unique identifier of an ad account.
379
+ # @param [Hash] opts the optional parameters
380
+ # @option opts [Array<String>] :campaign_ids List of Campaign Ids to use to filter the results.
381
+ # @option opts [Array<String>] :ad_group_ids List of Ad group Ids to use to filter the results.
382
+ # @option opts [Array<String>] :entity_statuses Entity status
383
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.
384
+ # @option opts [String] :order The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.
385
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
386
+ # @option opts [Boolean] :translate_interests_to_names Return interests as text names (if value is true) rather than topic IDs.
387
+ # @return [Array<(Paginated, Integer, Hash)>] Paginated data, response status code and response headers
388
+ def ad_groups_list_with_http_info(ad_account_id, opts = {})
389
+ if @api_client.config.debugging
390
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.ad_groups_list ...'
391
+ end
392
+ # verify the required parameter 'ad_account_id' is set
393
+ if @api_client.config.client_side_validation && ad_account_id.nil?
394
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ad_groups_list"
395
+ end
396
+ pattern = Regexp.new(/^\d+$/)
397
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
398
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ad_groups_list, must conform to the pattern #{pattern}."
399
+ end
400
+
401
+ if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 100
402
+ fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be less than or equal to 100.'
403
+ end
404
+
405
+ if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
406
+ fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be greater than or equal to 1.'
407
+ end
408
+
409
+ if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length > 100
410
+ fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be less than or equal to 100.'
411
+ end
412
+
413
+ if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length < 1
414
+ fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ad_groups_list, number of items must be greater than or equal to 1.'
415
+ end
416
+
417
+ allowable_values = ["ACTIVE", "PAUSED", "ARCHIVED"]
418
+ if @api_client.config.client_side_validation && opts[:'entity_statuses'] && !opts[:'entity_statuses'].all? { |item| allowable_values.include?(item) }
419
+ fail ArgumentError, "invalid value for \"entity_statuses\", must include one of #{allowable_values}"
420
+ end
421
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
422
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_groups_list, must be smaller than or equal to 100.'
423
+ end
424
+
425
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
426
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ad_groups_list, must be greater than or equal to 1.'
427
+ end
428
+
429
+ allowable_values = ["ASCENDING", "DESCENDING"]
430
+ if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
431
+ fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
432
+ end
433
+ # resource path
434
+ local_var_path = '/ad_accounts/{ad_account_id}/ad_groups'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
435
+
436
+ # query parameters
437
+ query_params = opts[:query_params] || {}
438
+ query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
439
+ query_params[:'ad_group_ids'] = @api_client.build_collection_param(opts[:'ad_group_ids'], :multi) if !opts[:'ad_group_ids'].nil?
440
+ query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
441
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
442
+ query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
443
+ query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
444
+ query_params[:'translate_interests_to_names'] = opts[:'translate_interests_to_names'] if !opts[:'translate_interests_to_names'].nil?
445
+
446
+ # header parameters
447
+ header_params = opts[:header_params] || {}
448
+ # HTTP header 'Accept' (if needed)
449
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
450
+
451
+ # form parameters
452
+ form_params = opts[:form_params] || {}
453
+
454
+ # http body (model)
455
+ post_body = opts[:debug_body]
456
+
457
+ # return_type
458
+ return_type = opts[:debug_return_type] || 'Paginated'
459
+
460
+ # auth_names
461
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
462
+
463
+ new_options = opts.merge(
464
+ :operation => :"AdAccountsApi.ad_groups_list",
465
+ :header_params => header_params,
466
+ :query_params => query_params,
467
+ :form_params => form_params,
468
+ :body => post_body,
469
+ :auth_names => auth_names,
470
+ :return_type => return_type
471
+ )
472
+
473
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
474
+ if @api_client.config.debugging
475
+ @api_client.config.logger.debug "API called: AdAccountsApi#ad_groups_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
476
+ end
477
+ return data, status_code, headers
478
+ end
479
+
480
+ # Get ad analytics
481
+ # Get analytics for the specified ads in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
482
+ # @param ad_account_id [String] Unique identifier of an ad account.
483
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
484
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
485
+ # @param ad_ids [Array<String>] List of Ad Ids to use to filter the results.
486
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
487
+ # @param granularity [Granularity] Granularity
488
+ # @param [Hash] opts the optional parameters
489
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
490
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
491
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)
492
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')
493
+ # @return [Array<Hash<String, Object>>]
494
+ def ads_analytics(ad_account_id, start_date, end_date, ad_ids, columns, granularity, opts = {})
495
+ data, _status_code, _headers = ads_analytics_with_http_info(ad_account_id, start_date, end_date, ad_ids, columns, granularity, opts)
496
+ data
497
+ end
498
+
499
+ # Get ad analytics
500
+ # Get analytics for the specified ads in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
501
+ # @param ad_account_id [String] Unique identifier of an ad account.
502
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
503
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
504
+ # @param ad_ids [Array<String>] List of Ad Ids to use to filter the results.
505
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
506
+ # @param granularity [Granularity] Granularity
507
+ # @param [Hash] opts the optional parameters
508
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
509
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
510
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.
511
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.
512
+ # @return [Array<(Array<Hash<String, Object>>, Integer, Hash)>] Array<Hash<String, Object>> data, response status code and response headers
513
+ def ads_analytics_with_http_info(ad_account_id, start_date, end_date, ad_ids, columns, granularity, opts = {})
514
+ if @api_client.config.debugging
515
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.ads_analytics ...'
516
+ end
517
+ # verify the required parameter 'ad_account_id' is set
518
+ if @api_client.config.client_side_validation && ad_account_id.nil?
519
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ads_analytics"
520
+ end
521
+ pattern = Regexp.new(/^\d+$/)
522
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
523
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ads_analytics, must conform to the pattern #{pattern}."
524
+ end
525
+
526
+ # verify the required parameter 'start_date' is set
527
+ if @api_client.config.client_side_validation && start_date.nil?
528
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.ads_analytics"
529
+ end
530
+ # verify the required parameter 'end_date' is set
531
+ if @api_client.config.client_side_validation && end_date.nil?
532
+ fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.ads_analytics"
533
+ end
534
+ # verify the required parameter 'ad_ids' is set
535
+ if @api_client.config.client_side_validation && ad_ids.nil?
536
+ fail ArgumentError, "Missing the required parameter 'ad_ids' when calling AdAccountsApi.ads_analytics"
537
+ end
538
+ if @api_client.config.client_side_validation && ad_ids.length > 100
539
+ fail ArgumentError, 'invalid value for "ad_ids" when calling AdAccountsApi.ads_analytics, number of items must be less than or equal to 100.'
540
+ end
541
+
542
+ if @api_client.config.client_side_validation && ad_ids.length < 1
543
+ fail ArgumentError, 'invalid value for "ad_ids" when calling AdAccountsApi.ads_analytics, number of items must be greater than or equal to 1.'
544
+ end
545
+
546
+ # verify the required parameter 'columns' is set
547
+ if @api_client.config.client_side_validation && columns.nil?
548
+ fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.ads_analytics"
549
+ end
550
+ # verify the required parameter 'granularity' is set
551
+ if @api_client.config.client_side_validation && granularity.nil?
552
+ fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.ads_analytics"
553
+ end
554
+ allowable_values = [1, 7, 30, 60]
555
+ if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
556
+ fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
557
+ end
558
+ allowable_values = [1, 7, 30, 60]
559
+ if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
560
+ fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
561
+ end
562
+ allowable_values = [1, 7, 30, 60]
563
+ if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
564
+ fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
565
+ end
566
+ allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
567
+ if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
568
+ fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
569
+ end
570
+ # resource path
571
+ local_var_path = '/ad_accounts/{ad_account_id}/ads/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
572
+
573
+ # query parameters
574
+ query_params = opts[:query_params] || {}
575
+ query_params[:'start_date'] = start_date
576
+ query_params[:'end_date'] = end_date
577
+ query_params[:'ad_ids'] = @api_client.build_collection_param(ad_ids, :multi)
578
+ query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
579
+ query_params[:'granularity'] = granularity
580
+ query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
581
+ query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
582
+ query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
583
+ query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
584
+
585
+ # header parameters
586
+ header_params = opts[:header_params] || {}
587
+ # HTTP header 'Accept' (if needed)
588
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
589
+
590
+ # form parameters
591
+ form_params = opts[:form_params] || {}
592
+
593
+ # http body (model)
594
+ post_body = opts[:debug_body]
595
+
596
+ # return_type
597
+ return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'
598
+
599
+ # auth_names
600
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
601
+
602
+ new_options = opts.merge(
603
+ :operation => :"AdAccountsApi.ads_analytics",
604
+ :header_params => header_params,
605
+ :query_params => query_params,
606
+ :form_params => form_params,
607
+ :body => post_body,
608
+ :auth_names => auth_names,
609
+ :return_type => return_type
610
+ )
611
+
612
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
613
+ if @api_client.config.debugging
614
+ @api_client.config.logger.debug "API called: AdAccountsApi#ads_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
615
+ end
616
+ return data, status_code, headers
617
+ end
618
+
619
+ # List ads
620
+ # Get a list of the ads in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
621
+ # @param ad_account_id [String] Unique identifier of an ad account.
622
+ # @param [Hash] opts the optional parameters
623
+ # @option opts [Array<String>] :campaign_ids List of Campaign Ids to use to filter the results.
624
+ # @option opts [Array<String>] :ad_group_ids List of Ad group Ids to use to filter the results.
625
+ # @option opts [Array<String>] :ad_ids List of Ad Ids to use to filter the results.
626
+ # @option opts [Array<String>] :entity_statuses Entity status
627
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)
628
+ # @option opts [String] :order The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.
629
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
630
+ # @return [Paginated]
631
+ def ads_list(ad_account_id, opts = {})
632
+ data, _status_code, _headers = ads_list_with_http_info(ad_account_id, opts)
633
+ data
634
+ end
635
+
636
+ # List ads
637
+ # Get a list of the ads in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
638
+ # @param ad_account_id [String] Unique identifier of an ad account.
639
+ # @param [Hash] opts the optional parameters
640
+ # @option opts [Array<String>] :campaign_ids List of Campaign Ids to use to filter the results.
641
+ # @option opts [Array<String>] :ad_group_ids List of Ad group Ids to use to filter the results.
642
+ # @option opts [Array<String>] :ad_ids List of Ad Ids to use to filter the results.
643
+ # @option opts [Array<String>] :entity_statuses Entity status
644
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.
645
+ # @option opts [String] :order The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.
646
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
647
+ # @return [Array<(Paginated, Integer, Hash)>] Paginated data, response status code and response headers
648
+ def ads_list_with_http_info(ad_account_id, opts = {})
649
+ if @api_client.config.debugging
650
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.ads_list ...'
651
+ end
652
+ # verify the required parameter 'ad_account_id' is set
653
+ if @api_client.config.client_side_validation && ad_account_id.nil?
654
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.ads_list"
655
+ end
656
+ pattern = Regexp.new(/^\d+$/)
657
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
658
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.ads_list, must conform to the pattern #{pattern}."
659
+ end
660
+
661
+ if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 100
662
+ fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ads_list, number of items must be less than or equal to 100.'
663
+ end
664
+
665
+ if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
666
+ fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.ads_list, number of items must be greater than or equal to 1.'
667
+ end
668
+
669
+ if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length > 100
670
+ fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ads_list, number of items must be less than or equal to 100.'
671
+ end
672
+
673
+ if @api_client.config.client_side_validation && !opts[:'ad_group_ids'].nil? && opts[:'ad_group_ids'].length < 1
674
+ fail ArgumentError, 'invalid value for "opts[:"ad_group_ids"]" when calling AdAccountsApi.ads_list, number of items must be greater than or equal to 1.'
675
+ end
676
+
677
+ if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length > 100
678
+ fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdAccountsApi.ads_list, number of items must be less than or equal to 100.'
679
+ end
680
+
681
+ if @api_client.config.client_side_validation && !opts[:'ad_ids'].nil? && opts[:'ad_ids'].length < 1
682
+ fail ArgumentError, 'invalid value for "opts[:"ad_ids"]" when calling AdAccountsApi.ads_list, number of items must be greater than or equal to 1.'
683
+ end
684
+
685
+ allowable_values = ["ACTIVE", "PAUSED", "ARCHIVED"]
686
+ if @api_client.config.client_side_validation && opts[:'entity_statuses'] && !opts[:'entity_statuses'].all? { |item| allowable_values.include?(item) }
687
+ fail ArgumentError, "invalid value for \"entity_statuses\", must include one of #{allowable_values}"
688
+ end
689
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
690
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ads_list, must be smaller than or equal to 100.'
691
+ end
692
+
693
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
694
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.ads_list, must be greater than or equal to 1.'
695
+ end
696
+
697
+ allowable_values = ["ASCENDING", "DESCENDING"]
698
+ if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
699
+ fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
700
+ end
701
+ # resource path
702
+ local_var_path = '/ad_accounts/{ad_account_id}/ads'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
703
+
704
+ # query parameters
705
+ query_params = opts[:query_params] || {}
706
+ query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
707
+ query_params[:'ad_group_ids'] = @api_client.build_collection_param(opts[:'ad_group_ids'], :multi) if !opts[:'ad_group_ids'].nil?
708
+ query_params[:'ad_ids'] = @api_client.build_collection_param(opts[:'ad_ids'], :multi) if !opts[:'ad_ids'].nil?
709
+ query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
710
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
711
+ query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
712
+ query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
713
+
714
+ # header parameters
715
+ header_params = opts[:header_params] || {}
716
+ # HTTP header 'Accept' (if needed)
717
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
718
+
719
+ # form parameters
720
+ form_params = opts[:form_params] || {}
721
+
722
+ # http body (model)
723
+ post_body = opts[:debug_body]
724
+
725
+ # return_type
726
+ return_type = opts[:debug_return_type] || 'Paginated'
727
+
728
+ # auth_names
729
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
730
+
731
+ new_options = opts.merge(
732
+ :operation => :"AdAccountsApi.ads_list",
733
+ :header_params => header_params,
734
+ :query_params => query_params,
735
+ :form_params => form_params,
736
+ :body => post_body,
737
+ :auth_names => auth_names,
738
+ :return_type => return_type
739
+ )
740
+
741
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
742
+ if @api_client.config.debugging
743
+ @api_client.config.logger.debug "API called: AdAccountsApi#ads_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
744
+ end
745
+ return data, status_code, headers
746
+ end
747
+
748
+ # Create async request for an account analytics report
749
+ # This returns a token that you can use to download the report when it is ready. Note that this endpoint requires the parameters to be passed as JSON-formatted in the request body. This endpoint does not support URL query parameters. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
750
+ # @param ad_account_id [String] Unique identifier of an ad account.
751
+ # @param ads_analytics_create_async_request [AdsAnalyticsCreateAsyncRequest]
752
+ # @param [Hash] opts the optional parameters
753
+ # @return [AdsAnalyticsCreateAsyncResponse]
754
+ def analytics_create_report(ad_account_id, ads_analytics_create_async_request, opts = {})
755
+ data, _status_code, _headers = analytics_create_report_with_http_info(ad_account_id, ads_analytics_create_async_request, opts)
756
+ data
757
+ end
758
+
759
+ # Create async request for an account analytics report
760
+ # This returns a token that you can use to download the report when it is ready. Note that this endpoint requires the parameters to be passed as JSON-formatted in the request body. This endpoint does not support URL query parameters. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
761
+ # @param ad_account_id [String] Unique identifier of an ad account.
762
+ # @param ads_analytics_create_async_request [AdsAnalyticsCreateAsyncRequest]
763
+ # @param [Hash] opts the optional parameters
764
+ # @return [Array<(AdsAnalyticsCreateAsyncResponse, Integer, Hash)>] AdsAnalyticsCreateAsyncResponse data, response status code and response headers
765
+ def analytics_create_report_with_http_info(ad_account_id, ads_analytics_create_async_request, opts = {})
766
+ if @api_client.config.debugging
767
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_create_report ...'
768
+ end
769
+ # verify the required parameter 'ad_account_id' is set
770
+ if @api_client.config.client_side_validation && ad_account_id.nil?
771
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_create_report"
772
+ end
773
+ pattern = Regexp.new(/^\d+$/)
774
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
775
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_create_report, must conform to the pattern #{pattern}."
776
+ end
777
+
778
+ # verify the required parameter 'ads_analytics_create_async_request' is set
779
+ if @api_client.config.client_side_validation && ads_analytics_create_async_request.nil?
780
+ fail ArgumentError, "Missing the required parameter 'ads_analytics_create_async_request' when calling AdAccountsApi.analytics_create_report"
781
+ end
782
+ # resource path
783
+ local_var_path = '/ad_accounts/{ad_account_id}/reports'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
784
+
785
+ # query parameters
786
+ query_params = opts[:query_params] || {}
787
+
788
+ # header parameters
789
+ header_params = opts[:header_params] || {}
790
+ # HTTP header 'Accept' (if needed)
791
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
792
+ # HTTP header 'Content-Type'
793
+ content_type = @api_client.select_header_content_type(['application/json'])
794
+ if !content_type.nil?
795
+ header_params['Content-Type'] = content_type
796
+ end
797
+
798
+ # form parameters
799
+ form_params = opts[:form_params] || {}
800
+
801
+ # http body (model)
802
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(ads_analytics_create_async_request)
803
+
804
+ # return_type
805
+ return_type = opts[:debug_return_type] || 'AdsAnalyticsCreateAsyncResponse'
806
+
807
+ # auth_names
808
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
809
+
810
+ new_options = opts.merge(
811
+ :operation => :"AdAccountsApi.analytics_create_report",
812
+ :header_params => header_params,
813
+ :query_params => query_params,
814
+ :form_params => form_params,
815
+ :body => post_body,
816
+ :auth_names => auth_names,
817
+ :return_type => return_type
818
+ )
819
+
820
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
821
+ if @api_client.config.debugging
822
+ @api_client.config.logger.debug "API called: AdAccountsApi#analytics_create_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
823
+ end
824
+ return data, status_code, headers
825
+ end
826
+
827
+ # Get the account analytics report created by the async call
828
+ # This returns a URL to an analytics report given a token returned from the post request report creation call. You can use the URL to download the report and it's valid for an hour. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
829
+ # @param ad_account_id [String] Unique identifier of an ad account.
830
+ # @param token [String] Token returned from the post request creation call
831
+ # @param [Hash] opts the optional parameters
832
+ # @return [AdsAnalyticsGetAsyncResponse]
833
+ def analytics_get_report(ad_account_id, token, opts = {})
834
+ data, _status_code, _headers = analytics_get_report_with_http_info(ad_account_id, token, opts)
835
+ data
836
+ end
837
+
838
+ # Get the account analytics report created by the async call
839
+ # This returns a URL to an analytics report given a token returned from the post request report creation call. You can use the URL to download the report and it&#39;s valid for an hour. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
840
+ # @param ad_account_id [String] Unique identifier of an ad account.
841
+ # @param token [String] Token returned from the post request creation call
842
+ # @param [Hash] opts the optional parameters
843
+ # @return [Array<(AdsAnalyticsGetAsyncResponse, Integer, Hash)>] AdsAnalyticsGetAsyncResponse data, response status code and response headers
844
+ def analytics_get_report_with_http_info(ad_account_id, token, opts = {})
845
+ if @api_client.config.debugging
846
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.analytics_get_report ...'
847
+ end
848
+ # verify the required parameter 'ad_account_id' is set
849
+ if @api_client.config.client_side_validation && ad_account_id.nil?
850
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.analytics_get_report"
851
+ end
852
+ pattern = Regexp.new(/^\d+$/)
853
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
854
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.analytics_get_report, must conform to the pattern #{pattern}."
855
+ end
856
+
857
+ # verify the required parameter 'token' is set
858
+ if @api_client.config.client_side_validation && token.nil?
859
+ fail ArgumentError, "Missing the required parameter 'token' when calling AdAccountsApi.analytics_get_report"
860
+ end
861
+ # resource path
862
+ local_var_path = '/ad_accounts/{ad_account_id}/reports'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
863
+
864
+ # query parameters
865
+ query_params = opts[:query_params] || {}
866
+ query_params[:'token'] = token
867
+
868
+ # header parameters
869
+ header_params = opts[:header_params] || {}
870
+ # HTTP header 'Accept' (if needed)
871
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
872
+
873
+ # form parameters
874
+ form_params = opts[:form_params] || {}
875
+
876
+ # http body (model)
877
+ post_body = opts[:debug_body]
878
+
879
+ # return_type
880
+ return_type = opts[:debug_return_type] || 'AdsAnalyticsGetAsyncResponse'
881
+
882
+ # auth_names
883
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
884
+
885
+ new_options = opts.merge(
886
+ :operation => :"AdAccountsApi.analytics_get_report",
887
+ :header_params => header_params,
888
+ :query_params => query_params,
889
+ :form_params => form_params,
890
+ :body => post_body,
891
+ :auth_names => auth_names,
892
+ :return_type => return_type
893
+ )
894
+
895
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
896
+ if @api_client.config.debugging
897
+ @api_client.config.logger.debug "API called: AdAccountsApi#analytics_get_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
898
+ end
899
+ return data, status_code, headers
900
+ end
901
+
902
+ # Get campaign analytics
903
+ # Get analytics for the specified campaigns in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
904
+ # @param ad_account_id [String] Unique identifier of an ad account.
905
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
906
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
907
+ # @param campaign_ids [Array<String>] List of Campaign Ids to use to filter the results.
908
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
909
+ # @param granularity [Granularity] Granularity
910
+ # @param [Hash] opts the optional parameters
911
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
912
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
913
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)
914
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')
915
+ # @return [Array<Hash<String, Object>>]
916
+ def campaigns_analytics(ad_account_id, start_date, end_date, campaign_ids, columns, granularity, opts = {})
917
+ data, _status_code, _headers = campaigns_analytics_with_http_info(ad_account_id, start_date, end_date, campaign_ids, columns, granularity, opts)
918
+ data
919
+ end
920
+
921
+ # Get campaign analytics
922
+ # Get analytics for the specified campaigns in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
923
+ # @param ad_account_id [String] Unique identifier of an ad account.
924
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
925
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
926
+ # @param campaign_ids [Array<String>] List of Campaign Ids to use to filter the results.
927
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
928
+ # @param granularity [Granularity] Granularity
929
+ # @param [Hash] opts the optional parameters
930
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
931
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
932
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.
933
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.
934
+ # @return [Array<(Array<Hash<String, Object>>, Integer, Hash)>] Array<Hash<String, Object>> data, response status code and response headers
935
+ def campaigns_analytics_with_http_info(ad_account_id, start_date, end_date, campaign_ids, columns, granularity, opts = {})
936
+ if @api_client.config.debugging
937
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.campaigns_analytics ...'
938
+ end
939
+ # verify the required parameter 'ad_account_id' is set
940
+ if @api_client.config.client_side_validation && ad_account_id.nil?
941
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.campaigns_analytics"
942
+ end
943
+ pattern = Regexp.new(/^\d+$/)
944
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
945
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.campaigns_analytics, must conform to the pattern #{pattern}."
946
+ end
947
+
948
+ # verify the required parameter 'start_date' is set
949
+ if @api_client.config.client_side_validation && start_date.nil?
950
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.campaigns_analytics"
951
+ end
952
+ # verify the required parameter 'end_date' is set
953
+ if @api_client.config.client_side_validation && end_date.nil?
954
+ fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.campaigns_analytics"
955
+ end
956
+ # verify the required parameter 'campaign_ids' is set
957
+ if @api_client.config.client_side_validation && campaign_ids.nil?
958
+ fail ArgumentError, "Missing the required parameter 'campaign_ids' when calling AdAccountsApi.campaigns_analytics"
959
+ end
960
+ if @api_client.config.client_side_validation && campaign_ids.length > 100
961
+ fail ArgumentError, 'invalid value for "campaign_ids" when calling AdAccountsApi.campaigns_analytics, number of items must be less than or equal to 100.'
962
+ end
963
+
964
+ if @api_client.config.client_side_validation && campaign_ids.length < 1
965
+ fail ArgumentError, 'invalid value for "campaign_ids" when calling AdAccountsApi.campaigns_analytics, number of items must be greater than or equal to 1.'
966
+ end
967
+
968
+ # verify the required parameter 'columns' is set
969
+ if @api_client.config.client_side_validation && columns.nil?
970
+ fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.campaigns_analytics"
971
+ end
972
+ # verify the required parameter 'granularity' is set
973
+ if @api_client.config.client_side_validation && granularity.nil?
974
+ fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.campaigns_analytics"
975
+ end
976
+ allowable_values = [1, 7, 30, 60]
977
+ if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
978
+ fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
979
+ end
980
+ allowable_values = [1, 7, 30, 60]
981
+ if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
982
+ fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
983
+ end
984
+ allowable_values = [1, 7, 30, 60]
985
+ if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
986
+ fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
987
+ end
988
+ allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
989
+ if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
990
+ fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
991
+ end
992
+ # resource path
993
+ local_var_path = '/ad_accounts/{ad_account_id}/campaigns/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
994
+
995
+ # query parameters
996
+ query_params = opts[:query_params] || {}
997
+ query_params[:'start_date'] = start_date
998
+ query_params[:'end_date'] = end_date
999
+ query_params[:'campaign_ids'] = @api_client.build_collection_param(campaign_ids, :multi)
1000
+ query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
1001
+ query_params[:'granularity'] = granularity
1002
+ query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
1003
+ query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
1004
+ query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
1005
+ query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
1006
+
1007
+ # header parameters
1008
+ header_params = opts[:header_params] || {}
1009
+ # HTTP header 'Accept' (if needed)
1010
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1011
+
1012
+ # form parameters
1013
+ form_params = opts[:form_params] || {}
1014
+
1015
+ # http body (model)
1016
+ post_body = opts[:debug_body]
1017
+
1018
+ # return_type
1019
+ return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'
1020
+
1021
+ # auth_names
1022
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
1023
+
1024
+ new_options = opts.merge(
1025
+ :operation => :"AdAccountsApi.campaigns_analytics",
1026
+ :header_params => header_params,
1027
+ :query_params => query_params,
1028
+ :form_params => form_params,
1029
+ :body => post_body,
1030
+ :auth_names => auth_names,
1031
+ :return_type => return_type
1032
+ )
1033
+
1034
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1035
+ if @api_client.config.debugging
1036
+ @api_client.config.logger.debug "API called: AdAccountsApi#campaigns_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1037
+ end
1038
+ return data, status_code, headers
1039
+ end
1040
+
1041
+ # List campaigns
1042
+ # Get a list of the campaigns in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
1043
+ # @param ad_account_id [String] Unique identifier of an ad account.
1044
+ # @param [Hash] opts the optional parameters
1045
+ # @option opts [Array<String>] :campaign_ids List of Campaign Ids to use to filter the results.
1046
+ # @option opts [Array<String>] :entity_statuses Entity status
1047
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information. (default to 25)
1048
+ # @option opts [String] :order The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.
1049
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
1050
+ # @return [Paginated]
1051
+ def campaigns_list(ad_account_id, opts = {})
1052
+ data, _status_code, _headers = campaigns_list_with_http_info(ad_account_id, opts)
1053
+ data
1054
+ end
1055
+
1056
+ # List campaigns
1057
+ # Get a list of the campaigns in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
1058
+ # @param ad_account_id [String] Unique identifier of an ad account.
1059
+ # @param [Hash] opts the optional parameters
1060
+ # @option opts [Array<String>] :campaign_ids List of Campaign Ids to use to filter the results.
1061
+ # @option opts [Array<String>] :entity_statuses Entity status
1062
+ # @option opts [Integer] :page_size Maximum number of items to include in a single page of the response. See documentation on &lt;a href&#x3D;&#39;/docs/api/v5/#tag/Pagination&#39;&gt;Pagination&lt;/a&gt; for more information.
1063
+ # @option opts [String] :order The order in which to sort the items returned: “ASCENDING” or “DESCENDING” by ID. Note that higher-value IDs are associated with more-recently added items.
1064
+ # @option opts [String] :bookmark Cursor used to fetch the next page of items
1065
+ # @return [Array<(Paginated, Integer, Hash)>] Paginated data, response status code and response headers
1066
+ def campaigns_list_with_http_info(ad_account_id, opts = {})
1067
+ if @api_client.config.debugging
1068
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.campaigns_list ...'
1069
+ end
1070
+ # verify the required parameter 'ad_account_id' is set
1071
+ if @api_client.config.client_side_validation && ad_account_id.nil?
1072
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.campaigns_list"
1073
+ end
1074
+ pattern = Regexp.new(/^\d+$/)
1075
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
1076
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.campaigns_list, must conform to the pattern #{pattern}."
1077
+ end
1078
+
1079
+ if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length > 100
1080
+ fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.campaigns_list, number of items must be less than or equal to 100.'
1081
+ end
1082
+
1083
+ if @api_client.config.client_side_validation && !opts[:'campaign_ids'].nil? && opts[:'campaign_ids'].length < 1
1084
+ fail ArgumentError, 'invalid value for "opts[:"campaign_ids"]" when calling AdAccountsApi.campaigns_list, number of items must be greater than or equal to 1.'
1085
+ end
1086
+
1087
+ allowable_values = ["ACTIVE", "PAUSED", "ARCHIVED"]
1088
+ if @api_client.config.client_side_validation && opts[:'entity_statuses'] && !opts[:'entity_statuses'].all? { |item| allowable_values.include?(item) }
1089
+ fail ArgumentError, "invalid value for \"entity_statuses\", must include one of #{allowable_values}"
1090
+ end
1091
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
1092
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.campaigns_list, must be smaller than or equal to 100.'
1093
+ end
1094
+
1095
+ if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
1096
+ fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling AdAccountsApi.campaigns_list, must be greater than or equal to 1.'
1097
+ end
1098
+
1099
+ allowable_values = ["ASCENDING", "DESCENDING"]
1100
+ if @api_client.config.client_side_validation && opts[:'order'] && !allowable_values.include?(opts[:'order'])
1101
+ fail ArgumentError, "invalid value for \"order\", must be one of #{allowable_values}"
1102
+ end
1103
+ # resource path
1104
+ local_var_path = '/ad_accounts/{ad_account_id}/campaigns'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
1105
+
1106
+ # query parameters
1107
+ query_params = opts[:query_params] || {}
1108
+ query_params[:'campaign_ids'] = @api_client.build_collection_param(opts[:'campaign_ids'], :multi) if !opts[:'campaign_ids'].nil?
1109
+ query_params[:'entity_statuses'] = @api_client.build_collection_param(opts[:'entity_statuses'], :multi) if !opts[:'entity_statuses'].nil?
1110
+ query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
1111
+ query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?
1112
+ query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil?
1113
+
1114
+ # header parameters
1115
+ header_params = opts[:header_params] || {}
1116
+ # HTTP header 'Accept' (if needed)
1117
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1118
+
1119
+ # form parameters
1120
+ form_params = opts[:form_params] || {}
1121
+
1122
+ # http body (model)
1123
+ post_body = opts[:debug_body]
1124
+
1125
+ # return_type
1126
+ return_type = opts[:debug_return_type] || 'Paginated'
1127
+
1128
+ # auth_names
1129
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
1130
+
1131
+ new_options = opts.merge(
1132
+ :operation => :"AdAccountsApi.campaigns_list",
1133
+ :header_params => header_params,
1134
+ :query_params => query_params,
1135
+ :form_params => form_params,
1136
+ :body => post_body,
1137
+ :auth_names => auth_names,
1138
+ :return_type => return_type
1139
+ )
1140
+
1141
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1142
+ if @api_client.config.debugging
1143
+ @api_client.config.logger.debug "API called: AdAccountsApi#campaigns_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1144
+ end
1145
+ return data, status_code, headers
1146
+ end
1147
+
1148
+ # Get product group analytics
1149
+ # Get analytics for the specified product groups in the specified <code>ad_account_id</code>, filtered by the specified options. - The token's user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via <a href=\"https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\">Business Access</a>: Admin, Analyst, Campaign Manager.
1150
+ # @param ad_account_id [String] Unique identifier of an ad account.
1151
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
1152
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
1153
+ # @param product_group_ids [Array<String>] List of Product group Ids to use to filter the results.
1154
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
1155
+ # @param granularity [Granularity] Granularity
1156
+ # @param [Hash] opts the optional parameters
1157
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
1158
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days. (default to 30)
1159
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day. (default to 1)
1160
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event. (default to 'TIME_OF_AD_ACTION')
1161
+ # @return [Array<Hash<String, Object>>]
1162
+ def product_groups_analytics(ad_account_id, start_date, end_date, product_group_ids, columns, granularity, opts = {})
1163
+ data, _status_code, _headers = product_groups_analytics_with_http_info(ad_account_id, start_date, end_date, product_group_ids, columns, granularity, opts)
1164
+ data
1165
+ end
1166
+
1167
+ # Get product group analytics
1168
+ # Get analytics for the specified product groups in the specified &lt;code&gt;ad_account_id&lt;/code&gt;, filtered by the specified options. - The token&#39;s user_account must either be the Owner of the specified ad account, or have one of the necessary roles granted to them via &lt;a href&#x3D;\&quot;https://help.pinterest.com/en/business/article/share-and-manage-access-to-your-ad-accounts\&quot;&gt;Business Access&lt;/a&gt;: Admin, Analyst, Campaign Manager.
1169
+ # @param ad_account_id [String] Unique identifier of an ad account.
1170
+ # @param start_date [Date] Metric report start date (UTC). Format: YYYY-MM-DD
1171
+ # @param end_date [Date] Metric report end date (UTC). Format: YYYY-MM-DD
1172
+ # @param product_group_ids [Array<String>] List of Product group Ids to use to filter the results.
1173
+ # @param columns [Array<String>] Columns to retrieve. **NOTE**: Any metrics defined as MICRO_DOLLARS returns a value based on the advertiser profile&#39;s currency field. For USD,($1/1,000,000, or $0.000001 - one one-ten-thousandth of a cent). it&#39;s microdollars. Otherwise, it&#39;s in microunits of the advertiser&#39;s currency.&lt;br/&gt;For example, if the advertiser&#39;s currency is GBP (British pound sterling), all MICRO_DOLLARS fields will be in GBP microunits (1/1,000,000 British pound).&lt;br/&gt;If a column has no value, it may not be returned
1174
+ # @param granularity [Granularity] Granularity
1175
+ # @param [Hash] opts the optional parameters
1176
+ # @option opts [Integer] :click_window_days Number of days to use as the conversion attribution window for a pin click action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
1177
+ # @option opts [Integer] :engagement_window_days Number of days to use as the conversion attribution window for an engagement action. Engagements include saves, closeups, link clicks, and carousel card swipes. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;30&#x60; days.
1178
+ # @option opts [Integer] :view_window_days Number of days to use as the conversion attribution window for a view action. Applies to Pinterest Tag conversion metrics. Prior conversion tags use their defined attribution windows. If not specified, defaults to &#x60;1&#x60; day.
1179
+ # @option opts [String] :conversion_report_time The date by which the conversion metrics returned from this endpoint will be reported. There are two dates associated with a conversion event: the date that the user interacted with the ad, and the date that the user completed a conversion event.
1180
+ # @return [Array<(Array<Hash<String, Object>>, Integer, Hash)>] Array<Hash<String, Object>> data, response status code and response headers
1181
+ def product_groups_analytics_with_http_info(ad_account_id, start_date, end_date, product_group_ids, columns, granularity, opts = {})
1182
+ if @api_client.config.debugging
1183
+ @api_client.config.logger.debug 'Calling API: AdAccountsApi.product_groups_analytics ...'
1184
+ end
1185
+ # verify the required parameter 'ad_account_id' is set
1186
+ if @api_client.config.client_side_validation && ad_account_id.nil?
1187
+ fail ArgumentError, "Missing the required parameter 'ad_account_id' when calling AdAccountsApi.product_groups_analytics"
1188
+ end
1189
+ pattern = Regexp.new(/^\d+$/)
1190
+ if @api_client.config.client_side_validation && ad_account_id !~ pattern
1191
+ fail ArgumentError, "invalid value for 'ad_account_id' when calling AdAccountsApi.product_groups_analytics, must conform to the pattern #{pattern}."
1192
+ end
1193
+
1194
+ # verify the required parameter 'start_date' is set
1195
+ if @api_client.config.client_side_validation && start_date.nil?
1196
+ fail ArgumentError, "Missing the required parameter 'start_date' when calling AdAccountsApi.product_groups_analytics"
1197
+ end
1198
+ # verify the required parameter 'end_date' is set
1199
+ if @api_client.config.client_side_validation && end_date.nil?
1200
+ fail ArgumentError, "Missing the required parameter 'end_date' when calling AdAccountsApi.product_groups_analytics"
1201
+ end
1202
+ # verify the required parameter 'product_group_ids' is set
1203
+ if @api_client.config.client_side_validation && product_group_ids.nil?
1204
+ fail ArgumentError, "Missing the required parameter 'product_group_ids' when calling AdAccountsApi.product_groups_analytics"
1205
+ end
1206
+ if @api_client.config.client_side_validation && product_group_ids.length > 100
1207
+ fail ArgumentError, 'invalid value for "product_group_ids" when calling AdAccountsApi.product_groups_analytics, number of items must be less than or equal to 100.'
1208
+ end
1209
+
1210
+ if @api_client.config.client_side_validation && product_group_ids.length < 1
1211
+ fail ArgumentError, 'invalid value for "product_group_ids" when calling AdAccountsApi.product_groups_analytics, number of items must be greater than or equal to 1.'
1212
+ end
1213
+
1214
+ # verify the required parameter 'columns' is set
1215
+ if @api_client.config.client_side_validation && columns.nil?
1216
+ fail ArgumentError, "Missing the required parameter 'columns' when calling AdAccountsApi.product_groups_analytics"
1217
+ end
1218
+ # verify the required parameter 'granularity' is set
1219
+ if @api_client.config.client_side_validation && granularity.nil?
1220
+ fail ArgumentError, "Missing the required parameter 'granularity' when calling AdAccountsApi.product_groups_analytics"
1221
+ end
1222
+ allowable_values = [1, 7, 30, 60]
1223
+ if @api_client.config.client_side_validation && opts[:'click_window_days'] && !allowable_values.include?(opts[:'click_window_days'])
1224
+ fail ArgumentError, "invalid value for \"click_window_days\", must be one of #{allowable_values}"
1225
+ end
1226
+ allowable_values = [1, 7, 30, 60]
1227
+ if @api_client.config.client_side_validation && opts[:'engagement_window_days'] && !allowable_values.include?(opts[:'engagement_window_days'])
1228
+ fail ArgumentError, "invalid value for \"engagement_window_days\", must be one of #{allowable_values}"
1229
+ end
1230
+ allowable_values = [1, 7, 30, 60]
1231
+ if @api_client.config.client_side_validation && opts[:'view_window_days'] && !allowable_values.include?(opts[:'view_window_days'])
1232
+ fail ArgumentError, "invalid value for \"view_window_days\", must be one of #{allowable_values}"
1233
+ end
1234
+ allowable_values = ["TIME_OF_AD_ACTION", "TIME_OF_CONVERSION"]
1235
+ if @api_client.config.client_side_validation && opts[:'conversion_report_time'] && !allowable_values.include?(opts[:'conversion_report_time'])
1236
+ fail ArgumentError, "invalid value for \"conversion_report_time\", must be one of #{allowable_values}"
1237
+ end
1238
+ # resource path
1239
+ local_var_path = '/ad_accounts/{ad_account_id}/product_groups/analytics'.sub('{' + 'ad_account_id' + '}', CGI.escape(ad_account_id.to_s))
1240
+
1241
+ # query parameters
1242
+ query_params = opts[:query_params] || {}
1243
+ query_params[:'start_date'] = start_date
1244
+ query_params[:'end_date'] = end_date
1245
+ query_params[:'product_group_ids'] = @api_client.build_collection_param(product_group_ids, :multi)
1246
+ query_params[:'columns'] = @api_client.build_collection_param(columns, :csv)
1247
+ query_params[:'granularity'] = granularity
1248
+ query_params[:'click_window_days'] = opts[:'click_window_days'] if !opts[:'click_window_days'].nil?
1249
+ query_params[:'engagement_window_days'] = opts[:'engagement_window_days'] if !opts[:'engagement_window_days'].nil?
1250
+ query_params[:'view_window_days'] = opts[:'view_window_days'] if !opts[:'view_window_days'].nil?
1251
+ query_params[:'conversion_report_time'] = opts[:'conversion_report_time'] if !opts[:'conversion_report_time'].nil?
1252
+
1253
+ # header parameters
1254
+ header_params = opts[:header_params] || {}
1255
+ # HTTP header 'Accept' (if needed)
1256
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1257
+
1258
+ # form parameters
1259
+ form_params = opts[:form_params] || {}
1260
+
1261
+ # http body (model)
1262
+ post_body = opts[:debug_body]
1263
+
1264
+ # return_type
1265
+ return_type = opts[:debug_return_type] || 'Array<Hash<String, Object>>'
1266
+
1267
+ # auth_names
1268
+ auth_names = opts[:debug_auth_names] || ['pinterest_oauth2']
1269
+
1270
+ new_options = opts.merge(
1271
+ :operation => :"AdAccountsApi.product_groups_analytics",
1272
+ :header_params => header_params,
1273
+ :query_params => query_params,
1274
+ :form_params => form_params,
1275
+ :body => post_body,
1276
+ :auth_names => auth_names,
1277
+ :return_type => return_type
1278
+ )
1279
+
1280
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1281
+ if @api_client.config.debugging
1282
+ @api_client.config.logger.debug "API called: AdAccountsApi#product_groups_analytics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1283
+ end
1284
+ return data, status_code, headers
1285
+ end
1286
+ end
1287
+ end