hermoso 0.1.2__py3-none-any.whl

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 (349) hide show
  1. hermoso/__init__.py +30 -0
  2. hermoso/_helpers.py +130 -0
  3. hermoso/_spec.py +5 -0
  4. hermoso/api/__init__.py +1 -0
  5. hermoso/api/account/__init__.py +1 -0
  6. hermoso/api/account/get_contact_email.py +216 -0
  7. hermoso/api/account/resend_email_verification.py +222 -0
  8. hermoso/api/analytics/__init__.py +1 -0
  9. hermoso/api/analytics/get_best_time.py +288 -0
  10. hermoso/api/analytics/get_content_decay.py +250 -0
  11. hermoso/api/analytics/get_follower_history.py +280 -0
  12. hermoso/api/analytics/get_inbox_stats.py +360 -0
  13. hermoso/api/analytics/get_posting_frequency.py +269 -0
  14. hermoso/api/brands/__init__.py +1 -0
  15. hermoso/api/brands/list_brands.py +204 -0
  16. hermoso/api/campaign_profit/__init__.py +1 -0
  17. hermoso/api/campaign_profit/get_campaign_profit.py +310 -0
  18. hermoso/api/campaign_results/__init__.py +1 -0
  19. hermoso/api/campaign_results/get_profit_settings.py +180 -0
  20. hermoso/api/campaign_results/list_campaign_results.py +215 -0
  21. hermoso/api/campaign_results/set_profit_settings.py +213 -0
  22. hermoso/api/campaign_results/upload_campaign_results.py +230 -0
  23. hermoso/api/channels/__init__.py +1 -0
  24. hermoso/api/channels/list_channels.py +200 -0
  25. hermoso/api/clones/__init__.py +1 -0
  26. hermoso/api/clones/quote_clone.py +230 -0
  27. hermoso/api/connect_links/__init__.py +1 -0
  28. hermoso/api/connect_links/create_connect_link.py +290 -0
  29. hermoso/api/connect_links/get_connect_link.py +208 -0
  30. hermoso/api/connect_links/revoke_connect_link.py +208 -0
  31. hermoso/api/connect_redirects/__init__.py +1 -0
  32. hermoso/api/connect_redirects/get_connect_redirects.py +196 -0
  33. hermoso/api/connect_redirects/set_connect_redirects.py +214 -0
  34. hermoso/api/connections/__init__.py +1 -0
  35. hermoso/api/connections/delete_connection.py +236 -0
  36. hermoso/api/connections/list_connections.py +196 -0
  37. hermoso/api/credits_/__init__.py +1 -0
  38. hermoso/api/credits_/get_credits.py +216 -0
  39. hermoso/api/edits/__init__.py +1 -0
  40. hermoso/api/edits/create_edit.py +328 -0
  41. hermoso/api/events/__init__.py +1 -0
  42. hermoso/api/events/create_conversion_destination.py +218 -0
  43. hermoso/api/events/delete_conversion_destination.py +204 -0
  44. hermoso/api/events/get_conversion_accuracy.py +227 -0
  45. hermoso/api/events/get_conversion_event.py +196 -0
  46. hermoso/api/events/get_conversion_journey.py +276 -0
  47. hermoso/api/events/get_conversion_ltv.py +227 -0
  48. hermoso/api/events/list_conversion_customers.py +242 -0
  49. hermoso/api/events/list_conversion_destinations.py +192 -0
  50. hermoso/api/events/list_conversion_events.py +332 -0
  51. hermoso/api/events/list_conversion_paths.py +242 -0
  52. hermoso/api/events/retract_conversion_event.py +228 -0
  53. hermoso/api/events/send_conversion_events.py +230 -0
  54. hermoso/api/events/update_conversion_event.py +226 -0
  55. hermoso/api/generations/__init__.py +1 -0
  56. hermoso/api/generations/create_generation.py +283 -0
  57. hermoso/api/generations/quote_generation.py +222 -0
  58. hermoso/api/jobs/__init__.py +1 -0
  59. hermoso/api/jobs/cancel_job.py +225 -0
  60. hermoso/api/jobs/get_job.py +216 -0
  61. hermoso/api/jobs/list_jobs.py +265 -0
  62. hermoso/api/library/__init__.py +1 -0
  63. hermoso/api/library/list_library.py +227 -0
  64. hermoso/api/media/__init__.py +1 -0
  65. hermoso/api/media/create_media.py +262 -0
  66. hermoso/api/media/get_media_content.py +221 -0
  67. hermoso/api/models/__init__.py +1 -0
  68. hermoso/api/models/list_models.py +239 -0
  69. hermoso/api/posts/__init__.py +1 -0
  70. hermoso/api/posts/create_post.py +242 -0
  71. hermoso/api/posts/delete_post.py +208 -0
  72. hermoso/api/posts/get_post.py +204 -0
  73. hermoso/api/posts/list_posts.py +253 -0
  74. hermoso/api/posts/update_post.py +230 -0
  75. hermoso/api/recasts/__init__.py +1 -0
  76. hermoso/api/recasts/create_recast.py +341 -0
  77. hermoso/api/signup/__init__.py +1 -0
  78. hermoso/api/signup/claim_signup.py +233 -0
  79. hermoso/api/signup/create_signup.py +233 -0
  80. hermoso/api/tag/__init__.py +1 -0
  81. hermoso/api/tag/get_tag.py +208 -0
  82. hermoso/api/tag/get_tag_report.py +276 -0
  83. hermoso/api/tag/install_tag.py +218 -0
  84. hermoso/api/tag/list_tag_audiences.py +192 -0
  85. hermoso/api/tag/list_tag_events.py +242 -0
  86. hermoso/api/tag/send_tag_events.py +222 -0
  87. hermoso/api/tag/tag_audiences.py +230 -0
  88. hermoso/api/tag/update_tag.py +238 -0
  89. hermoso/api/tools/__init__.py +1 -0
  90. hermoso/api/tools/call_tool.py +391 -0
  91. hermoso/api/tools/get_tool.py +216 -0
  92. hermoso/api/tools/list_tools.py +328 -0
  93. hermoso/client.py +280 -0
  94. hermoso/errors.py +16 -0
  95. hermoso/models/__init__.py +525 -0
  96. hermoso/models/asset.py +150 -0
  97. hermoso/models/asset_list.py +97 -0
  98. hermoso/models/asset_list_object.py +8 -0
  99. hermoso/models/asset_object.py +8 -0
  100. hermoso/models/best_time.py +165 -0
  101. hermoso/models/best_time_channels_item.py +45 -0
  102. hermoso/models/best_time_object.py +8 -0
  103. hermoso/models/best_time_overall.py +45 -0
  104. hermoso/models/best_time_slots_item.py +131 -0
  105. hermoso/models/brand.py +179 -0
  106. hermoso/models/brand_headers.py +47 -0
  107. hermoso/models/brand_list.py +97 -0
  108. hermoso/models/brand_list_object.py +8 -0
  109. hermoso/models/brand_object.py +8 -0
  110. hermoso/models/campaign_profit.py +183 -0
  111. hermoso/models/campaign_profit_object.py +8 -0
  112. hermoso/models/campaign_profit_rows_item.py +45 -0
  113. hermoso/models/campaign_profit_totals_item.py +45 -0
  114. hermoso/models/campaign_profit_unreadable_item.py +45 -0
  115. hermoso/models/campaign_results.py +151 -0
  116. hermoso/models/campaign_results_object.py +8 -0
  117. hermoso/models/campaign_results_rows_item.py +45 -0
  118. hermoso/models/campaign_results_totals.py +45 -0
  119. hermoso/models/campaign_results_upload.py +91 -0
  120. hermoso/models/campaign_results_upload_rows_item.py +136 -0
  121. hermoso/models/campaign_results_upload_rows_item_values.py +45 -0
  122. hermoso/models/channel.py +302 -0
  123. hermoso/models/channel_carousel_type_0.py +103 -0
  124. hermoso/models/channel_list.py +97 -0
  125. hermoso/models/channel_list_object.py +8 -0
  126. hermoso/models/channel_object.py +8 -0
  127. hermoso/models/clone_quote.py +157 -0
  128. hermoso/models/clone_quote_object.py +8 -0
  129. hermoso/models/clone_quote_request.py +74 -0
  130. hermoso/models/clone_quote_request_type.py +9 -0
  131. hermoso/models/clone_quote_step.py +123 -0
  132. hermoso/models/connect_link.py +322 -0
  133. hermoso/models/connect_link_account_type_0.py +116 -0
  134. hermoso/models/connect_link_create.py +95 -0
  135. hermoso/models/connect_link_error_type_0.py +71 -0
  136. hermoso/models/connect_link_object.py +8 -0
  137. hermoso/models/connect_link_status.py +14 -0
  138. hermoso/models/connect_redirects.py +83 -0
  139. hermoso/models/connect_redirects_object.py +8 -0
  140. hermoso/models/connect_redirects_set.py +65 -0
  141. hermoso/models/connection.py +156 -0
  142. hermoso/models/connection_accounts_item.py +104 -0
  143. hermoso/models/connection_deleted.py +119 -0
  144. hermoso/models/connection_deleted_object.py +8 -0
  145. hermoso/models/connection_list.py +97 -0
  146. hermoso/models/connection_list_object.py +8 -0
  147. hermoso/models/connection_object.py +8 -0
  148. hermoso/models/contact_email.py +114 -0
  149. hermoso/models/contact_email_resend.py +77 -0
  150. hermoso/models/content_decay.py +129 -0
  151. hermoso/models/content_decay_buckets_item.py +102 -0
  152. hermoso/models/content_decay_channels_item.py +45 -0
  153. hermoso/models/content_decay_object.py +8 -0
  154. hermoso/models/conversion_destination_create.py +219 -0
  155. hermoso/models/conversion_destination_create_event_map.py +45 -0
  156. hermoso/models/conversion_destination_list.py +139 -0
  157. hermoso/models/conversion_destination_list_data_item.py +45 -0
  158. hermoso/models/conversion_destination_list_object.py +8 -0
  159. hermoso/models/conversion_destination_list_platforms_item.py +45 -0
  160. hermoso/models/conversion_destination_result.py +116 -0
  161. hermoso/models/conversion_destination_result_destination.py +45 -0
  162. hermoso/models/conversion_destination_result_object.py +8 -0
  163. hermoso/models/conversion_event_list.py +136 -0
  164. hermoso/models/conversion_event_list_data_item.py +45 -0
  165. hermoso/models/conversion_event_list_object.py +8 -0
  166. hermoso/models/conversion_event_update.py +82 -0
  167. hermoso/models/conversion_events_send.py +139 -0
  168. hermoso/models/conversion_events_send_events_item.py +237 -0
  169. hermoso/models/conversion_events_send_events_item_campaign.py +45 -0
  170. hermoso/models/conversion_events_send_events_item_consent.py +45 -0
  171. hermoso/models/conversion_events_send_events_item_items_item.py +45 -0
  172. hermoso/models/conversion_events_send_events_item_user.py +51 -0
  173. hermoso/models/conversion_insights.py +218 -0
  174. hermoso/models/conversion_insights_cohorts_item.py +45 -0
  175. hermoso/models/conversion_insights_customers_item.py +45 -0
  176. hermoso/models/conversion_insights_destinations_item.py +45 -0
  177. hermoso/models/conversion_insights_journey.py +45 -0
  178. hermoso/models/conversion_insights_object.py +8 -0
  179. hermoso/models/conversion_insights_paths_item.py +45 -0
  180. hermoso/models/conversion_send_result.py +169 -0
  181. hermoso/models/conversion_send_result_destinations_item.py +233 -0
  182. hermoso/models/conversion_send_result_destinations_item_failures_item.py +45 -0
  183. hermoso/models/conversion_send_result_destinations_item_mode.py +11 -0
  184. hermoso/models/conversion_send_result_destinations_item_skipped_item.py +45 -0
  185. hermoso/models/conversion_send_result_object.py +8 -0
  186. hermoso/models/credits_.py +161 -0
  187. hermoso/models/credits_limits_type_0.py +131 -0
  188. hermoso/models/credits_limits_type_0_brands_item.py +175 -0
  189. hermoso/models/credits_limits_type_0_brands_item_members_item.py +133 -0
  190. hermoso/models/credits_limits_type_0_timezone.py +8 -0
  191. hermoso/models/credits_object.py +8 -0
  192. hermoso/models/deleted.py +89 -0
  193. hermoso/models/deleted_object.py +8 -0
  194. hermoso/models/edit.py +225 -0
  195. hermoso/models/edit_create.py +161 -0
  196. hermoso/models/edit_create_lighting.py +10 -0
  197. hermoso/models/edit_mode.py +9 -0
  198. hermoso/models/edit_object.py +8 -0
  199. hermoso/models/edit_preview_type_0.py +156 -0
  200. hermoso/models/edit_quote.py +154 -0
  201. hermoso/models/edit_quote_object.py +8 -0
  202. hermoso/models/error.py +115 -0
  203. hermoso/models/error_error.py +183 -0
  204. hermoso/models/error_error_type.py +14 -0
  205. hermoso/models/error_error_unknown_arguments_item.py +84 -0
  206. hermoso/models/follower_history.py +144 -0
  207. hermoso/models/follower_history_accounts_item.py +176 -0
  208. hermoso/models/follower_history_accounts_item_points_item.py +93 -0
  209. hermoso/models/follower_history_date_range.py +71 -0
  210. hermoso/models/follower_history_object.py +8 -0
  211. hermoso/models/generation_create.py +219 -0
  212. hermoso/models/generation_create_background.py +8 -0
  213. hermoso/models/generation_create_complexity.py +10 -0
  214. hermoso/models/generation_create_format.py +10 -0
  215. hermoso/models/generation_create_type.py +9 -0
  216. hermoso/models/generation_quote.py +196 -0
  217. hermoso/models/generation_quote_object.py +8 -0
  218. hermoso/models/hermoso_tag.py +128 -0
  219. hermoso/models/hermoso_tag_audience_action.py +205 -0
  220. hermoso/models/hermoso_tag_audience_action_action.py +11 -0
  221. hermoso/models/hermoso_tag_audience_action_platform.py +12 -0
  222. hermoso/models/hermoso_tag_audiences.py +148 -0
  223. hermoso/models/hermoso_tag_audiences_object.py +8 -0
  224. hermoso/models/hermoso_tag_audiences_segment.py +45 -0
  225. hermoso/models/hermoso_tag_audiences_segments_item.py +45 -0
  226. hermoso/models/hermoso_tag_events.py +124 -0
  227. hermoso/models/hermoso_tag_events_data_item.py +45 -0
  228. hermoso/models/hermoso_tag_events_object.py +8 -0
  229. hermoso/models/hermoso_tag_events_send.py +80 -0
  230. hermoso/models/hermoso_tag_events_send_events_item.py +45 -0
  231. hermoso/models/hermoso_tag_events_sent.py +121 -0
  232. hermoso/models/hermoso_tag_events_sent_object.py +8 -0
  233. hermoso/models/hermoso_tag_events_sent_refused_item.py +45 -0
  234. hermoso/models/hermoso_tag_events_status.py +45 -0
  235. hermoso/models/hermoso_tag_install.py +125 -0
  236. hermoso/models/hermoso_tag_install_result.py +134 -0
  237. hermoso/models/hermoso_tag_install_result_object.py +8 -0
  238. hermoso/models/hermoso_tag_install_site.py +11 -0
  239. hermoso/models/hermoso_tag_object.py +8 -0
  240. hermoso/models/hermoso_tag_page.py +45 -0
  241. hermoso/models/hermoso_tag_report.py +169 -0
  242. hermoso/models/hermoso_tag_report_object.py +8 -0
  243. hermoso/models/hermoso_tag_report_rows_item.py +45 -0
  244. hermoso/models/hermoso_tag_report_status.py +45 -0
  245. hermoso/models/hermoso_tag_report_totals.py +45 -0
  246. hermoso/models/hermoso_tag_tag.py +143 -0
  247. hermoso/models/hermoso_tag_tag_installs_item.py +45 -0
  248. hermoso/models/hermoso_tag_tag_settings.py +45 -0
  249. hermoso/models/hermoso_tag_tag_status.py +45 -0
  250. hermoso/models/hermoso_tag_update.py +271 -0
  251. hermoso/models/hermoso_tag_update_action.py +11 -0
  252. hermoso/models/hermoso_tag_update_auto_track.py +45 -0
  253. hermoso/models/hermoso_tag_update_consent_default.py +9 -0
  254. hermoso/models/hermoso_tag_update_conversions.py +45 -0
  255. hermoso/models/inbox_stats.py +293 -0
  256. hermoso/models/inbox_stats_by_platform_item.py +45 -0
  257. hermoso/models/inbox_stats_conversations.py +45 -0
  258. hermoso/models/inbox_stats_coverage.py +45 -0
  259. hermoso/models/inbox_stats_heatmap.py +45 -0
  260. hermoso/models/inbox_stats_object.py +8 -0
  261. hermoso/models/inbox_stats_response_time.py +45 -0
  262. hermoso/models/inbox_stats_summary.py +45 -0
  263. hermoso/models/inbox_stats_timeseries_item.py +45 -0
  264. hermoso/models/inbox_stats_top_accounts_item.py +45 -0
  265. hermoso/models/inbox_stats_waiting.py +45 -0
  266. hermoso/models/job.py +358 -0
  267. hermoso/models/job_cancel.py +113 -0
  268. hermoso/models/job_cancel_object.py +8 -0
  269. hermoso/models/job_list.py +136 -0
  270. hermoso/models/job_list_object.py +8 -0
  271. hermoso/models/job_object.py +8 -0
  272. hermoso/models/job_result_type_0.py +50 -0
  273. hermoso/models/media.py +119 -0
  274. hermoso/models/media_object.py +8 -0
  275. hermoso/models/model.py +322 -0
  276. hermoso/models/model_credits_by_duration_type_0.py +45 -0
  277. hermoso/models/model_credits_by_size_type_0.py +45 -0
  278. hermoso/models/model_list.py +97 -0
  279. hermoso/models/model_list_object.py +8 -0
  280. hermoso/models/model_object.py +8 -0
  281. hermoso/models/post.py +447 -0
  282. hermoso/models/post_captions_by_channel_type_0.py +45 -0
  283. hermoso/models/post_create.py +283 -0
  284. hermoso/models/post_create_captions_by_channel.py +47 -0
  285. hermoso/models/post_create_media_item_type_1.py +80 -0
  286. hermoso/models/post_create_media_item_type_1_type.py +9 -0
  287. hermoso/models/post_create_options.py +51 -0
  288. hermoso/models/post_create_targets.py +50 -0
  289. hermoso/models/post_create_visibility_by_channel.py +45 -0
  290. hermoso/models/post_list.py +127 -0
  291. hermoso/models/post_list_object.py +8 -0
  292. hermoso/models/post_media_item.py +71 -0
  293. hermoso/models/post_object.py +8 -0
  294. hermoso/models/post_options.py +45 -0
  295. hermoso/models/post_results_type_0_item.py +160 -0
  296. hermoso/models/post_results_type_0_item_first_comment.py +116 -0
  297. hermoso/models/post_targets.py +50 -0
  298. hermoso/models/post_update.py +47 -0
  299. hermoso/models/post_visibility_by_channel_type_0.py +45 -0
  300. hermoso/models/posting_frequency.py +155 -0
  301. hermoso/models/posting_frequency_channels_item.py +45 -0
  302. hermoso/models/posting_frequency_frequency_item.py +146 -0
  303. hermoso/models/posting_frequency_object.py +8 -0
  304. hermoso/models/profit_settings.py +146 -0
  305. hermoso/models/profit_settings_campaign_margins.py +45 -0
  306. hermoso/models/profit_settings_object.py +8 -0
  307. hermoso/models/recast.py +339 -0
  308. hermoso/models/recast_create.py +149 -0
  309. hermoso/models/recast_object.py +8 -0
  310. hermoso/models/recast_person.py +86 -0
  311. hermoso/models/recast_quote.py +159 -0
  312. hermoso/models/recast_quote_object.py +8 -0
  313. hermoso/models/recast_step.py +124 -0
  314. hermoso/models/recast_subject_type_0.py +85 -0
  315. hermoso/models/recast_voice_type_0.py +93 -0
  316. hermoso/models/recast_window_type_0.py +81 -0
  317. hermoso/models/signup.py +278 -0
  318. hermoso/models/signup_claim.py +62 -0
  319. hermoso/models/signup_create.py +96 -0
  320. hermoso/models/signup_create_period.py +9 -0
  321. hermoso/models/signup_object.py +8 -0
  322. hermoso/models/signup_period.py +9 -0
  323. hermoso/models/signup_status.py +9 -0
  324. hermoso/models/tool.py +334 -0
  325. hermoso/models/tool_call.py +50 -0
  326. hermoso/models/tool_input_schema.py +47 -0
  327. hermoso/models/tool_invoke.py +71 -0
  328. hermoso/models/tool_job.py +135 -0
  329. hermoso/models/tool_job_object.py +8 -0
  330. hermoso/models/tool_list.py +226 -0
  331. hermoso/models/tool_list_areas_item.py +98 -0
  332. hermoso/models/tool_list_areas_item_object.py +8 -0
  333. hermoso/models/tool_list_object.py +8 -0
  334. hermoso/models/tool_list_search_type_0.py +96 -0
  335. hermoso/models/tool_object.py +8 -0
  336. hermoso/models/tool_rate_class.py +9 -0
  337. hermoso/models/tool_result.py +184 -0
  338. hermoso/models/tool_result_data_type_0.py +50 -0
  339. hermoso/models/tool_result_ignored_arguments_item.py +84 -0
  340. hermoso/models/tool_result_images_item.py +71 -0
  341. hermoso/models/tool_result_object.py +8 -0
  342. hermoso/models/warning.py +133 -0
  343. hermoso/models/warning_in.py +9 -0
  344. hermoso/py.typed +0 -0
  345. hermoso/types.py +54 -0
  346. hermoso-0.1.2.dist-info/METADATA +108 -0
  347. hermoso-0.1.2.dist-info/RECORD +349 -0
  348. hermoso-0.1.2.dist-info/WHEEL +4 -0
  349. hermoso-0.1.2.dist-info/licenses/LICENSE +21 -0
hermoso/__init__.py ADDED
@@ -0,0 +1,30 @@
1
+ """Hermoso: the typed Python client for the Hermoso API (https://hermoso.ai/docs/sdks/).
2
+
3
+ Everything except this file and ``_helpers.py`` is generated from the /v1 OpenAPI document. Each operation lives in
4
+ ``hermoso.api.<group>.<operation>`` with ``sync``, ``sync_detailed``, ``asyncio`` and ``asyncio_detailed``; the typed
5
+ request and response models are in ``hermoso.models``.
6
+ """
7
+
8
+ from ._helpers import DEFAULT_BASE_URL, HermosoError, create_client, paginate, run_tool, wait_for_job
9
+ from ._spec import CONTRACT_VERSION, SPEC_SHA256
10
+ from .client import AuthenticatedClient, Client
11
+
12
+ try:
13
+ from importlib.metadata import version as _version
14
+
15
+ __version__ = _version("hermoso")
16
+ except Exception: # pragma: no cover - running from a source tree
17
+ __version__ = "0+unknown"
18
+
19
+ __all__ = (
20
+ "AuthenticatedClient",
21
+ "Client",
22
+ "CONTRACT_VERSION",
23
+ "DEFAULT_BASE_URL",
24
+ "HermosoError",
25
+ "SPEC_SHA256",
26
+ "create_client",
27
+ "paginate",
28
+ "run_tool",
29
+ "wait_for_job",
30
+ )
hermoso/_helpers.py ADDED
@@ -0,0 +1,130 @@
1
+ """The small hand-written layer over the generated client: a client that reads your key, a cursor paginator, a job
2
+ waiter and a one-line tool call. Not generated; tools/sdk-generate.mjs copies it into the package."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import os
7
+ import time
8
+ from collections.abc import Iterator
9
+ from types import ModuleType
10
+ from typing import Any
11
+
12
+ from .client import AuthenticatedClient
13
+ from .models.error import Error
14
+ from .types import Unset
15
+
16
+ DEFAULT_BASE_URL = "https://app.hermoso.ai"
17
+
18
+
19
+ class HermosoError(Exception):
20
+ """An error answer from the API. ``error`` is the parsed ``Error`` model (``error.error.code``, ``.message``)."""
21
+
22
+ def __init__(self, error: Any, status: int | None = None) -> None:
23
+ detail = getattr(getattr(error, "error", None), "message", None)
24
+ super().__init__(detail or f"Hermoso API error{f' (HTTP {status})' if status else ''}")
25
+ self.error = error
26
+ self.status = status
27
+
28
+
29
+ def create_client(
30
+ api_key: str | None = None,
31
+ *,
32
+ brand: str | None = None,
33
+ base_url: str = DEFAULT_BASE_URL,
34
+ timeout: float = 90.0,
35
+ ) -> AuthenticatedClient:
36
+ """A client authenticated with your API key (default: the HERMOSO_API_KEY environment variable).
37
+
38
+ ``brand`` acts on that brand (an ``id`` from ``list_brands``) instead of the one the key is pinned to.
39
+ """
40
+ key = api_key or os.environ.get("HERMOSO_API_KEY")
41
+ if not key:
42
+ raise ValueError(
43
+ "No Hermoso API key: pass api_key or set HERMOSO_API_KEY. Create one at https://app.hermoso.ai "
44
+ 'on the "API, MCP & CLI" tab, under "Terminal & API keys".'
45
+ )
46
+ import httpx2
47
+
48
+ return AuthenticatedClient(
49
+ base_url=base_url,
50
+ token=key,
51
+ headers={"X-Hermoso-User": brand} if brand else {},
52
+ timeout=httpx2.Timeout(timeout),
53
+ )
54
+
55
+
56
+ def _value(obj: Any, name: str) -> Any:
57
+ v = getattr(obj, name, None)
58
+ return None if isinstance(v, Unset) else v
59
+
60
+
61
+ def paginate(operation: ModuleType, *, client: AuthenticatedClient, **params: Any) -> Iterator[Any]:
62
+ """Iterate every item of a cursor-paginated list, following ``next_cursor`` until ``has_more`` is false.
63
+
64
+ ``operation`` is the generated module, e.g. ``hermoso.api.posts.list_posts``::
65
+
66
+ for post in paginate(list_posts, client=client, status="scheduled"):
67
+ print(post.id, post.status)
68
+ """
69
+ cursor_param = "cursor" if operation.__name__.endswith("list_conversion_events") else "starting_after"
70
+ cursor = None
71
+ while True:
72
+ if cursor:
73
+ params[cursor_param] = cursor
74
+ res = operation.sync_detailed(client=client, **params)
75
+ page = res.parsed
76
+ if page is None or isinstance(page, Error):
77
+ raise HermosoError(page, int(res.status_code))
78
+ yield from (_value(page, "data") or [])
79
+ cursor = _value(page, "next_cursor")
80
+ if not cursor or _value(page, "has_more") is False:
81
+ return
82
+
83
+
84
+ def wait_for_job(job_id: str, *, client: AuthenticatedClient, interval: float = 5.0, timeout: float = 1200.0) -> Any:
85
+ """Poll a job (a render, a stitch, an upscale…) until it is ``done`` or ``error`` and return it; the file is
86
+ ``job.url``. Polling is free; calling the tool again would start (and bill) a second render."""
87
+ from .api.jobs import get_job
88
+
89
+ deadline = time.monotonic() + timeout
90
+ while True:
91
+ res = get_job.sync_detailed(job_id, client=client)
92
+ job = res.parsed
93
+ if job is None or isinstance(job, Error):
94
+ raise HermosoError(job, int(res.status_code))
95
+ if job.status in ("done", "error"):
96
+ return job
97
+ if time.monotonic() > deadline:
98
+ raise TimeoutError(f"Job {job_id} is still {job.status}; it keeps running, call wait_for_job again.")
99
+ time.sleep(interval)
100
+
101
+
102
+ def run_tool(
103
+ name: str,
104
+ args: dict[str, Any] | None = None,
105
+ *,
106
+ client: AuthenticatedClient,
107
+ wait: int | None = None,
108
+ idempotency_key: str | None = None,
109
+ ) -> Any:
110
+ """Run any Hermoso tool through ``POST /v1/tools/{name}`` and return its result (a ``ToolResult``, or a ``ToolJob``
111
+ handle when it started a render: pass ``job_id`` to ``wait_for_job``). ``GET /v1/tools/{name}`` describes each
112
+ tool's arguments::
113
+
114
+ plan = run_tool("plan_ad", {"product": "our cold brew, summer offer", "format": "video"}, client=client)
115
+ """
116
+ from .api.tools import call_tool
117
+ from .models.tool_call import ToolCall
118
+ from .types import UNSET
119
+
120
+ res = call_tool.sync_detailed(
121
+ name,
122
+ client=client,
123
+ body=ToolCall.from_dict(args or {}),
124
+ wait=UNSET if wait is None else str(wait),
125
+ idempotency_key=idempotency_key or UNSET,
126
+ )
127
+ out = res.parsed
128
+ if out is None or isinstance(out, Error):
129
+ raise HermosoError(out, int(res.status_code))
130
+ return out
hermoso/_spec.py ADDED
@@ -0,0 +1,5 @@
1
+ # Generated by tools/sdk-generate.mjs. Do not edit.
2
+ SPEC_SHA256 = "9a8d4c6c56dfc4fb3785238ce4c254f2d439297c6815ab59cd023d8337d20a3f"
3
+ """sha256 of the OpenAPI document this client was generated from (sdks/openapi.json)."""
4
+ CONTRACT_VERSION = "2026-08-26"
5
+ """The dated /v1 contract version that document describes."""
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,216 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx2
5
+
6
+ from ...client import AuthenticatedClient, Client
7
+ from ...types import Response, UNSET
8
+ from ... import errors
9
+
10
+ from ...models.contact_email import ContactEmail
11
+ from ...models.error import Error
12
+ from ...types import Unset
13
+
14
+
15
+ def _get_kwargs(
16
+ *,
17
+ idempotency_key: str | Unset = UNSET,
18
+ x_hermoso_user: str | Unset = UNSET,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+ if not isinstance(idempotency_key, Unset):
22
+ headers["Idempotency-Key"] = idempotency_key
23
+
24
+ if not isinstance(x_hermoso_user, Unset):
25
+ headers["X-Hermoso-User"] = x_hermoso_user
26
+
27
+ _kwargs: dict[str, Any] = {
28
+ "method": "get",
29
+ "url": "/v1/account/email",
30
+ }
31
+
32
+ _kwargs["headers"] = headers
33
+ return _kwargs
34
+
35
+
36
+ def _parse_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
38
+ ) -> ContactEmail | Error | None:
39
+ if response.status_code == 200:
40
+ response_200 = ContactEmail.from_dict(response.json())
41
+
42
+ return response_200
43
+
44
+ if response.status_code == 400:
45
+ response_400 = Error.from_dict(response.json())
46
+
47
+ return response_400
48
+
49
+ if response.status_code == 401:
50
+ response_401 = Error.from_dict(response.json())
51
+
52
+ return response_401
53
+
54
+ if response.status_code == 404:
55
+ response_404 = Error.from_dict(response.json())
56
+
57
+ return response_404
58
+
59
+ if response.status_code == 429:
60
+ response_429 = Error.from_dict(response.json())
61
+
62
+ return response_429
63
+
64
+ if client.raise_on_unexpected_status:
65
+ raise errors.UnexpectedStatus(response.status_code, response.content)
66
+ else:
67
+ return None
68
+
69
+
70
+ def _build_response(
71
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
72
+ ) -> Response[ContactEmail | Error]:
73
+ return Response(
74
+ status_code=HTTPStatus(response.status_code),
75
+ content=response.content,
76
+ headers=response.headers,
77
+ parsed=_parse_response(client=client, response=response),
78
+ )
79
+
80
+
81
+ def sync_detailed(
82
+ *,
83
+ client: AuthenticatedClient,
84
+ idempotency_key: str | Unset = UNSET,
85
+ x_hermoso_user: str | Unset = UNSET,
86
+ ) -> Response[ContactEmail | Error]:
87
+ """Retrieve the contact email and whether it is verified
88
+
89
+ The mailbox named at signup and whether its verification link has been clicked. The account works
90
+ either way; a verified address is where receipts, low-credit alerts and replies to bug reports go.
91
+ The address is NEVER the account identity and can never be used to sign in to, link, or merge
92
+ accounts.
93
+
94
+ Args:
95
+ idempotency_key (str | Unset):
96
+ x_hermoso_user (str | Unset):
97
+
98
+ Raises:
99
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
100
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
101
+
102
+ Returns:
103
+ Response[ContactEmail | Error]
104
+ """
105
+
106
+ kwargs = _get_kwargs(
107
+ idempotency_key=idempotency_key,
108
+ x_hermoso_user=x_hermoso_user,
109
+ )
110
+
111
+ response = client.get_httpx_client().request(
112
+ **kwargs,
113
+ )
114
+
115
+ return _build_response(client=client, response=response)
116
+
117
+
118
+ def sync(
119
+ *,
120
+ client: AuthenticatedClient,
121
+ idempotency_key: str | Unset = UNSET,
122
+ x_hermoso_user: str | Unset = UNSET,
123
+ ) -> ContactEmail | Error | None:
124
+ """Retrieve the contact email and whether it is verified
125
+
126
+ The mailbox named at signup and whether its verification link has been clicked. The account works
127
+ either way; a verified address is where receipts, low-credit alerts and replies to bug reports go.
128
+ The address is NEVER the account identity and can never be used to sign in to, link, or merge
129
+ accounts.
130
+
131
+ Args:
132
+ idempotency_key (str | Unset):
133
+ x_hermoso_user (str | Unset):
134
+
135
+ Raises:
136
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
137
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
138
+
139
+ Returns:
140
+ ContactEmail | Error
141
+ """
142
+
143
+ return sync_detailed(
144
+ client=client,
145
+ idempotency_key=idempotency_key,
146
+ x_hermoso_user=x_hermoso_user,
147
+ ).parsed
148
+
149
+
150
+ async def asyncio_detailed(
151
+ *,
152
+ client: AuthenticatedClient,
153
+ idempotency_key: str | Unset = UNSET,
154
+ x_hermoso_user: str | Unset = UNSET,
155
+ ) -> Response[ContactEmail | Error]:
156
+ """Retrieve the contact email and whether it is verified
157
+
158
+ The mailbox named at signup and whether its verification link has been clicked. The account works
159
+ either way; a verified address is where receipts, low-credit alerts and replies to bug reports go.
160
+ The address is NEVER the account identity and can never be used to sign in to, link, or merge
161
+ accounts.
162
+
163
+ Args:
164
+ idempotency_key (str | Unset):
165
+ x_hermoso_user (str | Unset):
166
+
167
+ Raises:
168
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
169
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
170
+
171
+ Returns:
172
+ Response[ContactEmail | Error]
173
+ """
174
+
175
+ kwargs = _get_kwargs(
176
+ idempotency_key=idempotency_key,
177
+ x_hermoso_user=x_hermoso_user,
178
+ )
179
+
180
+ response = await client.get_async_httpx_client().request(**kwargs)
181
+
182
+ return _build_response(client=client, response=response)
183
+
184
+
185
+ async def asyncio(
186
+ *,
187
+ client: AuthenticatedClient,
188
+ idempotency_key: str | Unset = UNSET,
189
+ x_hermoso_user: str | Unset = UNSET,
190
+ ) -> ContactEmail | Error | None:
191
+ """Retrieve the contact email and whether it is verified
192
+
193
+ The mailbox named at signup and whether its verification link has been clicked. The account works
194
+ either way; a verified address is where receipts, low-credit alerts and replies to bug reports go.
195
+ The address is NEVER the account identity and can never be used to sign in to, link, or merge
196
+ accounts.
197
+
198
+ Args:
199
+ idempotency_key (str | Unset):
200
+ x_hermoso_user (str | Unset):
201
+
202
+ Raises:
203
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
204
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
205
+
206
+ Returns:
207
+ ContactEmail | Error
208
+ """
209
+
210
+ return (
211
+ await asyncio_detailed(
212
+ client=client,
213
+ idempotency_key=idempotency_key,
214
+ x_hermoso_user=x_hermoso_user,
215
+ )
216
+ ).parsed
@@ -0,0 +1,222 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx2
5
+
6
+ from ...client import AuthenticatedClient, Client
7
+ from ...types import Response, UNSET
8
+ from ... import errors
9
+
10
+ from ...models.contact_email import ContactEmail
11
+ from ...models.contact_email_resend import ContactEmailResend
12
+ from ...models.error import Error
13
+ from ...types import Unset
14
+
15
+
16
+ def _get_kwargs(
17
+ *,
18
+ body: ContactEmailResend,
19
+ x_hermoso_user: str | Unset = UNSET,
20
+ ) -> dict[str, Any]:
21
+ headers: dict[str, Any] = {}
22
+ if not isinstance(x_hermoso_user, Unset):
23
+ headers["X-Hermoso-User"] = x_hermoso_user
24
+
25
+ _kwargs: dict[str, Any] = {
26
+ "method": "post",
27
+ "url": "/v1/account/email/resend",
28
+ }
29
+
30
+ _kwargs["json"] = body.to_dict()
31
+
32
+ headers["Content-Type"] = "application/json"
33
+
34
+ _kwargs["headers"] = headers
35
+ return _kwargs
36
+
37
+
38
+ def _parse_response(
39
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
40
+ ) -> ContactEmail | Error | None:
41
+ if response.status_code == 200:
42
+ response_200 = ContactEmail.from_dict(response.json())
43
+
44
+ return response_200
45
+
46
+ if response.status_code == 400:
47
+ response_400 = Error.from_dict(response.json())
48
+
49
+ return response_400
50
+
51
+ if response.status_code == 401:
52
+ response_401 = Error.from_dict(response.json())
53
+
54
+ return response_401
55
+
56
+ if response.status_code == 404:
57
+ response_404 = Error.from_dict(response.json())
58
+
59
+ return response_404
60
+
61
+ if response.status_code == 429:
62
+ response_429 = Error.from_dict(response.json())
63
+
64
+ return response_429
65
+
66
+ if client.raise_on_unexpected_status:
67
+ raise errors.UnexpectedStatus(response.status_code, response.content)
68
+ else:
69
+ return None
70
+
71
+
72
+ def _build_response(
73
+ *, client: AuthenticatedClient | Client, response: httpx2.Response
74
+ ) -> Response[ContactEmail | Error]:
75
+ return Response(
76
+ status_code=HTTPStatus(response.status_code),
77
+ content=response.content,
78
+ headers=response.headers,
79
+ parsed=_parse_response(client=client, response=response),
80
+ )
81
+
82
+
83
+ def sync_detailed(
84
+ *,
85
+ client: AuthenticatedClient,
86
+ body: ContactEmailResend,
87
+ x_hermoso_user: str | Unset = UNSET,
88
+ ) -> Response[ContactEmail | Error]:
89
+ """Re-send the verification link, or set a different contact email
90
+
91
+ With no body, re-sends the verification link to the current contact address (at most once every 10
92
+ minutes — 429 `verification_recently_sent` otherwise). With `email`, replaces the contact address
93
+ and starts verification over for the new one. An address that is already the sign-in email of
94
+ another Hermoso account cannot be verified here (409 `email_in_use` when the link is clicked) and
95
+ this account stays exactly as it is.
96
+
97
+ Args:
98
+ x_hermoso_user (str | Unset):
99
+ body (ContactEmailResend):
100
+
101
+ Raises:
102
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
103
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
104
+
105
+ Returns:
106
+ Response[ContactEmail | Error]
107
+ """
108
+
109
+ kwargs = _get_kwargs(
110
+ body=body,
111
+ x_hermoso_user=x_hermoso_user,
112
+ )
113
+
114
+ response = client.get_httpx_client().request(
115
+ **kwargs,
116
+ )
117
+
118
+ return _build_response(client=client, response=response)
119
+
120
+
121
+ def sync(
122
+ *,
123
+ client: AuthenticatedClient,
124
+ body: ContactEmailResend,
125
+ x_hermoso_user: str | Unset = UNSET,
126
+ ) -> ContactEmail | Error | None:
127
+ """Re-send the verification link, or set a different contact email
128
+
129
+ With no body, re-sends the verification link to the current contact address (at most once every 10
130
+ minutes — 429 `verification_recently_sent` otherwise). With `email`, replaces the contact address
131
+ and starts verification over for the new one. An address that is already the sign-in email of
132
+ another Hermoso account cannot be verified here (409 `email_in_use` when the link is clicked) and
133
+ this account stays exactly as it is.
134
+
135
+ Args:
136
+ x_hermoso_user (str | Unset):
137
+ body (ContactEmailResend):
138
+
139
+ Raises:
140
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
141
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
142
+
143
+ Returns:
144
+ ContactEmail | Error
145
+ """
146
+
147
+ return sync_detailed(
148
+ client=client,
149
+ body=body,
150
+ x_hermoso_user=x_hermoso_user,
151
+ ).parsed
152
+
153
+
154
+ async def asyncio_detailed(
155
+ *,
156
+ client: AuthenticatedClient,
157
+ body: ContactEmailResend,
158
+ x_hermoso_user: str | Unset = UNSET,
159
+ ) -> Response[ContactEmail | Error]:
160
+ """Re-send the verification link, or set a different contact email
161
+
162
+ With no body, re-sends the verification link to the current contact address (at most once every 10
163
+ minutes — 429 `verification_recently_sent` otherwise). With `email`, replaces the contact address
164
+ and starts verification over for the new one. An address that is already the sign-in email of
165
+ another Hermoso account cannot be verified here (409 `email_in_use` when the link is clicked) and
166
+ this account stays exactly as it is.
167
+
168
+ Args:
169
+ x_hermoso_user (str | Unset):
170
+ body (ContactEmailResend):
171
+
172
+ Raises:
173
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
174
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
175
+
176
+ Returns:
177
+ Response[ContactEmail | Error]
178
+ """
179
+
180
+ kwargs = _get_kwargs(
181
+ body=body,
182
+ x_hermoso_user=x_hermoso_user,
183
+ )
184
+
185
+ response = await client.get_async_httpx_client().request(**kwargs)
186
+
187
+ return _build_response(client=client, response=response)
188
+
189
+
190
+ async def asyncio(
191
+ *,
192
+ client: AuthenticatedClient,
193
+ body: ContactEmailResend,
194
+ x_hermoso_user: str | Unset = UNSET,
195
+ ) -> ContactEmail | Error | None:
196
+ """Re-send the verification link, or set a different contact email
197
+
198
+ With no body, re-sends the verification link to the current contact address (at most once every 10
199
+ minutes — 429 `verification_recently_sent` otherwise). With `email`, replaces the contact address
200
+ and starts verification over for the new one. An address that is already the sign-in email of
201
+ another Hermoso account cannot be verified here (409 `email_in_use` when the link is clicked) and
202
+ this account stays exactly as it is.
203
+
204
+ Args:
205
+ x_hermoso_user (str | Unset):
206
+ body (ContactEmailResend):
207
+
208
+ Raises:
209
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
210
+ httpx2.TimeoutException: If the request takes longer than Client.timeout.
211
+
212
+ Returns:
213
+ ContactEmail | Error
214
+ """
215
+
216
+ return (
217
+ await asyncio_detailed(
218
+ client=client,
219
+ body=body,
220
+ x_hermoso_user=x_hermoso_user,
221
+ )
222
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""