From ebffc9db61926741ca83c28f0641e1d0f36da2ab Mon Sep 17 00:00:00 2001 From: Ali Asadi Date: Sun, 7 Jun 2026 11:34:17 +0330 Subject: [PATCH] add advertising client --- utils/advertising_client.py | 103 ++ .../gooyal_advertising_client/__init__.py | 8 + .../gooyal_advertising_client/api/__init__.py | 1 + .../api/api/__init__.py | 1 + .../api/api/api_config_list.py | 170 +++ .../api/api/api_status_retrieve.py | 78 ++ .../api/crm/__init__.py | 1 + .../api/crm/crm_application_tickets_create.py | 151 +++ .../crm/crm_application_tickets_destroy.py | 92 ++ .../api/crm/crm_application_tickets_list.py | 170 +++ .../crm_application_tickets_partial_update.py | 165 +++ .../crm/crm_application_tickets_retrieve.py | 143 ++ .../api/crm/crm_application_tickets_update.py | 164 +++ .../api/crm/crm_tickets_create.py | 151 +++ .../api/crm/crm_tickets_destroy.py | 92 ++ .../api/crm/crm_tickets_list.py | 170 +++ .../api/crm/crm_tickets_partial_update.py | 165 +++ .../api/crm/crm_tickets_retrieve.py | 143 ++ .../api/crm/crm_tickets_update.py | 164 +++ .../api/stores/__init__.py | 1 + .../api/stores/stores_ads_bookmarked_list.py | 445 +++++++ .../api/stores/stores_ads_clusterized_list.py | 420 ++++++ .../api/stores/stores_ads_list.py | 445 +++++++ .../stores_ads_public_clusterized_list.py | 420 ++++++ .../api/stores/stores_ads_public_list_list.py | 445 +++++++ .../stores_ads_public_retrieve_retrieve.py | 144 ++ .../api/stores/stores_ads_react_create.py | 165 +++ .../api/stores/stores_ads_report_create.py | 165 +++ .../api/stores/stores_ads_retrieve.py | 144 ++ .../api/stores/stores_ads_visited_list.py | 445 +++++++ .../api/stores/stores_ads_with_visits_list.py | 445 +++++++ .../api/stores/stores_comments_create.py | 151 +++ .../api/stores/stores_comments_list.py | 207 +++ .../stores/stores_comments_react_create.py | 168 +++ .../stores/stores_comments_reply_create.py | 164 +++ .../api/stores/stores_config_list.py | 170 +++ .../stores/stores_my_ads_capture_create.py | 165 +++ ...stores_my_ads_capturing_detail_retrieve.py | 144 ++ .../stores/stores_my_ads_contents_create.py | 165 +++ .../api/stores/stores_my_ads_contents_list.py | 184 +++ .../api/stores/stores_my_ads_create.py | 151 +++ .../api/stores/stores_my_ads_destroy.py | 93 ++ .../api/stores/stores_my_ads_list.py | 373 ++++++ .../stores/stores_my_ads_partial_update.py | 166 +++ .../api/stores/stores_my_ads_pay_create.py | 165 +++ .../api/stores/stores_my_ads_pay_retrieve.py | 144 ++ .../stores_my_ads_refined_banner_destroy.py | 100 ++ .../stores_my_ads_refined_contents_create.py | 169 +++ .../stores_my_ads_refined_contents_destroy.py | 100 ++ .../stores_my_ads_refined_contents_list.py | 184 +++ .../api/stores/stores_my_ads_retrieve.py | 144 ++ .../stores_my_ads_statistic_retrieve.py | 144 ++ .../api/stores/stores_my_ads_stop_retrieve.py | 144 ++ .../api/stores/stores_my_ads_update.py | 165 +++ .../api/stores/stores_statistic_retrieve.py | 154 +++ .../api/stores/stores_tags_list.py | 185 +++ .../api/stores/stores_tags_retrieve.py | 143 ++ .../stores/stores_uploads_presign_create.py | 151 +++ .../api/stores/stores_visits_create.py | 151 +++ .../api/stores/stores_visits_finish_create.py | 164 +++ .../stores/stores_visits_interact_create.py | 168 +++ .../api/stores/stores_visits_list.py | 170 +++ .../api/stores/stores_visits_react_create.py | 164 +++ .../api/stores/stores_visits_retrieve.py | 143 ++ .../api/stores/stores_visits_start_create.py | 151 +++ .../stores/stores_zones_check_in_create.py | 151 +++ .../stores_zones_is_checked_in_create.py | 151 +++ .../api/stores/stores_zones_list.py | 230 ++++ .../api/stores/stores_zones_status_create.py | 151 +++ .../api/suggestions/__init__.py | 1 + .../suggestions/suggestions_suggest_list.py | 170 +++ .../api/users/__init__.py | 1 + .../api/users/users_users_ban_create.py | 151 +++ .../api/users/users_users_ban_retrieve.py | 119 ++ .../gooyal_advertising_client/client.py | 268 ++++ .../gooyal_advertising_client/errors.py | 16 + .../models/__init__.py | 203 +++ .../models/access_model_enum.py | 11 + .../gooyal_advertising_client/models/ad.py | 337 +++++ .../models/ad_content.py | 138 ++ .../models/ad_create.py | 1007 ++++++++++++++ .../models/ad_create_location_type_0.py | 78 ++ .../models/ad_create_location_type_0_type.py | 8 + .../models/ad_create_new_location.py | 78 ++ .../models/ad_create_new_location_type.py | 8 + .../models/ad_create_type_enum.py | 11 + .../models/ad_location_type_0.py | 78 ++ .../models/ad_location_type_0_type.py | 8 + .../models/ad_owner.py | 1022 +++++++++++++++ .../models/ad_owner_location_type_0.py | 78 ++ .../models/ad_owner_location_type_0_type.py | 8 + .../models/ad_owner_new_location_type_0.py | 78 ++ .../ad_owner_new_location_type_0_type.py | 8 + .../models/ad_public.py | 271 ++++ .../models/ad_public_location_type_0.py | 78 ++ .../models/ad_public_location_type_0_type.py | 8 + .../models/ad_report.py | 113 ++ .../models/ad_statistic.py | 123 ++ .../models/ad_visit_statistic.py | 83 ++ .../models/ad_with_visit.py | 357 +++++ .../models/ad_with_visit_location_type_0.py | 78 ++ .../ad_with_visit_location_type_0_type.py | 8 + .../models/attendance_type_enum.py | 10 + .../gooyal_advertising_client/models/ban.py | 78 ++ .../models/ban_level_enum.py | 9 + .../models/capture.py | 588 +++++++++ .../models/capture_location_type_0.py | 78 ++ .../models/capture_location_type_0_type.py | 8 + .../models/category_enum.py | 10 + .../models/check_in.py | 124 ++ .../models/check_in_location_type_0.py | 78 ++ .../models/check_in_location_type_0_type.py | 8 + .../models/cluster.py | 83 ++ .../models/comment.py | 134 ++ .../models/comment_create.py | 101 ++ .../models/config.py | 96 ++ .../models/content_type_enum.py | 11 + .../models/new_content_type_enum.py | 11 + .../models/paginated_ad_content_list.py | 123 ++ .../models/paginated_ad_list.py | 123 ++ .../models/paginated_ad_owner_list.py | 123 ++ .../models/paginated_ad_public_list.py | 123 ++ .../models/paginated_ad_with_visit_list.py | 123 ++ .../models/paginated_comment_list.py | 123 ++ .../models/paginated_config_list.py | 123 ++ .../paginated_refined_ad_content_list.py | 123 ++ .../models/paginated_suggestion_list.py | 123 ++ .../models/paginated_tag_list.py | 123 ++ .../models/paginated_ticket_list.py | 123 ++ .../models/paginated_visit_list.py | 123 ++ .../models/paginated_zone_list.py | 123 ++ .../models/patched_ad_owner.py | 1156 +++++++++++++++++ .../patched_ad_owner_location_type_0.py | 78 ++ .../patched_ad_owner_location_type_0_type.py | 8 + .../patched_ad_owner_new_location_type_0.py | 78 ++ ...tched_ad_owner_new_location_type_0_type.py | 8 + .../models/patched_ticket.py | 164 +++ .../models/payment_state_enum.py | 14 + .../models/price_model_enum.py | 12 + .../models/product_condition_enum.py | 10 + .../models/reaction_toggle.py | 59 + .../models/refined_ad_banner.py | 125 ++ .../models/refined_ad_content.py | 125 ++ .../models/rejection_reason_enum.py | 13 + .../models/report_category_enum.py | 8 + .../models/role_enum.py | 9 + .../models/sign_content.py | 67 + .../models/state_634_enum.py | 18 + .../models/statistic.py | 129 ++ ...tores_ads_bookmarked_list_ordering_item.py | 13 + ...ores_ads_clusterized_list_ordering_item.py | 13 + .../models/stores_ads_list_ordering_item.py | 13 + ...s_public_clusterized_list_ordering_item.py | 13 + ...ores_ads_public_list_list_ordering_item.py | 13 + .../stores_ads_visited_list_ordering_item.py | 13 + ...ores_ads_with_visits_list_ordering_item.py | 13 + ...ores_statistic_retrieve_accept_language.py | 10 + .../models/suggestion.py | 67 + .../gooyal_advertising_client/models/tag.py | 67 + .../models/ticket.py | 126 ++ .../models/ticket_state_enum.py | 9 + .../models/transportation_cost_enum.py | 10 + .../models/type_0d9_enum.py | 11 + .../models/value_type_enum.py | 14 + .../gooyal_advertising_client/models/visit.py | 256 ++++ .../models/visit_interaction.py | 64 + .../models/visit_interaction_type_enum.py | 11 + .../models/visit_location_type_0.py | 78 ++ .../models/visit_location_type_0_type.py | 8 + .../models/visit_reaction.py | 122 ++ .../models/visit_state_enum.py | 12 + .../gooyal_advertising_client/models/zone.py | 146 +++ .../models/zone_area_type_0.py | 105 ++ .../models/zone_area_type_0_type.py | 8 + .../models/zone_state_enum.py | 9 + .../models/zone_type_enum.py | 9 + .../gooyal_advertising_client/py.typed | 1 + .../gooyal_advertising_client/types.py | 54 + 178 files changed, 23402 insertions(+) create mode 100644 utils/advertising_client.py create mode 100644 utils/clients/gooyal_advertising_client/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/api/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/api/api_config_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/api/api_status_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_destroy.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_partial_update.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_update.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_tickets_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_tickets_destroy.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_tickets_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_tickets_partial_update.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_tickets_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/crm/crm_tickets_update.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_bookmarked_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_clusterized_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_clusterized_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_list_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_retrieve_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_react_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_report_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_visited_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_ads_with_visits_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_comments_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_comments_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_comments_react_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_comments_reply_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_config_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capture_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capturing_detail_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_destroy.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_partial_update.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_banner_destroy.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_destroy.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_statistic_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_stop_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_update.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_statistic_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_tags_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_tags_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_uploads_presign_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_finish_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_interact_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_react_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_visits_start_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_zones_check_in_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_zones_is_checked_in_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_zones_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/stores/stores_zones_status_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/suggestions/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/suggestions/suggestions_suggest_list.py create mode 100644 utils/clients/gooyal_advertising_client/api/users/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/api/users/users_users_ban_create.py create mode 100644 utils/clients/gooyal_advertising_client/api/users/users_users_ban_retrieve.py create mode 100644 utils/clients/gooyal_advertising_client/client.py create mode 100644 utils/clients/gooyal_advertising_client/errors.py create mode 100644 utils/clients/gooyal_advertising_client/models/__init__.py create mode 100644 utils/clients/gooyal_advertising_client/models/access_model_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_content.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_create.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_create_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_create_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_create_new_location.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_create_new_location_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_create_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_owner.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_public.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_public_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_public_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_report.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_statistic.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_visit_statistic.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_with_visit.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/attendance_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/ban.py create mode 100644 utils/clients/gooyal_advertising_client/models/ban_level_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/capture.py create mode 100644 utils/clients/gooyal_advertising_client/models/capture_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/capture_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/category_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/check_in.py create mode 100644 utils/clients/gooyal_advertising_client/models/check_in_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/check_in_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/cluster.py create mode 100644 utils/clients/gooyal_advertising_client/models/comment.py create mode 100644 utils/clients/gooyal_advertising_client/models/comment_create.py create mode 100644 utils/clients/gooyal_advertising_client/models/config.py create mode 100644 utils/clients/gooyal_advertising_client/models/content_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/new_content_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_ad_content_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_ad_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_ad_owner_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_ad_public_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_ad_with_visit_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_comment_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_config_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_refined_ad_content_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_suggestion_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_tag_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_ticket_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_visit_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/paginated_zone_list.py create mode 100644 utils/clients/gooyal_advertising_client/models/patched_ad_owner.py create mode 100644 utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/patched_ticket.py create mode 100644 utils/clients/gooyal_advertising_client/models/payment_state_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/price_model_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/product_condition_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/reaction_toggle.py create mode 100644 utils/clients/gooyal_advertising_client/models/refined_ad_banner.py create mode 100644 utils/clients/gooyal_advertising_client/models/refined_ad_content.py create mode 100644 utils/clients/gooyal_advertising_client/models/rejection_reason_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/report_category_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/role_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/sign_content.py create mode 100644 utils/clients/gooyal_advertising_client/models/state_634_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/statistic.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_bookmarked_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_clusterized_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_public_clusterized_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_public_list_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_visited_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_ads_with_visits_list_ordering_item.py create mode 100644 utils/clients/gooyal_advertising_client/models/stores_statistic_retrieve_accept_language.py create mode 100644 utils/clients/gooyal_advertising_client/models/suggestion.py create mode 100644 utils/clients/gooyal_advertising_client/models/tag.py create mode 100644 utils/clients/gooyal_advertising_client/models/ticket.py create mode 100644 utils/clients/gooyal_advertising_client/models/ticket_state_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/transportation_cost_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/type_0d9_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/value_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit_interaction.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit_interaction_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit_location_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit_location_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit_reaction.py create mode 100644 utils/clients/gooyal_advertising_client/models/visit_state_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/zone.py create mode 100644 utils/clients/gooyal_advertising_client/models/zone_area_type_0.py create mode 100644 utils/clients/gooyal_advertising_client/models/zone_area_type_0_type.py create mode 100644 utils/clients/gooyal_advertising_client/models/zone_state_enum.py create mode 100644 utils/clients/gooyal_advertising_client/models/zone_type_enum.py create mode 100644 utils/clients/gooyal_advertising_client/py.typed create mode 100644 utils/clients/gooyal_advertising_client/types.py diff --git a/utils/advertising_client.py b/utils/advertising_client.py new file mode 100644 index 0000000..ad2b304 --- /dev/null +++ b/utils/advertising_client.py @@ -0,0 +1,103 @@ +import time + +import requests +from django.conf import settings +from django.core.cache import cache +from httpx import Request + +from utils.clients.gooyal_advertising_client import AuthenticatedClient +from utils.clients.gooyal_advertising_client.api.crm.crm_tickets_list import sync as crm_tickets_list_sync +from utils.clients.gooyal_advertising_client.api.crm.crm_application_tickets_list import sync as crm_application_tickets_list_sync +from utils.clients.gooyal_advertising_client.api.suggestions.suggestions_suggest_list import sync as suggestions_suggest_list_sync +from utils.clients.gooyal_advertising_client.models.paginated_ticket_list import PaginatedTicketList +from utils.clients.gooyal_advertising_client.models.paginated_suggestion_list import PaginatedSuggestionList + + +def login_as_client_credentials(): + access_token = cache.get('advertising_access_token') + if access_token: + print('already in cache') + return access_token + + print('not in cache') + + data = { + 'grant_type': 'client_credentials', + 'scope': settings.OAUTH2_PROVIDER_SCOPES, + } + auth = (settings.OAUTH2_PROVIDER_CLIENT_ID, settings.OAUTH2_PROVIDER_CLIENT_SECRET) + + response = requests.post( + f'{settings.OAUTH2_PROVIDER_BASE_PUBLIC_URL}/token/', + data=data, + auth=auth, + ) + print(response.content) + + auth_data = response.json() + if 'access_token' in auth_data: + auth_data['created_at'] = time.time() + cache.set('advertising_access_token', auth_data, timeout=auth_data.get('expires_in') - 5) + + return auth_data + + +def log_request(request: Request): + print(request.headers.get('authorization')) + print( + f'Request event hook: {request.method} {request.url} {request.headers} - Waiting for response' + ) + + +def log_response(response): + request = response.request + print(f'Response event hook: {request.method} {request.url} - Status {response.status_code}') + + +def get_client(): + access_token = login_as_client_credentials()['access_token'] + client = AuthenticatedClient( + base_url=settings.ADVERTISING_BASE_PUBLIC_URL, + token=access_token, + httpx_args={ + 'event_hooks': { + 'request': [log_request], + 'response': [log_response], + } + }, + ) + return client + + +def get_suggestions(limit=None, offset=None): + client = get_client() + response: PaginatedSuggestionList = suggestions_suggest_list_sync( + client=client, + limit=limit, + offset=offset, + ) + print(response) + return response + + +def get_crm_tickets(limit=None, offset=None): + client = get_client() + response: PaginatedTicketList = crm_tickets_list_sync( + client=client, + limit=limit, + offset=offset, + ) + print(response) + return response + + +def get_crm_application_tickets(limit=None, offset=None): + client = get_client() + response: PaginatedTicketList = crm_application_tickets_list_sync( + client=client, + limit=limit, + offset=offset, + ) + print(response) + return response + diff --git a/utils/clients/gooyal_advertising_client/__init__.py b/utils/clients/gooyal_advertising_client/__init__.py new file mode 100644 index 0000000..10ab6e5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/__init__.py @@ -0,0 +1,8 @@ +"""A client library for accessing merchants""" + +from .client import AuthenticatedClient, Client + +__all__ = ( + "AuthenticatedClient", + "Client", +) diff --git a/utils/clients/gooyal_advertising_client/api/__init__.py b/utils/clients/gooyal_advertising_client/api/__init__.py new file mode 100644 index 0000000..81f9fa2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/__init__.py @@ -0,0 +1 @@ +"""Contains methods for accessing the API""" diff --git a/utils/clients/gooyal_advertising_client/api/api/__init__.py b/utils/clients/gooyal_advertising_client/api/api/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/api/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/utils/clients/gooyal_advertising_client/api/api/api_config_list.py b/utils/clients/gooyal_advertising_client/api/api/api_config_list.py new file mode 100644 index 0000000..3b28db6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/api/api_config_list.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_config_list import PaginatedConfigList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/api/config/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedConfigList]: + if response.status_code == 200: + response_200 = PaginatedConfigList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedConfigList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedConfigList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedConfigList + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedConfigList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedConfigList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/api/api_status_retrieve.py b/utils/clients/gooyal_advertising_client/api/api/api_status_retrieve.py new file mode 100644 index 0000000..a0bb9d1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/api/api_status_retrieve.py @@ -0,0 +1,78 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/api/status", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == 200: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/utils/clients/gooyal_advertising_client/api/crm/__init__.py b/utils/clients/gooyal_advertising_client/api/crm/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_create.py b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_create.py new file mode 100644 index 0000000..f294859 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + *, + body: Ticket, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/crm/application/tickets/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 201: + response_201 = Ticket.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_destroy.py b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_destroy.py new file mode 100644 index 0000000..ac2126b --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_destroy.py @@ -0,0 +1,92 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs( + id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/crm/application/tickets/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == 204: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_list.py b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_list.py new file mode 100644 index 0000000..224d314 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_list.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ticket_list import PaginatedTicketList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/crm/application/tickets/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedTicketList]: + if response.status_code == 200: + response_200 = PaginatedTicketList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedTicketList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedTicketList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedTicketList + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedTicketList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedTicketList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_partial_update.py b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_partial_update.py new file mode 100644 index 0000000..53d78f8 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_partial_update.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.patched_ticket import PatchedTicket +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: PatchedTicket, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": f"/crm/application/tickets/{id}/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 200: + response_200 = Ticket.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_retrieve.py b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_retrieve.py new file mode 100644 index 0000000..402edea --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_retrieve.py @@ -0,0 +1,143 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/crm/application/tickets/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 200: + response_200 = Ticket.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_update.py b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_update.py new file mode 100644 index 0000000..d4d5b9d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_application_tickets_update.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: Ticket, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "put", + "url": f"/crm/application/tickets/{id}/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 200: + response_200 = Ticket.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_create.py b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_create.py new file mode 100644 index 0000000..3c05ce8 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + *, + body: Ticket, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/crm/tickets/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 201: + response_201 = Ticket.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_destroy.py b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_destroy.py new file mode 100644 index 0000000..6aa278c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_destroy.py @@ -0,0 +1,92 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs( + id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/crm/tickets/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == 204: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_list.py b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_list.py new file mode 100644 index 0000000..4a21664 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_list.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ticket_list import PaginatedTicketList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/crm/tickets/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedTicketList]: + if response.status_code == 200: + response_200 = PaginatedTicketList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedTicketList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedTicketList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedTicketList + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedTicketList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedTicketList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedTicketList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_partial_update.py b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_partial_update.py new file mode 100644 index 0000000..433f199 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_partial_update.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.patched_ticket import PatchedTicket +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: PatchedTicket, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": f"/crm/tickets/{id}/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 200: + response_200 = Ticket.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: PatchedTicket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (PatchedTicket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_retrieve.py b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_retrieve.py new file mode 100644 index 0000000..922d3cd --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_retrieve.py @@ -0,0 +1,143 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/crm/tickets/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 200: + response_200 = Ticket.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Ticket]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_update.py b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_update.py new file mode 100644 index 0000000..4e43a4f --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/crm/crm_tickets_update.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ticket import Ticket +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: Ticket, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "put", + "url": f"/crm/tickets/{id}/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ticket]: + if response.status_code == 200: + response_200 = Ticket.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ticket]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Response[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ticket] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: Ticket, +) -> Optional[Ticket]: + """ + Args: + id (str): + body (Ticket): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ticket + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/__init__.py b/utils/clients/gooyal_advertising_client/api/stores/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_bookmarked_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_bookmarked_list.py new file mode 100644 index 0000000..71568ca --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_bookmarked_list.py @@ -0,0 +1,445 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_with_visit_list import PaginatedAdWithVisitList +from ...models.stores_ads_bookmarked_list_ordering_item import StoresAdsBookmarkedListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + params["offset"] = offset + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/bookmarked/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdWithVisitList]: + if response.status_code == 200: + response_200 = PaginatedAdWithVisitList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdWithVisitList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdWithVisitList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdWithVisitList + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdWithVisitList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsBookmarkedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsBookmarkedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdWithVisitList + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_clusterized_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_clusterized_list.py new file mode 100644 index 0000000..039f47a --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_clusterized_list.py @@ -0,0 +1,420 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.cluster import Cluster +from ...models.stores_ads_clusterized_list_ordering_item import StoresAdsClusterizedListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/clusterized/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[list["Cluster"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Cluster.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[list["Cluster"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Cluster']] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Cluster'] + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Cluster']] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Cluster'] + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_list.py new file mode 100644 index 0000000..f214d0d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_list.py @@ -0,0 +1,445 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_list import PaginatedAdList +from ...models.stores_ads_list_ordering_item import StoresAdsListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + params["offset"] = offset + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdList]: + if response.status_code == 200: + response_200 = PaginatedAdList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdList + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdList + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_clusterized_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_clusterized_list.py new file mode 100644 index 0000000..ead2da8 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_clusterized_list.py @@ -0,0 +1,420 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.cluster import Cluster +from ...models.stores_ads_public_clusterized_list_ordering_item import StoresAdsPublicClusterizedListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/public_clusterized/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[list["Cluster"]]: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = Cluster.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[list["Cluster"]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Cluster']] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Cluster'] + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[list['Cluster']] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[list["Cluster"]]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + ordering (Union[Unset, list[StoresAdsPublicClusterizedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + list['Cluster'] + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_list_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_list_list.py new file mode 100644 index 0000000..59a38f6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_list_list.py @@ -0,0 +1,445 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_public_list import PaginatedAdPublicList +from ...models.stores_ads_public_list_list_ordering_item import StoresAdsPublicListListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + params["offset"] = offset + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/public_list/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdPublicList]: + if response.status_code == 200: + response_200 = PaginatedAdPublicList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdPublicList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdPublicList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdPublicList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdPublicList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdPublicList + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdPublicList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdPublicList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsPublicListListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdPublicList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsPublicListListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdPublicList + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_retrieve_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_retrieve_retrieve.py new file mode 100644 index 0000000..31ddca5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_public_retrieve_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_public import AdPublic +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/ads/{uuid}/public_retrieve/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdPublic]: + if response.status_code == 200: + response_200 = AdPublic.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdPublic]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdPublic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdPublic] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdPublic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdPublic + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdPublic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdPublic] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdPublic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdPublic + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_react_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_react_create.py new file mode 100644 index 0000000..a65d783 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_react_create.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit_reaction import VisitReaction +from ...types import Response + + +def _get_kwargs( + uuid: UUID, + *, + body: VisitReaction, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/ads/{uuid}/react/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[VisitReaction]: + if response.status_code == 200: + response_200 = VisitReaction.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[VisitReaction]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Response[VisitReaction]: + """ + Args: + uuid (UUID): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[VisitReaction] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Optional[VisitReaction]: + """ + Args: + uuid (UUID): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + VisitReaction + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Response[VisitReaction]: + """ + Args: + uuid (UUID): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[VisitReaction] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Optional[VisitReaction]: + """ + Args: + uuid (UUID): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + VisitReaction + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_report_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_report_create.py new file mode 100644 index 0000000..696dca5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_report_create.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_report import AdReport +from ...types import Response + + +def _get_kwargs( + uuid: UUID, + *, + body: AdReport, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/ads/{uuid}/report/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdReport]: + if response.status_code == 200: + response_200 = AdReport.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdReport]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdReport, +) -> Response[AdReport]: + """ + Args: + uuid (UUID): + body (AdReport): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdReport] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdReport, +) -> Optional[AdReport]: + """ + Args: + uuid (UUID): + body (AdReport): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdReport + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdReport, +) -> Response[AdReport]: + """ + Args: + uuid (UUID): + body (AdReport): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdReport] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdReport, +) -> Optional[AdReport]: + """ + Args: + uuid (UUID): + body (AdReport): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdReport + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_retrieve.py new file mode 100644 index 0000000..e27b0d5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad import Ad +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/ads/{uuid}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ad]: + if response.status_code == 200: + response_200 = Ad.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ad]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Ad]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ad] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[Ad]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ad + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Ad]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ad] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[Ad]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ad + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_visited_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_visited_list.py new file mode 100644 index 0000000..b8e5582 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_visited_list.py @@ -0,0 +1,445 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_with_visit_list import PaginatedAdWithVisitList +from ...models.stores_ads_visited_list_ordering_item import StoresAdsVisitedListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + params["offset"] = offset + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/visited/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdWithVisitList]: + if response.status_code == 200: + response_200 = PaginatedAdWithVisitList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdWithVisitList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdWithVisitList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdWithVisitList + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdWithVisitList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsVisitedListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsVisitedListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdWithVisitList + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_ads_with_visits_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_with_visits_list.py new file mode 100644 index 0000000..231e734 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_ads_with_visits_list.py @@ -0,0 +1,445 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_with_visit_list import PaginatedAdWithVisitList +from ...models.stores_ads_with_visits_list_ordering_item import StoresAdsWithVisitsListOrderingItem +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["bookmark"] = bookmark + + params["favorite"] = favorite + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + params["offset"] = offset + + json_ordering: Union[Unset, list[str]] = UNSET + if not isinstance(ordering, Unset): + json_ordering = [] + for ordering_item_data in ordering: + ordering_item = ordering_item_data.value + json_ordering.append(ordering_item) + + params["ordering"] = json_ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + params["search"] = search + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + json_type_in: Union[Unset, list[int]] = UNSET + if not isinstance(type_in, Unset): + json_type_in = type_in + + params["type__in"] = json_type_in + + params["visited"] = visited + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/ads/with_visits/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdWithVisitList]: + if response.status_code == 200: + response_200 = PaginatedAdWithVisitList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdWithVisitList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdWithVisitList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdWithVisitList + """ + + return sync_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Response[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdWithVisitList] + """ + + kwargs = _get_kwargs( + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + bookmark: Union[Unset, bool] = UNSET, + favorite: Union[Unset, bool] = UNSET, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, list[StoresAdsWithVisitsListOrderingItem]] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + search: Union[Unset, str] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, + type_in: Union[Unset, list[int]] = UNSET, + visited: Union[Unset, bool] = UNSET, +) -> Optional[PaginatedAdWithVisitList]: + """ + Args: + bookmark (Union[Unset, bool]): + favorite (Union[Unset, bool]): + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, list[StoresAdsWithVisitsListOrderingItem]]): + payment_state_in (Union[Unset, list[int]]): + search (Union[Unset, str]): + state_in (Union[Unset, list[int]]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + type_in (Union[Unset, list[int]]): + visited (Union[Unset, bool]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdWithVisitList + """ + + return ( + await asyncio_detailed( + client=client, + bookmark=bookmark, + favorite=favorite, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + search=search, + state_in=state_in, + tags=tags, + title_icontains=title_icontains, + type_in=type_in, + visited=visited, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_comments_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_create.py new file mode 100644 index 0000000..90c1a0a --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.comment_create import CommentCreate +from ...types import Response + + +def _get_kwargs( + *, + body: CommentCreate, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/comments/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[CommentCreate]: + if response.status_code == 201: + response_201 = CommentCreate.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[CommentCreate]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Response[CommentCreate]: + """ + Args: + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CommentCreate] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Optional[CommentCreate]: + """ + Args: + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CommentCreate + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Response[CommentCreate]: + """ + Args: + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CommentCreate] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Optional[CommentCreate]: + """ + Args: + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CommentCreate + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_comments_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_list.py new file mode 100644 index 0000000..3b53027 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_list.py @@ -0,0 +1,207 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_comment_list import PaginatedCommentList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + ad: Union[Unset, UUID] = UNSET, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, + user: Union[Unset, UUID] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + json_ad: Union[Unset, str] = UNSET + if not isinstance(ad, Unset): + json_ad = str(ad) + params["ad"] = json_ad + + params["limit"] = limit + + params["offset"] = offset + + json_user: Union[Unset, str] = UNSET + if not isinstance(user, Unset): + json_user = str(user) + params["user"] = json_user + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/comments/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedCommentList]: + if response.status_code == 200: + response_200 = PaginatedCommentList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedCommentList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + ad: Union[Unset, UUID] = UNSET, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, + user: Union[Unset, UUID] = UNSET, +) -> Response[PaginatedCommentList]: + """ + Args: + ad (Union[Unset, UUID]): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + user (Union[Unset, UUID]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedCommentList] + """ + + kwargs = _get_kwargs( + ad=ad, + limit=limit, + offset=offset, + user=user, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + ad: Union[Unset, UUID] = UNSET, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, + user: Union[Unset, UUID] = UNSET, +) -> Optional[PaginatedCommentList]: + """ + Args: + ad (Union[Unset, UUID]): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + user (Union[Unset, UUID]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedCommentList + """ + + return sync_detailed( + client=client, + ad=ad, + limit=limit, + offset=offset, + user=user, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + ad: Union[Unset, UUID] = UNSET, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, + user: Union[Unset, UUID] = UNSET, +) -> Response[PaginatedCommentList]: + """ + Args: + ad (Union[Unset, UUID]): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + user (Union[Unset, UUID]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedCommentList] + """ + + kwargs = _get_kwargs( + ad=ad, + limit=limit, + offset=offset, + user=user, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + ad: Union[Unset, UUID] = UNSET, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, + user: Union[Unset, UUID] = UNSET, +) -> Optional[PaginatedCommentList]: + """ + Args: + ad (Union[Unset, UUID]): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + user (Union[Unset, UUID]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedCommentList + """ + + return ( + await asyncio_detailed( + client=client, + ad=ad, + limit=limit, + offset=offset, + user=user, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_comments_react_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_react_create.py new file mode 100644 index 0000000..ec5736f --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_react_create.py @@ -0,0 +1,168 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.reaction_toggle import ReactionToggle +from ...types import Response + + +def _get_kwargs( + uuid: str, + *, + body: ReactionToggle, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/comments/{uuid}/react/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[ReactionToggle]: + if response.status_code == 200: + response_200 = ReactionToggle.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[ReactionToggle]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: str, + *, + client: AuthenticatedClient, + body: ReactionToggle, +) -> Response[ReactionToggle]: + """ + Args: + uuid (str): + body (ReactionToggle): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ReactionToggle] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: str, + *, + client: AuthenticatedClient, + body: ReactionToggle, +) -> Optional[ReactionToggle]: + """ + Args: + uuid (str): + body (ReactionToggle): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ReactionToggle + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: str, + *, + client: AuthenticatedClient, + body: ReactionToggle, +) -> Response[ReactionToggle]: + """ + Args: + uuid (str): + body (ReactionToggle): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[ReactionToggle] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: str, + *, + client: AuthenticatedClient, + body: ReactionToggle, +) -> Optional[ReactionToggle]: + """ + Args: + uuid (str): + body (ReactionToggle): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + ReactionToggle + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_comments_reply_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_reply_create.py new file mode 100644 index 0000000..d31491b --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_comments_reply_create.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.comment_create import CommentCreate +from ...types import Response + + +def _get_kwargs( + uuid: str, + *, + body: CommentCreate, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/comments/{uuid}/reply/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[CommentCreate]: + if response.status_code == 201: + response_201 = CommentCreate.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[CommentCreate]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: str, + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Response[CommentCreate]: + """ + Args: + uuid (str): + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CommentCreate] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: str, + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Optional[CommentCreate]: + """ + Args: + uuid (str): + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CommentCreate + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: str, + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Response[CommentCreate]: + """ + Args: + uuid (str): + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CommentCreate] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: str, + *, + client: AuthenticatedClient, + body: CommentCreate, +) -> Optional[CommentCreate]: + """ + Args: + uuid (str): + body (CommentCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CommentCreate + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_config_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_config_list.py new file mode 100644 index 0000000..143900a --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_config_list.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_config_list import PaginatedConfigList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/config/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedConfigList]: + if response.status_code == 200: + response_200 = PaginatedConfigList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedConfigList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedConfigList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedConfigList + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedConfigList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedConfigList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedConfigList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capture_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capture_create.py new file mode 100644 index 0000000..2be8ad7 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capture_create.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.capture import Capture +from ...types import Response + + +def _get_kwargs( + uuid: UUID, + *, + body: Capture, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/my_ads/{uuid}/capture/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Capture]: + if response.status_code == 200: + response_200 = Capture.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Capture]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: Capture, +) -> Response[Capture]: + """ + Args: + uuid (UUID): + body (Capture): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Capture] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, + body: Capture, +) -> Optional[Capture]: + """ + Args: + uuid (UUID): + body (Capture): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Capture + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: Capture, +) -> Response[Capture]: + """ + Args: + uuid (UUID): + body (Capture): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Capture] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, + body: Capture, +) -> Optional[Capture]: + """ + Args: + uuid (UUID): + body (Capture): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Capture + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capturing_detail_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capturing_detail_retrieve.py new file mode 100644 index 0000000..3a50ac7 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_capturing_detail_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.capture import Capture +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{uuid}/capturing_detail/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Capture]: + if response.status_code == 200: + response_200 = Capture.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Capture]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Capture]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Capture] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[Capture]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Capture + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Capture]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Capture] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[Capture]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Capture + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_create.py new file mode 100644 index 0000000..61f45f3 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_create.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_content import AdContent +from ...types import Response + + +def _get_kwargs( + ad: UUID, + *, + body: AdContent, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/my_ads/{ad}/contents/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdContent]: + if response.status_code == 201: + response_201 = AdContent.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdContent]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + body: AdContent, +) -> Response[AdContent]: + """ + Args: + ad (UUID): + body (AdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdContent] + """ + + kwargs = _get_kwargs( + ad=ad, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + ad: UUID, + *, + client: AuthenticatedClient, + body: AdContent, +) -> Optional[AdContent]: + """ + Args: + ad (UUID): + body (AdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdContent + """ + + return sync_detailed( + ad=ad, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + body: AdContent, +) -> Response[AdContent]: + """ + Args: + ad (UUID): + body (AdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdContent] + """ + + kwargs = _get_kwargs( + ad=ad, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + ad: UUID, + *, + client: AuthenticatedClient, + body: AdContent, +) -> Optional[AdContent]: + """ + Args: + ad (UUID): + body (AdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdContent + """ + + return ( + await asyncio_detailed( + ad=ad, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_list.py new file mode 100644 index 0000000..1a87d3a --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_contents_list.py @@ -0,0 +1,184 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_content_list import PaginatedAdContentList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + ad: UUID, + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{ad}/contents/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdContentList]: + if response.status_code == 200: + response_200 = PaginatedAdContentList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdContentList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdContentList] + """ + + kwargs = _get_kwargs( + ad=ad, + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdContentList + """ + + return sync_detailed( + ad=ad, + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdContentList] + """ + + kwargs = _get_kwargs( + ad=ad, + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdContentList + """ + + return ( + await asyncio_detailed( + ad=ad, + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_create.py new file mode 100644 index 0000000..15f6f56 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_create import AdCreate +from ...types import Response + + +def _get_kwargs( + *, + body: AdCreate, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/my_ads/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdCreate]: + if response.status_code == 201: + response_201 = AdCreate.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdCreate]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: AdCreate, +) -> Response[AdCreate]: + """ + Args: + body (AdCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdCreate] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: AdCreate, +) -> Optional[AdCreate]: + """ + Args: + body (AdCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdCreate + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: AdCreate, +) -> Response[AdCreate]: + """ + Args: + body (AdCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdCreate] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: AdCreate, +) -> Optional[AdCreate]: + """ + Args: + body (AdCreate): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdCreate + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_destroy.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_destroy.py new file mode 100644 index 0000000..d541226 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_destroy.py @@ -0,0 +1,93 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/stores/my_ads/{uuid}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == 204: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_list.py new file mode 100644 index 0000000..d296833 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_list.py @@ -0,0 +1,373 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_ad_owner_list import PaginatedAdOwnerList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, str] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + state_ordering: Union[Unset, str] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["max_lat"] = max_lat + + params["max_lon"] = max_lon + + params["min_lat"] = min_lat + + params["min_lon"] = min_lon + + params["offset"] = offset + + params["ordering"] = ordering + + json_payment_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(payment_state_in, Unset): + json_payment_state_in = payment_state_in + + params["payment_state__in"] = json_payment_state_in + + json_state_in: Union[Unset, list[int]] = UNSET + if not isinstance(state_in, Unset): + json_state_in = state_in + + params["state__in"] = json_state_in + + params["state_ordering"] = state_ordering + + params["tags"] = tags + + params["title__icontains"] = title_icontains + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/my_ads/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedAdOwnerList]: + if response.status_code == 200: + response_200 = PaginatedAdOwnerList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedAdOwnerList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, str] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + state_ordering: Union[Unset, str] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, +) -> Response[PaginatedAdOwnerList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, str]): + payment_state_in (Union[Unset, list[int]]): + state_in (Union[Unset, list[int]]): + state_ordering (Union[Unset, str]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdOwnerList] + """ + + kwargs = _get_kwargs( + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + state_in=state_in, + state_ordering=state_ordering, + tags=tags, + title_icontains=title_icontains, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, str] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + state_ordering: Union[Unset, str] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, +) -> Optional[PaginatedAdOwnerList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, str]): + payment_state_in (Union[Unset, list[int]]): + state_in (Union[Unset, list[int]]): + state_ordering (Union[Unset, str]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdOwnerList + """ + + return sync_detailed( + client=client, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + state_in=state_in, + state_ordering=state_ordering, + tags=tags, + title_icontains=title_icontains, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, str] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + state_ordering: Union[Unset, str] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, +) -> Response[PaginatedAdOwnerList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, str]): + payment_state_in (Union[Unset, list[int]]): + state_in (Union[Unset, list[int]]): + state_ordering (Union[Unset, str]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedAdOwnerList] + """ + + kwargs = _get_kwargs( + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + state_in=state_in, + state_ordering=state_ordering, + tags=tags, + title_icontains=title_icontains, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: Union[Unset, str] = UNSET, + location_lon: Union[Unset, str] = UNSET, + max_lat: Union[Unset, str] = UNSET, + max_lon: Union[Unset, str] = UNSET, + min_lat: Union[Unset, str] = UNSET, + min_lon: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, + ordering: Union[Unset, str] = UNSET, + payment_state_in: Union[Unset, list[int]] = UNSET, + state_in: Union[Unset, list[int]] = UNSET, + state_ordering: Union[Unset, str] = UNSET, + tags: Union[Unset, str] = UNSET, + title_icontains: Union[Unset, str] = UNSET, +) -> Optional[PaginatedAdOwnerList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (Union[Unset, str]): + location_lon (Union[Unset, str]): + max_lat (Union[Unset, str]): + max_lon (Union[Unset, str]): + min_lat (Union[Unset, str]): + min_lon (Union[Unset, str]): + offset (Union[Unset, int]): + ordering (Union[Unset, str]): + payment_state_in (Union[Unset, list[int]]): + state_in (Union[Unset, list[int]]): + state_ordering (Union[Unset, str]): + tags (Union[Unset, str]): + title_icontains (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedAdOwnerList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + max_lat=max_lat, + max_lon=max_lon, + min_lat=min_lat, + min_lon=min_lon, + offset=offset, + ordering=ordering, + payment_state_in=payment_state_in, + state_in=state_in, + state_ordering=state_ordering, + tags=tags, + title_icontains=title_icontains, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_partial_update.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_partial_update.py new file mode 100644 index 0000000..2351aa6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_partial_update.py @@ -0,0 +1,166 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_owner import AdOwner +from ...models.patched_ad_owner import PatchedAdOwner +from ...types import Response + + +def _get_kwargs( + uuid: UUID, + *, + body: PatchedAdOwner, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "patch", + "url": f"/stores/my_ads/{uuid}/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]: + if response.status_code == 200: + response_200 = AdOwner.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: PatchedAdOwner, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + body (PatchedAdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, + body: PatchedAdOwner, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + body (PatchedAdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: PatchedAdOwner, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + body (PatchedAdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, + body: PatchedAdOwner, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + body (PatchedAdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_create.py new file mode 100644 index 0000000..a8d31d6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_create.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_owner import AdOwner +from ...types import Response + + +def _get_kwargs( + uuid: UUID, + *, + body: AdOwner, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/my_ads/{uuid}/pay/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]: + if response.status_code == 200: + response_200 = AdOwner.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_retrieve.py new file mode 100644 index 0000000..945fb74 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_pay_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_owner import AdOwner +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{uuid}/pay/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]: + if response.status_code == 200: + response_200 = AdOwner.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_banner_destroy.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_banner_destroy.py new file mode 100644 index 0000000..d653a52 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_banner_destroy.py @@ -0,0 +1,100 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs( + ad: UUID, + id: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/stores/my_ads/{ad}/refined_banner/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == 204: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + ad: UUID, + id: UUID, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + ad (UUID): + id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + ad=ad, + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + ad: UUID, + id: UUID, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + ad (UUID): + id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + ad=ad, + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_create.py new file mode 100644 index 0000000..587dba0 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_create.py @@ -0,0 +1,169 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.refined_ad_content import RefinedAdContent +from ...types import Response + + +def _get_kwargs( + ad: UUID, + *, + body: RefinedAdContent, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/my_ads/{ad}/refined_contents/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[RefinedAdContent]: + if response.status_code == 201: + response_201 = RefinedAdContent.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[RefinedAdContent]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + body: RefinedAdContent, +) -> Response[RefinedAdContent]: + """ + Args: + ad (UUID): + body (RefinedAdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[RefinedAdContent] + """ + + kwargs = _get_kwargs( + ad=ad, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + ad: UUID, + *, + client: AuthenticatedClient, + body: RefinedAdContent, +) -> Optional[RefinedAdContent]: + """ + Args: + ad (UUID): + body (RefinedAdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + RefinedAdContent + """ + + return sync_detailed( + ad=ad, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + body: RefinedAdContent, +) -> Response[RefinedAdContent]: + """ + Args: + ad (UUID): + body (RefinedAdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[RefinedAdContent] + """ + + kwargs = _get_kwargs( + ad=ad, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + ad: UUID, + *, + client: AuthenticatedClient, + body: RefinedAdContent, +) -> Optional[RefinedAdContent]: + """ + Args: + ad (UUID): + body (RefinedAdContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + RefinedAdContent + """ + + return ( + await asyncio_detailed( + ad=ad, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_destroy.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_destroy.py new file mode 100644 index 0000000..1114ae7 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_destroy.py @@ -0,0 +1,100 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...types import Response + + +def _get_kwargs( + ad: UUID, + id: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "delete", + "url": f"/stores/my_ads/{ad}/refined_contents/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == 204: + return None + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + ad: UUID, + id: UUID, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + ad (UUID): + id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + ad=ad, + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + ad: UUID, + id: UUID, + *, + client: AuthenticatedClient, +) -> Response[Any]: + """ + Args: + ad (UUID): + id (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + kwargs = _get_kwargs( + ad=ad, + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_list.py new file mode 100644 index 0000000..869bf60 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_refined_contents_list.py @@ -0,0 +1,184 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_refined_ad_content_list import PaginatedRefinedAdContentList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + ad: UUID, + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{ad}/refined_contents/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedRefinedAdContentList]: + if response.status_code == 200: + response_200 = PaginatedRefinedAdContentList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedRefinedAdContentList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedRefinedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedRefinedAdContentList] + """ + + kwargs = _get_kwargs( + ad=ad, + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedRefinedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedRefinedAdContentList + """ + + return sync_detailed( + ad=ad, + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedRefinedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedRefinedAdContentList] + """ + + kwargs = _get_kwargs( + ad=ad, + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + ad: UUID, + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedRefinedAdContentList]: + """ + Args: + ad (UUID): + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedRefinedAdContentList + """ + + return ( + await asyncio_detailed( + ad=ad, + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_retrieve.py new file mode 100644 index 0000000..9c41eae --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_owner import AdOwner +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{uuid}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]: + if response.status_code == 200: + response_200 = AdOwner.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_statistic_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_statistic_retrieve.py new file mode 100644 index 0000000..f08314b --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_statistic_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_statistic import AdStatistic +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{uuid}/statistic/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdStatistic]: + if response.status_code == 200: + response_200 = AdStatistic.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdStatistic]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdStatistic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdStatistic] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdStatistic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdStatistic + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdStatistic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdStatistic] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdStatistic]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdStatistic + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_stop_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_stop_retrieve.py new file mode 100644 index 0000000..0eea756 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_stop_retrieve.py @@ -0,0 +1,144 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_owner import AdOwner +from ...types import Response + + +def _get_kwargs( + uuid: UUID, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/my_ads/{uuid}/stop/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]: + if response.status_code == 200: + response_200 = AdOwner.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return sync_detailed( + uuid=uuid, + client=client, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_update.py b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_update.py new file mode 100644 index 0000000..bddf0cc --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_my_ads_update.py @@ -0,0 +1,165 @@ +from http import HTTPStatus +from typing import Any, Optional, Union +from uuid import UUID + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ad_owner import AdOwner +from ...types import Response + + +def _get_kwargs( + uuid: UUID, + *, + body: AdOwner, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "put", + "url": f"/stores/my_ads/{uuid}/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AdOwner]: + if response.status_code == 200: + response_200 = AdOwner.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AdOwner]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return sync_detailed( + uuid=uuid, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Response[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AdOwner] + """ + + kwargs = _get_kwargs( + uuid=uuid, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + uuid: UUID, + *, + client: AuthenticatedClient, + body: AdOwner, +) -> Optional[AdOwner]: + """ + Args: + uuid (UUID): + body (AdOwner): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AdOwner + """ + + return ( + await asyncio_detailed( + uuid=uuid, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_statistic_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_statistic_retrieve.py new file mode 100644 index 0000000..fe44f14 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_statistic_retrieve.py @@ -0,0 +1,154 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.statistic import Statistic +from ...models.stores_statistic_retrieve_accept_language import StoresStatisticRetrieveAcceptLanguage +from ...types import Response, Unset + + +def _get_kwargs( + *, + accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + if not isinstance(accept_language, Unset): + headers["Accept-Language"] = str(accept_language) + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/statistic/", + } + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Statistic]: + if response.status_code == 200: + response_200 = Statistic.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Statistic]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA, +) -> Response[Statistic]: + """ + Args: + accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default: + StoresStatisticRetrieveAcceptLanguage.FA. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Statistic] + """ + + kwargs = _get_kwargs( + accept_language=accept_language, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA, +) -> Optional[Statistic]: + """ + Args: + accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default: + StoresStatisticRetrieveAcceptLanguage.FA. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Statistic + """ + + return sync_detailed( + client=client, + accept_language=accept_language, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA, +) -> Response[Statistic]: + """ + Args: + accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default: + StoresStatisticRetrieveAcceptLanguage.FA. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Statistic] + """ + + kwargs = _get_kwargs( + accept_language=accept_language, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + accept_language: Union[Unset, StoresStatisticRetrieveAcceptLanguage] = StoresStatisticRetrieveAcceptLanguage.FA, +) -> Optional[Statistic]: + """ + Args: + accept_language (Union[Unset, StoresStatisticRetrieveAcceptLanguage]): Default: + StoresStatisticRetrieveAcceptLanguage.FA. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Statistic + """ + + return ( + await asyncio_detailed( + client=client, + accept_language=accept_language, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_tags_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_tags_list.py new file mode 100644 index 0000000..5093158 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_tags_list.py @@ -0,0 +1,185 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_tag_list import PaginatedTagList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + name_icontains: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["name__icontains"] = name_icontains + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/tags/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedTagList]: + if response.status_code == 200: + response_200 = PaginatedTagList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedTagList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + name_icontains: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedTagList]: + """ + Args: + limit (Union[Unset, int]): + name_icontains (Union[Unset, str]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedTagList] + """ + + kwargs = _get_kwargs( + limit=limit, + name_icontains=name_icontains, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + name_icontains: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedTagList]: + """ + Args: + limit (Union[Unset, int]): + name_icontains (Union[Unset, str]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedTagList + """ + + return sync_detailed( + client=client, + limit=limit, + name_icontains=name_icontains, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + name_icontains: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedTagList]: + """ + Args: + limit (Union[Unset, int]): + name_icontains (Union[Unset, str]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedTagList] + """ + + kwargs = _get_kwargs( + limit=limit, + name_icontains=name_icontains, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + name_icontains: Union[Unset, str] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedTagList]: + """ + Args: + limit (Union[Unset, int]): + name_icontains (Union[Unset, str]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedTagList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + name_icontains=name_icontains, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_tags_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_tags_retrieve.py new file mode 100644 index 0000000..1305ef3 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_tags_retrieve.py @@ -0,0 +1,143 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.tag import Tag +from ...types import Response + + +def _get_kwargs( + id: int, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/tags/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Tag]: + if response.status_code == 200: + response_200 = Tag.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Tag]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: int, + *, + client: AuthenticatedClient, +) -> Response[Tag]: + """ + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Tag] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: int, + *, + client: AuthenticatedClient, +) -> Optional[Tag]: + """ + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Tag + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: int, + *, + client: AuthenticatedClient, +) -> Response[Tag]: + """ + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Tag] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: int, + *, + client: AuthenticatedClient, +) -> Optional[Tag]: + """ + Args: + id (int): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Tag + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_uploads_presign_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_uploads_presign_create.py new file mode 100644 index 0000000..ef1f272 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_uploads_presign_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.sign_content import SignContent +from ...types import Response + + +def _get_kwargs( + *, + body: SignContent, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/uploads/presign/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[SignContent]: + if response.status_code == 201: + response_201 = SignContent.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[SignContent]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: SignContent, +) -> Response[SignContent]: + """ + Args: + body (SignContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[SignContent] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: SignContent, +) -> Optional[SignContent]: + """ + Args: + body (SignContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + SignContent + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: SignContent, +) -> Response[SignContent]: + """ + Args: + body (SignContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[SignContent] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: SignContent, +) -> Optional[SignContent]: + """ + Args: + body (SignContent): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + SignContent + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_create.py new file mode 100644 index 0000000..667cf4d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit import Visit +from ...types import Response + + +def _get_kwargs( + *, + body: Visit, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/visits/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Visit]: + if response.status_code == 201: + response_201 = Visit.from_dict(response.json()) + + return response_201 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: Visit, +) -> Response[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: Visit, +) -> Optional[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: Visit, +) -> Response[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: Visit, +) -> Optional[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_finish_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_finish_create.py new file mode 100644 index 0000000..7368a25 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_finish_create.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit import Visit +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: Visit, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/visits/{id}/finish/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Visit]: + if response.status_code == 200: + response_200 = Visit.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: Visit, +) -> Response[Visit]: + """ + Args: + id (str): + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: Visit, +) -> Optional[Visit]: + """ + Args: + id (str): + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: Visit, +) -> Response[Visit]: + """ + Args: + id (str): + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: Visit, +) -> Optional[Visit]: + """ + Args: + id (str): + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_interact_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_interact_create.py new file mode 100644 index 0000000..54ddc0d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_interact_create.py @@ -0,0 +1,168 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit_interaction import VisitInteraction +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: VisitInteraction, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/visits/{id}/interact/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[VisitInteraction]: + if response.status_code == 200: + response_200 = VisitInteraction.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[VisitInteraction]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: VisitInteraction, +) -> Response[VisitInteraction]: + """ + Args: + id (str): + body (VisitInteraction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[VisitInteraction] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: VisitInteraction, +) -> Optional[VisitInteraction]: + """ + Args: + id (str): + body (VisitInteraction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + VisitInteraction + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: VisitInteraction, +) -> Response[VisitInteraction]: + """ + Args: + id (str): + body (VisitInteraction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[VisitInteraction] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: VisitInteraction, +) -> Optional[VisitInteraction]: + """ + Args: + id (str): + body (VisitInteraction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + VisitInteraction + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_list.py new file mode 100644 index 0000000..676dbf6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_list.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_visit_list import PaginatedVisitList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/visits/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedVisitList]: + if response.status_code == 200: + response_200 = PaginatedVisitList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedVisitList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedVisitList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedVisitList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedVisitList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedVisitList + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedVisitList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedVisitList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedVisitList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedVisitList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_react_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_react_create.py new file mode 100644 index 0000000..c5a0c3b --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_react_create.py @@ -0,0 +1,164 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit_reaction import VisitReaction +from ...types import Response + + +def _get_kwargs( + id: str, + *, + body: VisitReaction, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": f"/stores/visits/{id}/react/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[VisitReaction]: + if response.status_code == 200: + response_200 = VisitReaction.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[VisitReaction]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Response[VisitReaction]: + """ + Args: + id (str): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[VisitReaction] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Optional[VisitReaction]: + """ + Args: + id (str): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + VisitReaction + """ + + return sync_detailed( + id=id, + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Response[VisitReaction]: + """ + Args: + id (str): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[VisitReaction] + """ + + kwargs = _get_kwargs( + id=id, + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, + body: VisitReaction, +) -> Optional[VisitReaction]: + """ + Args: + id (str): + body (VisitReaction): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + VisitReaction + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_retrieve.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_retrieve.py new file mode 100644 index 0000000..55840b4 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_retrieve.py @@ -0,0 +1,143 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit import Visit +from ...types import Response + + +def _get_kwargs( + id: str, +) -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": f"/stores/visits/{id}/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Visit]: + if response.status_code == 200: + response_200 = Visit.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Visit]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Visit]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return sync_detailed( + id=id, + client=client, + ).parsed + + +async def asyncio_detailed( + id: str, + *, + client: AuthenticatedClient, +) -> Response[Visit]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + id=id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + id: str, + *, + client: AuthenticatedClient, +) -> Optional[Visit]: + """ + Args: + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return ( + await asyncio_detailed( + id=id, + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_visits_start_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_start_create.py new file mode 100644 index 0000000..7ddfbaf --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_visits_start_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.visit import Visit +from ...types import Response + + +def _get_kwargs( + *, + body: Visit, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/visits/start/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Visit]: + if response.status_code == 200: + response_200 = Visit.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Visit]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: Visit, +) -> Response[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: Visit, +) -> Optional[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: Visit, +) -> Response[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Visit] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: Visit, +) -> Optional[Visit]: + """ + Args: + body (Visit): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Visit + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_zones_check_in_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_check_in_create.py new file mode 100644 index 0000000..7584e71 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_check_in_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.check_in import CheckIn +from ...types import Response + + +def _get_kwargs( + *, + body: CheckIn, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/zones/check_in/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[CheckIn]: + if response.status_code == 200: + response_200 = CheckIn.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[CheckIn]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Response[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CheckIn] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Optional[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CheckIn + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Response[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CheckIn] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Optional[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CheckIn + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_zones_is_checked_in_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_is_checked_in_create.py new file mode 100644 index 0000000..a841aa5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_is_checked_in_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.check_in import CheckIn +from ...types import Response + + +def _get_kwargs( + *, + body: CheckIn, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/zones/is_checked_in/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[CheckIn]: + if response.status_code == 200: + response_200 = CheckIn.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[CheckIn]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Response[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CheckIn] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Optional[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CheckIn + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Response[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[CheckIn] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: CheckIn, +) -> Optional[CheckIn]: + """ + Args: + body (CheckIn): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + CheckIn + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_zones_list.py b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_list.py new file mode 100644 index 0000000..21b6b22 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_list.py @@ -0,0 +1,230 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_zone_list import PaginatedZoneList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: str, + location_lon: str, + offset: Union[Unset, int] = UNSET, + search: Union[Unset, str] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["location_dst"] = location_dst + + params["location_lat"] = location_lat + + params["location_lon"] = location_lon + + params["offset"] = offset + + params["search"] = search + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/stores/zones/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedZoneList]: + if response.status_code == 200: + response_200 = PaginatedZoneList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedZoneList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: str, + location_lon: str, + offset: Union[Unset, int] = UNSET, + search: Union[Unset, str] = UNSET, +) -> Response[PaginatedZoneList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (str): + location_lon (str): + offset (Union[Unset, int]): + search (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedZoneList] + """ + + kwargs = _get_kwargs( + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + offset=offset, + search=search, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: str, + location_lon: str, + offset: Union[Unset, int] = UNSET, + search: Union[Unset, str] = UNSET, +) -> Optional[PaginatedZoneList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (str): + location_lon (str): + offset (Union[Unset, int]): + search (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedZoneList + """ + + return sync_detailed( + client=client, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + offset=offset, + search=search, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: str, + location_lon: str, + offset: Union[Unset, int] = UNSET, + search: Union[Unset, str] = UNSET, +) -> Response[PaginatedZoneList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (str): + location_lon (str): + offset (Union[Unset, int]): + search (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedZoneList] + """ + + kwargs = _get_kwargs( + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + offset=offset, + search=search, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + location_dst: Union[Unset, str] = UNSET, + location_lat: str, + location_lon: str, + offset: Union[Unset, int] = UNSET, + search: Union[Unset, str] = UNSET, +) -> Optional[PaginatedZoneList]: + """ + Args: + limit (Union[Unset, int]): + location_dst (Union[Unset, str]): + location_lat (str): + location_lon (str): + offset (Union[Unset, int]): + search (Union[Unset, str]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedZoneList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + location_dst=location_dst, + location_lat=location_lat, + location_lon=location_lon, + offset=offset, + search=search, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/stores/stores_zones_status_create.py b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_status_create.py new file mode 100644 index 0000000..4548b12 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/stores/stores_zones_status_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.zone import Zone +from ...types import Response + + +def _get_kwargs( + *, + body: Zone, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/stores/zones/status/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Zone]: + if response.status_code == 200: + response_200 = Zone.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Zone]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: Zone, +) -> Response[Zone]: + """ + Args: + body (Zone): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Zone] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: Zone, +) -> Optional[Zone]: + """ + Args: + body (Zone): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Zone + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: Zone, +) -> Response[Zone]: + """ + Args: + body (Zone): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Zone] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: Zone, +) -> Optional[Zone]: + """ + Args: + body (Zone): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Zone + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/suggestions/__init__.py b/utils/clients/gooyal_advertising_client/api/suggestions/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/suggestions/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/utils/clients/gooyal_advertising_client/api/suggestions/suggestions_suggest_list.py b/utils/clients/gooyal_advertising_client/api/suggestions/suggestions_suggest_list.py new file mode 100644 index 0000000..a24e504 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/suggestions/suggestions_suggest_list.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.paginated_suggestion_list import PaginatedSuggestionList +from ...types import UNSET, Response, Unset + + +def _get_kwargs( + *, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> dict[str, Any]: + params: dict[str, Any] = {} + + params["limit"] = limit + + params["offset"] = offset + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/suggestions/suggest/", + "params": params, + } + + return _kwargs + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[PaginatedSuggestionList]: + if response.status_code == 200: + response_200 = PaginatedSuggestionList.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[PaginatedSuggestionList]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedSuggestionList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedSuggestionList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedSuggestionList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedSuggestionList + """ + + return sync_detailed( + client=client, + limit=limit, + offset=offset, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Response[PaginatedSuggestionList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[PaginatedSuggestionList] + """ + + kwargs = _get_kwargs( + limit=limit, + offset=offset, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + limit: Union[Unset, int] = UNSET, + offset: Union[Unset, int] = UNSET, +) -> Optional[PaginatedSuggestionList]: + """ + Args: + limit (Union[Unset, int]): + offset (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + PaginatedSuggestionList + """ + + return ( + await asyncio_detailed( + client=client, + limit=limit, + offset=offset, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/users/__init__.py b/utils/clients/gooyal_advertising_client/api/users/__init__.py new file mode 100644 index 0000000..2d7c0b2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/users/__init__.py @@ -0,0 +1 @@ +"""Contains endpoint functions for accessing the API""" diff --git a/utils/clients/gooyal_advertising_client/api/users/users_users_ban_create.py b/utils/clients/gooyal_advertising_client/api/users/users_users_ban_create.py new file mode 100644 index 0000000..c78f255 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/users/users_users_ban_create.py @@ -0,0 +1,151 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ban import Ban +from ...types import Response + + +def _get_kwargs( + *, + body: Ban, +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/users/users/ban/", + } + + _kwargs["json"] = body.to_dict() + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ban]: + if response.status_code == 200: + response_200 = Ban.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ban]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: Ban, +) -> Response[Ban]: + """ + Args: + body (Ban): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ban] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, + body: Ban, +) -> Optional[Ban]: + """ + Args: + body (Ban): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ban + """ + + return sync_detailed( + client=client, + body=body, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: Ban, +) -> Response[Ban]: + """ + Args: + body (Ban): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ban] + """ + + kwargs = _get_kwargs( + body=body, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, + body: Ban, +) -> Optional[Ban]: + """ + Args: + body (Ban): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ban + """ + + return ( + await asyncio_detailed( + client=client, + body=body, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/api/users/users_users_ban_retrieve.py b/utils/clients/gooyal_advertising_client/api/users/users_users_ban_retrieve.py new file mode 100644 index 0000000..5baf64f --- /dev/null +++ b/utils/clients/gooyal_advertising_client/api/users/users_users_ban_retrieve.py @@ -0,0 +1,119 @@ +from http import HTTPStatus +from typing import Any, Optional, Union + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.ban import Ban +from ...types import Response + + +def _get_kwargs() -> dict[str, Any]: + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/users/users/ban/", + } + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Ban]: + if response.status_code == 200: + response_200 = Ban.from_dict(response.json()) + + return response_200 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Ban]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, +) -> Response[Ban]: + """ + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ban] + """ + + kwargs = _get_kwargs() + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + *, + client: AuthenticatedClient, +) -> Optional[Ban]: + """ + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ban + """ + + return sync_detailed( + client=client, + ).parsed + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, +) -> Response[Ban]: + """ + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Ban] + """ + + kwargs = _get_kwargs() + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + *, + client: AuthenticatedClient, +) -> Optional[Ban]: + """ + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Ban + """ + + return ( + await asyncio_detailed( + client=client, + ) + ).parsed diff --git a/utils/clients/gooyal_advertising_client/client.py b/utils/clients/gooyal_advertising_client/client.py new file mode 100644 index 0000000..e80446f --- /dev/null +++ b/utils/clients/gooyal_advertising_client/client.py @@ -0,0 +1,268 @@ +import ssl +from typing import Any, Optional, Union + +import httpx +from attrs import define, evolve, field + + +@define +class Client: + """A class for keeping track of data related to the API + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + + Attributes: + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. Can also be provided as a keyword + argument to the constructor. + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + _base_url: str = field(alias="base_url") + _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + + def with_headers(self, headers: dict[str, str]) -> "Client": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: dict[str, str]) -> "Client": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "Client": + """Get a new client matching this one with a new timeout (in seconds)""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "Client": + """Manually set the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "Client": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": + """Manually the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "Client": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) + + +@define +class AuthenticatedClient: + """A Client which has been authenticated for use on secured endpoints + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + + Attributes: + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. Can also be provided as a keyword + argument to the constructor. + token: The token to use for authentication + prefix: The prefix to use for the Authorization header + auth_header_name: The name of the Authorization header + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + _base_url: str = field(alias="base_url") + _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + + token: str + prefix: str = "Bearer" + auth_header_name: str = "Authorization" + + def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + """Get a new client matching this one with a new timeout (in seconds)""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient": + """Manually set the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "AuthenticatedClient": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": + """Manually the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "AuthenticatedClient": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) diff --git a/utils/clients/gooyal_advertising_client/errors.py b/utils/clients/gooyal_advertising_client/errors.py new file mode 100644 index 0000000..5f92e76 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/errors.py @@ -0,0 +1,16 @@ +"""Contains shared errors types that can be raised from API functions""" + + +class UnexpectedStatus(Exception): + """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" + + def __init__(self, status_code: int, content: bytes): + self.status_code = status_code + self.content = content + + super().__init__( + f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" + ) + + +__all__ = ["UnexpectedStatus"] diff --git a/utils/clients/gooyal_advertising_client/models/__init__.py b/utils/clients/gooyal_advertising_client/models/__init__.py new file mode 100644 index 0000000..291f15d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/__init__.py @@ -0,0 +1,203 @@ +"""Contains all the data models used in inputs/outputs""" + +from .access_model_enum import AccessModelEnum +from .ad import Ad +from .ad_content import AdContent +from .ad_create import AdCreate +from .ad_create_location_type_0 import AdCreateLocationType0 +from .ad_create_location_type_0_type import AdCreateLocationType0Type +from .ad_create_new_location import AdCreateNewLocation +from .ad_create_new_location_type import AdCreateNewLocationType +from .ad_create_type_enum import AdCreateTypeEnum +from .ad_location_type_0 import AdLocationType0 +from .ad_location_type_0_type import AdLocationType0Type +from .ad_owner import AdOwner +from .ad_owner_location_type_0 import AdOwnerLocationType0 +from .ad_owner_location_type_0_type import AdOwnerLocationType0Type +from .ad_owner_new_location_type_0 import AdOwnerNewLocationType0 +from .ad_owner_new_location_type_0_type import AdOwnerNewLocationType0Type +from .ad_public import AdPublic +from .ad_public_location_type_0 import AdPublicLocationType0 +from .ad_public_location_type_0_type import AdPublicLocationType0Type +from .ad_report import AdReport +from .ad_statistic import AdStatistic +from .ad_visit_statistic import AdVisitStatistic +from .ad_with_visit import AdWithVisit +from .ad_with_visit_location_type_0 import AdWithVisitLocationType0 +from .ad_with_visit_location_type_0_type import AdWithVisitLocationType0Type +from .attendance_type_enum import AttendanceTypeEnum +from .ban import Ban +from .ban_level_enum import BanLevelEnum +from .capture import Capture +from .capture_location_type_0 import CaptureLocationType0 +from .capture_location_type_0_type import CaptureLocationType0Type +from .category_enum import CategoryEnum +from .check_in import CheckIn +from .check_in_location_type_0 import CheckInLocationType0 +from .check_in_location_type_0_type import CheckInLocationType0Type +from .cluster import Cluster +from .comment import Comment +from .comment_create import CommentCreate +from .config import Config +from .content_type_enum import ContentTypeEnum +from .new_content_type_enum import NewContentTypeEnum +from .paginated_ad_content_list import PaginatedAdContentList +from .paginated_ad_list import PaginatedAdList +from .paginated_ad_owner_list import PaginatedAdOwnerList +from .paginated_ad_public_list import PaginatedAdPublicList +from .paginated_ad_with_visit_list import PaginatedAdWithVisitList +from .paginated_comment_list import PaginatedCommentList +from .paginated_config_list import PaginatedConfigList +from .paginated_refined_ad_content_list import PaginatedRefinedAdContentList +from .paginated_suggestion_list import PaginatedSuggestionList +from .paginated_tag_list import PaginatedTagList +from .paginated_ticket_list import PaginatedTicketList +from .paginated_visit_list import PaginatedVisitList +from .paginated_zone_list import PaginatedZoneList +from .patched_ad_owner import PatchedAdOwner +from .patched_ad_owner_location_type_0 import PatchedAdOwnerLocationType0 +from .patched_ad_owner_location_type_0_type import PatchedAdOwnerLocationType0Type +from .patched_ad_owner_new_location_type_0 import PatchedAdOwnerNewLocationType0 +from .patched_ad_owner_new_location_type_0_type import PatchedAdOwnerNewLocationType0Type +from .patched_ticket import PatchedTicket +from .payment_state_enum import PaymentStateEnum +from .price_model_enum import PriceModelEnum +from .product_condition_enum import ProductConditionEnum +from .reaction_toggle import ReactionToggle +from .refined_ad_banner import RefinedAdBanner +from .refined_ad_content import RefinedAdContent +from .rejection_reason_enum import RejectionReasonEnum +from .report_category_enum import ReportCategoryEnum +from .role_enum import RoleEnum +from .sign_content import SignContent +from .state_634_enum import State634Enum +from .statistic import Statistic +from .stores_ads_bookmarked_list_ordering_item import StoresAdsBookmarkedListOrderingItem +from .stores_ads_clusterized_list_ordering_item import StoresAdsClusterizedListOrderingItem +from .stores_ads_list_ordering_item import StoresAdsListOrderingItem +from .stores_ads_public_clusterized_list_ordering_item import StoresAdsPublicClusterizedListOrderingItem +from .stores_ads_public_list_list_ordering_item import StoresAdsPublicListListOrderingItem +from .stores_ads_visited_list_ordering_item import StoresAdsVisitedListOrderingItem +from .stores_ads_with_visits_list_ordering_item import StoresAdsWithVisitsListOrderingItem +from .stores_statistic_retrieve_accept_language import StoresStatisticRetrieveAcceptLanguage +from .suggestion import Suggestion +from .tag import Tag +from .ticket import Ticket +from .ticket_state_enum import TicketStateEnum +from .transportation_cost_enum import TransportationCostEnum +from .type_0d9_enum import Type0D9Enum +from .value_type_enum import ValueTypeEnum +from .visit import Visit +from .visit_interaction import VisitInteraction +from .visit_interaction_type_enum import VisitInteractionTypeEnum +from .visit_location_type_0 import VisitLocationType0 +from .visit_location_type_0_type import VisitLocationType0Type +from .visit_reaction import VisitReaction +from .visit_state_enum import VisitStateEnum +from .zone import Zone +from .zone_area_type_0 import ZoneAreaType0 +from .zone_area_type_0_type import ZoneAreaType0Type +from .zone_state_enum import ZoneStateEnum +from .zone_type_enum import ZoneTypeEnum + +__all__ = ( + "AccessModelEnum", + "Ad", + "AdContent", + "AdCreate", + "AdCreateLocationType0", + "AdCreateLocationType0Type", + "AdCreateNewLocation", + "AdCreateNewLocationType", + "AdCreateTypeEnum", + "AdLocationType0", + "AdLocationType0Type", + "AdOwner", + "AdOwnerLocationType0", + "AdOwnerLocationType0Type", + "AdOwnerNewLocationType0", + "AdOwnerNewLocationType0Type", + "AdPublic", + "AdPublicLocationType0", + "AdPublicLocationType0Type", + "AdReport", + "AdStatistic", + "AdVisitStatistic", + "AdWithVisit", + "AdWithVisitLocationType0", + "AdWithVisitLocationType0Type", + "AttendanceTypeEnum", + "Ban", + "BanLevelEnum", + "Capture", + "CaptureLocationType0", + "CaptureLocationType0Type", + "CategoryEnum", + "CheckIn", + "CheckInLocationType0", + "CheckInLocationType0Type", + "Cluster", + "Comment", + "CommentCreate", + "Config", + "ContentTypeEnum", + "NewContentTypeEnum", + "PaginatedAdContentList", + "PaginatedAdList", + "PaginatedAdOwnerList", + "PaginatedAdPublicList", + "PaginatedAdWithVisitList", + "PaginatedCommentList", + "PaginatedConfigList", + "PaginatedRefinedAdContentList", + "PaginatedSuggestionList", + "PaginatedTagList", + "PaginatedTicketList", + "PaginatedVisitList", + "PaginatedZoneList", + "PatchedAdOwner", + "PatchedAdOwnerLocationType0", + "PatchedAdOwnerLocationType0Type", + "PatchedAdOwnerNewLocationType0", + "PatchedAdOwnerNewLocationType0Type", + "PatchedTicket", + "PaymentStateEnum", + "PriceModelEnum", + "ProductConditionEnum", + "ReactionToggle", + "RefinedAdBanner", + "RefinedAdContent", + "RejectionReasonEnum", + "ReportCategoryEnum", + "RoleEnum", + "SignContent", + "State634Enum", + "Statistic", + "StoresAdsBookmarkedListOrderingItem", + "StoresAdsClusterizedListOrderingItem", + "StoresAdsListOrderingItem", + "StoresAdsPublicClusterizedListOrderingItem", + "StoresAdsPublicListListOrderingItem", + "StoresAdsVisitedListOrderingItem", + "StoresAdsWithVisitsListOrderingItem", + "StoresStatisticRetrieveAcceptLanguage", + "Suggestion", + "Tag", + "Ticket", + "TicketStateEnum", + "TransportationCostEnum", + "Type0D9Enum", + "ValueTypeEnum", + "Visit", + "VisitInteraction", + "VisitInteractionTypeEnum", + "VisitLocationType0", + "VisitLocationType0Type", + "VisitReaction", + "VisitStateEnum", + "Zone", + "ZoneAreaType0", + "ZoneAreaType0Type", + "ZoneStateEnum", + "ZoneTypeEnum", +) diff --git a/utils/clients/gooyal_advertising_client/models/access_model_enum.py b/utils/clients/gooyal_advertising_client/models/access_model_enum.py new file mode 100644 index 0000000..be92a77 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/access_model_enum.py @@ -0,0 +1,11 @@ +from enum import IntEnum + + +class AccessModelEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + VALUE_4 = 4 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad.py b/utils/clients/gooyal_advertising_client/models/ad.py new file mode 100644 index 0000000..5738968 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad.py @@ -0,0 +1,337 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .type_0d9_enum import Type0D9Enum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_location_type_0 import AdLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="Ad") + + +@_attrs_define +class Ad: + """ + Attributes: + uuid (UUID): + title (Union[None, str]): + type_ (Type0D9Enum): * `1` - BILLBOARD + * `2` - CAPTURED_BILLBOARD + * `99` - PROMOTION + * `100` - CONSTANT + details (Any): + content (str): + contents (list['AdContent']): + refined_contents (list['RefinedAdContent']): + description (Union[None, str]): + location (Union['AdLocationType0', None]): + location_is_approximate (bool): + banner (Union[None, str]): + reward_amount (int): + reward_count (int): + address (Union[None, str]): + url (Union[None, str]): + tags (list[str]): + created_at (datetime.datetime): + updated_at (datetime.datetime): + display_time (str): + status (str): + user_uuid (UUID): + comments_count (str): + likes_count (str): + refined_banner (Union[Unset, RefinedAdBanner]): + """ + + uuid: UUID + title: Union[None, str] + type_: Type0D9Enum + details: Any + content: str + contents: list["AdContent"] + refined_contents: list["RefinedAdContent"] + description: Union[None, str] + location: Union["AdLocationType0", None] + location_is_approximate: bool + banner: Union[None, str] + reward_amount: int + reward_count: int + address: Union[None, str] + url: Union[None, str] + tags: list[str] + created_at: datetime.datetime + updated_at: datetime.datetime + display_time: str + status: str + user_uuid: UUID + comments_count: str + likes_count: str + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .ad_location_type_0 import AdLocationType0 + + uuid = str(self.uuid) + + title: Union[None, str] + title = self.title + + type_ = self.type_.value + + details = self.details + + content = self.content + + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, str] + description = self.description + + location: Union[None, dict[str, Any]] + if isinstance(self.location, AdLocationType0): + location = self.location.to_dict() + else: + location = self.location + + location_is_approximate = self.location_is_approximate + + banner: Union[None, str] + banner = self.banner + + reward_amount = self.reward_amount + + reward_count = self.reward_count + + address: Union[None, str] + address = self.address + + url: Union[None, str] + url = self.url + + tags = self.tags + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + display_time = self.display_time + + status = self.status + + user_uuid = str(self.user_uuid) + + comments_count = self.comments_count + + likes_count = self.likes_count + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "title": title, + "type": type_, + "details": details, + "content": content, + "contents": contents, + "refined_contents": refined_contents, + "description": description, + "location": location, + "location_is_approximate": location_is_approximate, + "banner": banner, + "reward_amount": reward_amount, + "reward_count": reward_count, + "address": address, + "url": url, + "tags": tags, + "created_at": created_at, + "updated_at": updated_at, + "display_time": display_time, + "status": status, + "user_uuid": user_uuid, + "comments_count": comments_count, + "likes_count": likes_count, + } + ) + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_location_type_0 import AdLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_title(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + title = _parse_title(d.pop("title")) + + type_ = Type0D9Enum(d.pop("type")) + + details = d.pop("details") + + content = d.pop("content") + + contents = [] + _contents = d.pop("contents") + for contents_item_data in _contents: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents") + for refined_contents_item_data in _refined_contents: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + description = _parse_description(d.pop("description")) + + def _parse_location(data: object) -> Union["AdLocationType0", None]: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = AdLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["AdLocationType0", None], data) + + location = _parse_location(d.pop("location")) + + location_is_approximate = d.pop("location_is_approximate") + + def _parse_banner(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + banner = _parse_banner(d.pop("banner")) + + reward_amount = d.pop("reward_amount") + + reward_count = d.pop("reward_count") + + def _parse_address(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + address = _parse_address(d.pop("address")) + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + tags = cast(list[str], d.pop("tags")) + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + display_time = d.pop("display_time") + + status = d.pop("status") + + user_uuid = UUID(d.pop("user_uuid")) + + comments_count = d.pop("comments_count") + + likes_count = d.pop("likes_count") + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + ad = cls( + uuid=uuid, + title=title, + type_=type_, + details=details, + content=content, + contents=contents, + refined_contents=refined_contents, + description=description, + location=location, + location_is_approximate=location_is_approximate, + banner=banner, + reward_amount=reward_amount, + reward_count=reward_count, + address=address, + url=url, + tags=tags, + created_at=created_at, + updated_at=updated_at, + display_time=display_time, + status=status, + user_uuid=user_uuid, + comments_count=comments_count, + likes_count=likes_count, + refined_banner=refined_banner, + ) + + ad.additional_properties = d + return ad + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_content.py b/utils/clients/gooyal_advertising_client/models/ad_content.py new file mode 100644 index 0000000..0bc32d5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_content.py @@ -0,0 +1,138 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .content_type_enum import ContentTypeEnum +from .state_634_enum import State634Enum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdContent") + + +@_attrs_define +class AdContent: + """ + Attributes: + uuid (UUID): + file (Union[None, Unset, str]): + content_type (Union[Unset, ContentTypeEnum]): * `1` - image + * `2` - voice + * `3` - video + * `4` - document + order (Union[Unset, int]): + state (Union[Unset, State634Enum]): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + """ + + uuid: UUID + file: Union[None, Unset, str] = UNSET + content_type: Union[Unset, ContentTypeEnum] = UNSET + order: Union[Unset, int] = UNSET + state: Union[Unset, State634Enum] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + file: Union[None, Unset, str] + if isinstance(self.file, Unset): + file = UNSET + else: + file = self.file + + content_type: Union[Unset, int] = UNSET + if not isinstance(self.content_type, Unset): + content_type = self.content_type.value + + order = self.order + + state: Union[Unset, int] = UNSET + if not isinstance(self.state, Unset): + state = self.state.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + } + ) + if file is not UNSET: + field_dict["file"] = file + if content_type is not UNSET: + field_dict["content_type"] = content_type + if order is not UNSET: + field_dict["order"] = order + if state is not UNSET: + field_dict["state"] = state + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_file(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + file = _parse_file(d.pop("file", UNSET)) + + _content_type = d.pop("content_type", UNSET) + content_type: Union[Unset, ContentTypeEnum] + if isinstance(_content_type, Unset): + content_type = UNSET + else: + content_type = ContentTypeEnum(_content_type) + + order = d.pop("order", UNSET) + + _state = d.pop("state", UNSET) + state: Union[Unset, State634Enum] + if isinstance(_state, Unset): + state = UNSET + else: + state = State634Enum(_state) + + ad_content = cls( + uuid=uuid, + file=file, + content_type=content_type, + order=order, + state=state, + ) + + ad_content.additional_properties = d + return ad_content + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_create.py b/utils/clients/gooyal_advertising_client/models/ad_create.py new file mode 100644 index 0000000..b167644 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_create.py @@ -0,0 +1,1007 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .access_model_enum import AccessModelEnum +from .ad_create_type_enum import AdCreateTypeEnum +from .attendance_type_enum import AttendanceTypeEnum +from .category_enum import CategoryEnum +from .new_content_type_enum import NewContentTypeEnum +from .payment_state_enum import PaymentStateEnum +from .price_model_enum import PriceModelEnum +from .product_condition_enum import ProductConditionEnum +from .rejection_reason_enum import RejectionReasonEnum +from .role_enum import RoleEnum +from .state_634_enum import State634Enum +from .transportation_cost_enum import TransportationCostEnum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_create_location_type_0 import AdCreateLocationType0 + from .ad_create_new_location import AdCreateNewLocation + from .ad_statistic import AdStatistic + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="AdCreate") + + +@_attrs_define +class AdCreate: + """ + Attributes: + uuid (UUID): + title (Union[None, str]): + content (str): + contents (list['AdContent']): + refined_contents (list['RefinedAdContent']): + description (Union[None, str]): + location (Union['AdCreateLocationType0', None]): + banner (Union[None, str]): + reward_amount (int): + reward_count (int): + address (Union[None, str]): + url (Union[None, str]): + phone_number (Union[None, str]): + social_link (Union[None, str]): + tags (Union[None, list[str]]): + new_location (AdCreateNewLocation): + payment_state (PaymentStateEnum): * `1` - created + * `2` - delayed + * `3` - pending + * `4` - incomplete + * `5` - success + * `6` - failed + * `7` - expected_failure + state (State634Enum): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + get_payment_state_display (str): + get_state_display (str): + rejection_reason (Union[None, RejectionReasonEnum]): + created_at (datetime.datetime): + updated_at (datetime.datetime): + display_time (str): + status (str): + user_uuid (UUID): + comments_count (str): + likes_count (str): + state_ordering (str): + statistics (AdStatistic): + type_ (Union[Unset, AdCreateTypeEnum]): * `1` - 1 + * `BILLBOARD` - BILLBOARD + * `100` - 100 + * `CONSTANT` - CONSTANT Default: AdCreateTypeEnum.VALUE_0. + category (Union[Unset, CategoryEnum]): * `1` - PRODUCT + * `2` - SERVICE + * `3` - SOCIAL_CONTENT + role (Union[Unset, RoleEnum]): * `1` - provider + * `2` - requester + price_model (Union[None, PriceModelEnum, Unset]): + price_detail (Union[Unset, Any]): + product_condition (Union[None, ProductConditionEnum, Unset]): + access_model (Union[Unset, AccessModelEnum]): * `1` - free + * `2` - viewer_reward + * `3` - tip_supported + * `4` - paid_only + attendance_type (Union[AttendanceTypeEnum, None, Unset]): + can_republish (Union[None, Unset, bool]): + transportation_cost (Union[None, TransportationCostEnum, Unset]): + work_end_time (Union[None, Unset, int]): + work_start_time (Union[None, Unset, int]): + details (Union[Unset, Any]): + location_is_approximate (Union[Unset, bool]): + refined_banner (Union[Unset, RefinedAdBanner]): + balance (Union[None, Unset, int]): + new_title (Union[None, Unset, str]): + new_description (Union[None, Unset, str]): + new_banner (Union[None, Unset, str]): + new_content (Union[None, Unset, str]): + new_content_type (Union[NewContentTypeEnum, None, Unset]): + new_url (Union[None, Unset, str]): + new_tags (Union[Unset, Any]): + new_address (Union[None, Unset, str]): + new_phone_number (Union[None, Unset, str]): + new_social_link (Union[None, Unset, str]): + new_reward_amount (Union[None, Unset, int]): + new_reward_count (Union[None, Unset, int]): + """ + + uuid: UUID + title: Union[None, str] + content: str + contents: list["AdContent"] + refined_contents: list["RefinedAdContent"] + description: Union[None, str] + location: Union["AdCreateLocationType0", None] + banner: Union[None, str] + reward_amount: int + reward_count: int + address: Union[None, str] + url: Union[None, str] + phone_number: Union[None, str] + social_link: Union[None, str] + tags: Union[None, list[str]] + new_location: "AdCreateNewLocation" + payment_state: PaymentStateEnum + state: State634Enum + get_payment_state_display: str + get_state_display: str + rejection_reason: Union[None, RejectionReasonEnum] + created_at: datetime.datetime + updated_at: datetime.datetime + display_time: str + status: str + user_uuid: UUID + comments_count: str + likes_count: str + state_ordering: str + statistics: "AdStatistic" + type_: Union[Unset, AdCreateTypeEnum] = AdCreateTypeEnum.VALUE_0 + category: Union[Unset, CategoryEnum] = UNSET + role: Union[Unset, RoleEnum] = UNSET + price_model: Union[None, PriceModelEnum, Unset] = UNSET + price_detail: Union[Unset, Any] = UNSET + product_condition: Union[None, ProductConditionEnum, Unset] = UNSET + access_model: Union[Unset, AccessModelEnum] = UNSET + attendance_type: Union[AttendanceTypeEnum, None, Unset] = UNSET + can_republish: Union[None, Unset, bool] = UNSET + transportation_cost: Union[None, TransportationCostEnum, Unset] = UNSET + work_end_time: Union[None, Unset, int] = UNSET + work_start_time: Union[None, Unset, int] = UNSET + details: Union[Unset, Any] = UNSET + location_is_approximate: Union[Unset, bool] = UNSET + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + balance: Union[None, Unset, int] = UNSET + new_title: Union[None, Unset, str] = UNSET + new_description: Union[None, Unset, str] = UNSET + new_banner: Union[None, Unset, str] = UNSET + new_content: Union[None, Unset, str] = UNSET + new_content_type: Union[NewContentTypeEnum, None, Unset] = UNSET + new_url: Union[None, Unset, str] = UNSET + new_tags: Union[Unset, Any] = UNSET + new_address: Union[None, Unset, str] = UNSET + new_phone_number: Union[None, Unset, str] = UNSET + new_social_link: Union[None, Unset, str] = UNSET + new_reward_amount: Union[None, Unset, int] = UNSET + new_reward_count: Union[None, Unset, int] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .ad_create_location_type_0 import AdCreateLocationType0 + + uuid = str(self.uuid) + + title: Union[None, str] + title = self.title + + content = self.content + + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, str] + description = self.description + + location: Union[None, dict[str, Any]] + if isinstance(self.location, AdCreateLocationType0): + location = self.location.to_dict() + else: + location = self.location + + banner: Union[None, str] + banner = self.banner + + reward_amount = self.reward_amount + + reward_count = self.reward_count + + address: Union[None, str] + address = self.address + + url: Union[None, str] + url = self.url + + phone_number: Union[None, str] + phone_number = self.phone_number + + social_link: Union[None, str] + social_link = self.social_link + + tags: Union[None, list[str]] + if isinstance(self.tags, list): + tags = self.tags + + else: + tags = self.tags + + new_location = self.new_location.to_dict() + + payment_state = self.payment_state.value + + state = self.state.value + + get_payment_state_display = self.get_payment_state_display + + get_state_display = self.get_state_display + + rejection_reason: Union[None, str] + if isinstance(self.rejection_reason, RejectionReasonEnum): + rejection_reason = self.rejection_reason.value + else: + rejection_reason = self.rejection_reason + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + display_time = self.display_time + + status = self.status + + user_uuid = str(self.user_uuid) + + comments_count = self.comments_count + + likes_count = self.likes_count + + state_ordering = self.state_ordering + + statistics = self.statistics.to_dict() + + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + category: Union[Unset, int] = UNSET + if not isinstance(self.category, Unset): + category = self.category.value + + role: Union[Unset, int] = UNSET + if not isinstance(self.role, Unset): + role = self.role.value + + price_model: Union[None, Unset, int] + if isinstance(self.price_model, Unset): + price_model = UNSET + elif isinstance(self.price_model, PriceModelEnum): + price_model = self.price_model.value + else: + price_model = self.price_model + + price_detail = self.price_detail + + product_condition: Union[None, Unset, int] + if isinstance(self.product_condition, Unset): + product_condition = UNSET + elif isinstance(self.product_condition, ProductConditionEnum): + product_condition = self.product_condition.value + else: + product_condition = self.product_condition + + access_model: Union[Unset, int] = UNSET + if not isinstance(self.access_model, Unset): + access_model = self.access_model.value + + attendance_type: Union[None, Unset, int] + if isinstance(self.attendance_type, Unset): + attendance_type = UNSET + elif isinstance(self.attendance_type, AttendanceTypeEnum): + attendance_type = self.attendance_type.value + else: + attendance_type = self.attendance_type + + can_republish: Union[None, Unset, bool] + if isinstance(self.can_republish, Unset): + can_republish = UNSET + else: + can_republish = self.can_republish + + transportation_cost: Union[None, Unset, int] + if isinstance(self.transportation_cost, Unset): + transportation_cost = UNSET + elif isinstance(self.transportation_cost, TransportationCostEnum): + transportation_cost = self.transportation_cost.value + else: + transportation_cost = self.transportation_cost + + work_end_time: Union[None, Unset, int] + if isinstance(self.work_end_time, Unset): + work_end_time = UNSET + else: + work_end_time = self.work_end_time + + work_start_time: Union[None, Unset, int] + if isinstance(self.work_start_time, Unset): + work_start_time = UNSET + else: + work_start_time = self.work_start_time + + details = self.details + + location_is_approximate = self.location_is_approximate + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + balance: Union[None, Unset, int] + if isinstance(self.balance, Unset): + balance = UNSET + else: + balance = self.balance + + new_title: Union[None, Unset, str] + if isinstance(self.new_title, Unset): + new_title = UNSET + else: + new_title = self.new_title + + new_description: Union[None, Unset, str] + if isinstance(self.new_description, Unset): + new_description = UNSET + else: + new_description = self.new_description + + new_banner: Union[None, Unset, str] + if isinstance(self.new_banner, Unset): + new_banner = UNSET + else: + new_banner = self.new_banner + + new_content: Union[None, Unset, str] + if isinstance(self.new_content, Unset): + new_content = UNSET + else: + new_content = self.new_content + + new_content_type: Union[None, Unset, int] + if isinstance(self.new_content_type, Unset): + new_content_type = UNSET + elif isinstance(self.new_content_type, NewContentTypeEnum): + new_content_type = self.new_content_type.value + else: + new_content_type = self.new_content_type + + new_url: Union[None, Unset, str] + if isinstance(self.new_url, Unset): + new_url = UNSET + else: + new_url = self.new_url + + new_tags = self.new_tags + + new_address: Union[None, Unset, str] + if isinstance(self.new_address, Unset): + new_address = UNSET + else: + new_address = self.new_address + + new_phone_number: Union[None, Unset, str] + if isinstance(self.new_phone_number, Unset): + new_phone_number = UNSET + else: + new_phone_number = self.new_phone_number + + new_social_link: Union[None, Unset, str] + if isinstance(self.new_social_link, Unset): + new_social_link = UNSET + else: + new_social_link = self.new_social_link + + new_reward_amount: Union[None, Unset, int] + if isinstance(self.new_reward_amount, Unset): + new_reward_amount = UNSET + else: + new_reward_amount = self.new_reward_amount + + new_reward_count: Union[None, Unset, int] + if isinstance(self.new_reward_count, Unset): + new_reward_count = UNSET + else: + new_reward_count = self.new_reward_count + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "title": title, + "content": content, + "contents": contents, + "refined_contents": refined_contents, + "description": description, + "location": location, + "banner": banner, + "reward_amount": reward_amount, + "reward_count": reward_count, + "address": address, + "url": url, + "phone_number": phone_number, + "social_link": social_link, + "tags": tags, + "new_location": new_location, + "payment_state": payment_state, + "state": state, + "get_payment_state_display": get_payment_state_display, + "get_state_display": get_state_display, + "rejection_reason": rejection_reason, + "created_at": created_at, + "updated_at": updated_at, + "display_time": display_time, + "status": status, + "user_uuid": user_uuid, + "comments_count": comments_count, + "likes_count": likes_count, + "state_ordering": state_ordering, + "statistics": statistics, + } + ) + if type_ is not UNSET: + field_dict["type"] = type_ + if category is not UNSET: + field_dict["category"] = category + if role is not UNSET: + field_dict["role"] = role + if price_model is not UNSET: + field_dict["price_model"] = price_model + if price_detail is not UNSET: + field_dict["price_detail"] = price_detail + if product_condition is not UNSET: + field_dict["product_condition"] = product_condition + if access_model is not UNSET: + field_dict["access_model"] = access_model + if attendance_type is not UNSET: + field_dict["attendance_type"] = attendance_type + if can_republish is not UNSET: + field_dict["can_republish"] = can_republish + if transportation_cost is not UNSET: + field_dict["transportation_cost"] = transportation_cost + if work_end_time is not UNSET: + field_dict["work_end_time"] = work_end_time + if work_start_time is not UNSET: + field_dict["work_start_time"] = work_start_time + if details is not UNSET: + field_dict["details"] = details + if location_is_approximate is not UNSET: + field_dict["location_is_approximate"] = location_is_approximate + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + if balance is not UNSET: + field_dict["balance"] = balance + if new_title is not UNSET: + field_dict["new_title"] = new_title + if new_description is not UNSET: + field_dict["new_description"] = new_description + if new_banner is not UNSET: + field_dict["new_banner"] = new_banner + if new_content is not UNSET: + field_dict["new_content"] = new_content + if new_content_type is not UNSET: + field_dict["new_content_type"] = new_content_type + if new_url is not UNSET: + field_dict["new_url"] = new_url + if new_tags is not UNSET: + field_dict["new_tags"] = new_tags + if new_address is not UNSET: + field_dict["new_address"] = new_address + if new_phone_number is not UNSET: + field_dict["new_phone_number"] = new_phone_number + if new_social_link is not UNSET: + field_dict["new_social_link"] = new_social_link + if new_reward_amount is not UNSET: + field_dict["new_reward_amount"] = new_reward_amount + if new_reward_count is not UNSET: + field_dict["new_reward_count"] = new_reward_count + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_create_location_type_0 import AdCreateLocationType0 + from .ad_create_new_location import AdCreateNewLocation + from .ad_statistic import AdStatistic + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_title(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + title = _parse_title(d.pop("title")) + + content = d.pop("content") + + contents = [] + _contents = d.pop("contents") + for contents_item_data in _contents: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents") + for refined_contents_item_data in _refined_contents: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + description = _parse_description(d.pop("description")) + + def _parse_location(data: object) -> Union["AdCreateLocationType0", None]: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = AdCreateLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["AdCreateLocationType0", None], data) + + location = _parse_location(d.pop("location")) + + def _parse_banner(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + banner = _parse_banner(d.pop("banner")) + + reward_amount = d.pop("reward_amount") + + reward_count = d.pop("reward_count") + + def _parse_address(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + address = _parse_address(d.pop("address")) + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + def _parse_phone_number(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + phone_number = _parse_phone_number(d.pop("phone_number")) + + def _parse_social_link(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + social_link = _parse_social_link(d.pop("social_link")) + + def _parse_tags(data: object) -> Union[None, list[str]]: + if data is None: + return data + try: + if not isinstance(data, list): + raise TypeError() + tags_type_0 = cast(list[str], data) + + return tags_type_0 + except: # noqa: E722 + pass + return cast(Union[None, list[str]], data) + + tags = _parse_tags(d.pop("tags")) + + new_location = AdCreateNewLocation.from_dict(d.pop("new_location")) + + payment_state = PaymentStateEnum(d.pop("payment_state")) + + state = State634Enum(d.pop("state")) + + get_payment_state_display = d.pop("get_payment_state_display") + + get_state_display = d.pop("get_state_display") + + def _parse_rejection_reason(data: object) -> Union[None, RejectionReasonEnum]: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + rejection_reason_type_0 = RejectionReasonEnum(data) + + return rejection_reason_type_0 + except: # noqa: E722 + pass + return cast(Union[None, RejectionReasonEnum], data) + + rejection_reason = _parse_rejection_reason(d.pop("rejection_reason")) + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + display_time = d.pop("display_time") + + status = d.pop("status") + + user_uuid = UUID(d.pop("user_uuid")) + + comments_count = d.pop("comments_count") + + likes_count = d.pop("likes_count") + + state_ordering = d.pop("state_ordering") + + statistics = AdStatistic.from_dict(d.pop("statistics")) + + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdCreateTypeEnum] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdCreateTypeEnum(_type_) + + _category = d.pop("category", UNSET) + category: Union[Unset, CategoryEnum] + if isinstance(_category, Unset): + category = UNSET + else: + category = CategoryEnum(_category) + + _role = d.pop("role", UNSET) + role: Union[Unset, RoleEnum] + if isinstance(_role, Unset): + role = UNSET + else: + role = RoleEnum(_role) + + def _parse_price_model(data: object) -> Union[None, PriceModelEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + price_model_type_0 = PriceModelEnum(data) + + return price_model_type_0 + except: # noqa: E722 + pass + return cast(Union[None, PriceModelEnum, Unset], data) + + price_model = _parse_price_model(d.pop("price_model", UNSET)) + + price_detail = d.pop("price_detail", UNSET) + + def _parse_product_condition(data: object) -> Union[None, ProductConditionEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + product_condition_type_0 = ProductConditionEnum(data) + + return product_condition_type_0 + except: # noqa: E722 + pass + return cast(Union[None, ProductConditionEnum, Unset], data) + + product_condition = _parse_product_condition(d.pop("product_condition", UNSET)) + + _access_model = d.pop("access_model", UNSET) + access_model: Union[Unset, AccessModelEnum] + if isinstance(_access_model, Unset): + access_model = UNSET + else: + access_model = AccessModelEnum(_access_model) + + def _parse_attendance_type(data: object) -> Union[AttendanceTypeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + attendance_type_type_0 = AttendanceTypeEnum(data) + + return attendance_type_type_0 + except: # noqa: E722 + pass + return cast(Union[AttendanceTypeEnum, None, Unset], data) + + attendance_type = _parse_attendance_type(d.pop("attendance_type", UNSET)) + + def _parse_can_republish(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + can_republish = _parse_can_republish(d.pop("can_republish", UNSET)) + + def _parse_transportation_cost(data: object) -> Union[None, TransportationCostEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + transportation_cost_type_0 = TransportationCostEnum(data) + + return transportation_cost_type_0 + except: # noqa: E722 + pass + return cast(Union[None, TransportationCostEnum, Unset], data) + + transportation_cost = _parse_transportation_cost(d.pop("transportation_cost", UNSET)) + + def _parse_work_end_time(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + work_end_time = _parse_work_end_time(d.pop("work_end_time", UNSET)) + + def _parse_work_start_time(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + work_start_time = _parse_work_start_time(d.pop("work_start_time", UNSET)) + + details = d.pop("details", UNSET) + + location_is_approximate = d.pop("location_is_approximate", UNSET) + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + def _parse_balance(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + balance = _parse_balance(d.pop("balance", UNSET)) + + def _parse_new_title(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_title = _parse_new_title(d.pop("new_title", UNSET)) + + def _parse_new_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_description = _parse_new_description(d.pop("new_description", UNSET)) + + def _parse_new_banner(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_banner = _parse_new_banner(d.pop("new_banner", UNSET)) + + def _parse_new_content(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_content = _parse_new_content(d.pop("new_content", UNSET)) + + def _parse_new_content_type(data: object) -> Union[NewContentTypeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + new_content_type_type_0 = NewContentTypeEnum(data) + + return new_content_type_type_0 + except: # noqa: E722 + pass + return cast(Union[NewContentTypeEnum, None, Unset], data) + + new_content_type = _parse_new_content_type(d.pop("new_content_type", UNSET)) + + def _parse_new_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_url = _parse_new_url(d.pop("new_url", UNSET)) + + new_tags = d.pop("new_tags", UNSET) + + def _parse_new_address(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_address = _parse_new_address(d.pop("new_address", UNSET)) + + def _parse_new_phone_number(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_phone_number = _parse_new_phone_number(d.pop("new_phone_number", UNSET)) + + def _parse_new_social_link(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_social_link = _parse_new_social_link(d.pop("new_social_link", UNSET)) + + def _parse_new_reward_amount(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_amount = _parse_new_reward_amount(d.pop("new_reward_amount", UNSET)) + + def _parse_new_reward_count(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_count = _parse_new_reward_count(d.pop("new_reward_count", UNSET)) + + ad_create = cls( + uuid=uuid, + title=title, + content=content, + contents=contents, + refined_contents=refined_contents, + description=description, + location=location, + banner=banner, + reward_amount=reward_amount, + reward_count=reward_count, + address=address, + url=url, + phone_number=phone_number, + social_link=social_link, + tags=tags, + new_location=new_location, + payment_state=payment_state, + state=state, + get_payment_state_display=get_payment_state_display, + get_state_display=get_state_display, + rejection_reason=rejection_reason, + created_at=created_at, + updated_at=updated_at, + display_time=display_time, + status=status, + user_uuid=user_uuid, + comments_count=comments_count, + likes_count=likes_count, + state_ordering=state_ordering, + statistics=statistics, + type_=type_, + category=category, + role=role, + price_model=price_model, + price_detail=price_detail, + product_condition=product_condition, + access_model=access_model, + attendance_type=attendance_type, + can_republish=can_republish, + transportation_cost=transportation_cost, + work_end_time=work_end_time, + work_start_time=work_start_time, + details=details, + location_is_approximate=location_is_approximate, + refined_banner=refined_banner, + balance=balance, + new_title=new_title, + new_description=new_description, + new_banner=new_banner, + new_content=new_content, + new_content_type=new_content_type, + new_url=new_url, + new_tags=new_tags, + new_address=new_address, + new_phone_number=new_phone_number, + new_social_link=new_social_link, + new_reward_amount=new_reward_amount, + new_reward_count=new_reward_count, + ) + + ad_create.additional_properties = d + return ad_create + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_create_location_type_0.py b/utils/clients/gooyal_advertising_client/models/ad_create_location_type_0.py new file mode 100644 index 0000000..62356f5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_create_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_create_location_type_0_type import AdCreateLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdCreateLocationType0") + + +@_attrs_define +class AdCreateLocationType0: + """ + Attributes: + type_ (Union[Unset, AdCreateLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdCreateLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdCreateLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdCreateLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_create_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_create_location_type_0.additional_properties = d + return ad_create_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_create_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/ad_create_location_type_0_type.py new file mode 100644 index 0000000..eee97d8 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_create_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdCreateLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_create_new_location.py b/utils/clients/gooyal_advertising_client/models/ad_create_new_location.py new file mode 100644 index 0000000..43ebfa1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_create_new_location.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_create_new_location_type import AdCreateNewLocationType +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdCreateNewLocation") + + +@_attrs_define +class AdCreateNewLocation: + """ + Attributes: + type_ (Union[Unset, AdCreateNewLocationType]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdCreateNewLocationType] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdCreateNewLocationType] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdCreateNewLocationType(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_create_new_location = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_create_new_location.additional_properties = d + return ad_create_new_location + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_create_new_location_type.py b/utils/clients/gooyal_advertising_client/models/ad_create_new_location_type.py new file mode 100644 index 0000000..5c006d0 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_create_new_location_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdCreateNewLocationType(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_create_type_enum.py b/utils/clients/gooyal_advertising_client/models/ad_create_type_enum.py new file mode 100644 index 0000000..3e54e4c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_create_type_enum.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class AdCreateTypeEnum(str, Enum): + BILLBOARD = "BILLBOARD" + CONSTANT = "CONSTANT" + VALUE_0 = "1" + VALUE_2 = "100" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_location_type_0.py b/utils/clients/gooyal_advertising_client/models/ad_location_type_0.py new file mode 100644 index 0000000..f1338db --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_location_type_0_type import AdLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdLocationType0") + + +@_attrs_define +class AdLocationType0: + """ + Attributes: + type_ (Union[Unset, AdLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_location_type_0.additional_properties = d + return ad_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/ad_location_type_0_type.py new file mode 100644 index 0000000..05c303d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_owner.py b/utils/clients/gooyal_advertising_client/models/ad_owner.py new file mode 100644 index 0000000..6a599f1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_owner.py @@ -0,0 +1,1022 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .access_model_enum import AccessModelEnum +from .attendance_type_enum import AttendanceTypeEnum +from .category_enum import CategoryEnum +from .new_content_type_enum import NewContentTypeEnum +from .payment_state_enum import PaymentStateEnum +from .price_model_enum import PriceModelEnum +from .product_condition_enum import ProductConditionEnum +from .rejection_reason_enum import RejectionReasonEnum +from .role_enum import RoleEnum +from .state_634_enum import State634Enum +from .transportation_cost_enum import TransportationCostEnum +from .type_0d9_enum import Type0D9Enum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_owner_location_type_0 import AdOwnerLocationType0 + from .ad_owner_new_location_type_0 import AdOwnerNewLocationType0 + from .ad_statistic import AdStatistic + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="AdOwner") + + +@_attrs_define +class AdOwner: + """ + Attributes: + uuid (UUID): + title (Union[None, str]): + type_ (Type0D9Enum): * `1` - BILLBOARD + * `2` - CAPTURED_BILLBOARD + * `99` - PROMOTION + * `100` - CONSTANT + content (str): + contents (list['AdContent']): + refined_contents (list['RefinedAdContent']): + description (Union[None, str]): + location (Union['AdOwnerLocationType0', None]): + banner (Union[None, str]): + reward_amount (int): + reward_count (int): + address (Union[None, str]): + url (Union[None, str]): + phone_number (Union[None, str]): + social_link (Union[None, str]): + tags (Union[None, list[str]]): + payment_state (PaymentStateEnum): * `1` - created + * `2` - delayed + * `3` - pending + * `4` - incomplete + * `5` - success + * `6` - failed + * `7` - expected_failure + state (State634Enum): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + get_payment_state_display (str): + get_state_display (str): + rejection_reason (Union[None, RejectionReasonEnum]): + created_at (datetime.datetime): + updated_at (datetime.datetime): + display_time (str): + status (str): + user_uuid (UUID): + comments_count (str): + likes_count (str): + state_ordering (str): + statistics (AdStatistic): + category (Union[Unset, CategoryEnum]): * `1` - PRODUCT + * `2` - SERVICE + * `3` - SOCIAL_CONTENT + role (Union[Unset, RoleEnum]): * `1` - provider + * `2` - requester + price_model (Union[None, PriceModelEnum, Unset]): + price_detail (Union[Unset, Any]): + product_condition (Union[None, ProductConditionEnum, Unset]): + access_model (Union[Unset, AccessModelEnum]): * `1` - free + * `2` - viewer_reward + * `3` - tip_supported + * `4` - paid_only + attendance_type (Union[AttendanceTypeEnum, None, Unset]): + can_republish (Union[None, Unset, bool]): + transportation_cost (Union[None, TransportationCostEnum, Unset]): + work_end_time (Union[None, Unset, int]): + work_start_time (Union[None, Unset, int]): + details (Union[Unset, Any]): + location_is_approximate (Union[Unset, bool]): + refined_banner (Union[Unset, RefinedAdBanner]): + balance (Union[None, Unset, int]): + new_title (Union[None, Unset, str]): + new_location (Union['AdOwnerNewLocationType0', None, Unset]): + new_description (Union[None, Unset, str]): + new_banner (Union[None, Unset, str]): + new_content (Union[None, Unset, str]): + new_content_type (Union[NewContentTypeEnum, None, Unset]): + new_url (Union[None, Unset, str]): + new_tags (Union[Unset, Any]): + new_address (Union[None, Unset, str]): + new_phone_number (Union[None, Unset, str]): + new_social_link (Union[None, Unset, str]): + new_reward_amount (Union[None, Unset, int]): + new_reward_count (Union[None, Unset, int]): + """ + + uuid: UUID + title: Union[None, str] + type_: Type0D9Enum + content: str + contents: list["AdContent"] + refined_contents: list["RefinedAdContent"] + description: Union[None, str] + location: Union["AdOwnerLocationType0", None] + banner: Union[None, str] + reward_amount: int + reward_count: int + address: Union[None, str] + url: Union[None, str] + phone_number: Union[None, str] + social_link: Union[None, str] + tags: Union[None, list[str]] + payment_state: PaymentStateEnum + state: State634Enum + get_payment_state_display: str + get_state_display: str + rejection_reason: Union[None, RejectionReasonEnum] + created_at: datetime.datetime + updated_at: datetime.datetime + display_time: str + status: str + user_uuid: UUID + comments_count: str + likes_count: str + state_ordering: str + statistics: "AdStatistic" + category: Union[Unset, CategoryEnum] = UNSET + role: Union[Unset, RoleEnum] = UNSET + price_model: Union[None, PriceModelEnum, Unset] = UNSET + price_detail: Union[Unset, Any] = UNSET + product_condition: Union[None, ProductConditionEnum, Unset] = UNSET + access_model: Union[Unset, AccessModelEnum] = UNSET + attendance_type: Union[AttendanceTypeEnum, None, Unset] = UNSET + can_republish: Union[None, Unset, bool] = UNSET + transportation_cost: Union[None, TransportationCostEnum, Unset] = UNSET + work_end_time: Union[None, Unset, int] = UNSET + work_start_time: Union[None, Unset, int] = UNSET + details: Union[Unset, Any] = UNSET + location_is_approximate: Union[Unset, bool] = UNSET + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + balance: Union[None, Unset, int] = UNSET + new_title: Union[None, Unset, str] = UNSET + new_location: Union["AdOwnerNewLocationType0", None, Unset] = UNSET + new_description: Union[None, Unset, str] = UNSET + new_banner: Union[None, Unset, str] = UNSET + new_content: Union[None, Unset, str] = UNSET + new_content_type: Union[NewContentTypeEnum, None, Unset] = UNSET + new_url: Union[None, Unset, str] = UNSET + new_tags: Union[Unset, Any] = UNSET + new_address: Union[None, Unset, str] = UNSET + new_phone_number: Union[None, Unset, str] = UNSET + new_social_link: Union[None, Unset, str] = UNSET + new_reward_amount: Union[None, Unset, int] = UNSET + new_reward_count: Union[None, Unset, int] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .ad_owner_location_type_0 import AdOwnerLocationType0 + from .ad_owner_new_location_type_0 import AdOwnerNewLocationType0 + + uuid = str(self.uuid) + + title: Union[None, str] + title = self.title + + type_ = self.type_.value + + content = self.content + + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, str] + description = self.description + + location: Union[None, dict[str, Any]] + if isinstance(self.location, AdOwnerLocationType0): + location = self.location.to_dict() + else: + location = self.location + + banner: Union[None, str] + banner = self.banner + + reward_amount = self.reward_amount + + reward_count = self.reward_count + + address: Union[None, str] + address = self.address + + url: Union[None, str] + url = self.url + + phone_number: Union[None, str] + phone_number = self.phone_number + + social_link: Union[None, str] + social_link = self.social_link + + tags: Union[None, list[str]] + if isinstance(self.tags, list): + tags = self.tags + + else: + tags = self.tags + + payment_state = self.payment_state.value + + state = self.state.value + + get_payment_state_display = self.get_payment_state_display + + get_state_display = self.get_state_display + + rejection_reason: Union[None, str] + if isinstance(self.rejection_reason, RejectionReasonEnum): + rejection_reason = self.rejection_reason.value + else: + rejection_reason = self.rejection_reason + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + display_time = self.display_time + + status = self.status + + user_uuid = str(self.user_uuid) + + comments_count = self.comments_count + + likes_count = self.likes_count + + state_ordering = self.state_ordering + + statistics = self.statistics.to_dict() + + category: Union[Unset, int] = UNSET + if not isinstance(self.category, Unset): + category = self.category.value + + role: Union[Unset, int] = UNSET + if not isinstance(self.role, Unset): + role = self.role.value + + price_model: Union[None, Unset, int] + if isinstance(self.price_model, Unset): + price_model = UNSET + elif isinstance(self.price_model, PriceModelEnum): + price_model = self.price_model.value + else: + price_model = self.price_model + + price_detail = self.price_detail + + product_condition: Union[None, Unset, int] + if isinstance(self.product_condition, Unset): + product_condition = UNSET + elif isinstance(self.product_condition, ProductConditionEnum): + product_condition = self.product_condition.value + else: + product_condition = self.product_condition + + access_model: Union[Unset, int] = UNSET + if not isinstance(self.access_model, Unset): + access_model = self.access_model.value + + attendance_type: Union[None, Unset, int] + if isinstance(self.attendance_type, Unset): + attendance_type = UNSET + elif isinstance(self.attendance_type, AttendanceTypeEnum): + attendance_type = self.attendance_type.value + else: + attendance_type = self.attendance_type + + can_republish: Union[None, Unset, bool] + if isinstance(self.can_republish, Unset): + can_republish = UNSET + else: + can_republish = self.can_republish + + transportation_cost: Union[None, Unset, int] + if isinstance(self.transportation_cost, Unset): + transportation_cost = UNSET + elif isinstance(self.transportation_cost, TransportationCostEnum): + transportation_cost = self.transportation_cost.value + else: + transportation_cost = self.transportation_cost + + work_end_time: Union[None, Unset, int] + if isinstance(self.work_end_time, Unset): + work_end_time = UNSET + else: + work_end_time = self.work_end_time + + work_start_time: Union[None, Unset, int] + if isinstance(self.work_start_time, Unset): + work_start_time = UNSET + else: + work_start_time = self.work_start_time + + details = self.details + + location_is_approximate = self.location_is_approximate + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + balance: Union[None, Unset, int] + if isinstance(self.balance, Unset): + balance = UNSET + else: + balance = self.balance + + new_title: Union[None, Unset, str] + if isinstance(self.new_title, Unset): + new_title = UNSET + else: + new_title = self.new_title + + new_location: Union[None, Unset, dict[str, Any]] + if isinstance(self.new_location, Unset): + new_location = UNSET + elif isinstance(self.new_location, AdOwnerNewLocationType0): + new_location = self.new_location.to_dict() + else: + new_location = self.new_location + + new_description: Union[None, Unset, str] + if isinstance(self.new_description, Unset): + new_description = UNSET + else: + new_description = self.new_description + + new_banner: Union[None, Unset, str] + if isinstance(self.new_banner, Unset): + new_banner = UNSET + else: + new_banner = self.new_banner + + new_content: Union[None, Unset, str] + if isinstance(self.new_content, Unset): + new_content = UNSET + else: + new_content = self.new_content + + new_content_type: Union[None, Unset, int] + if isinstance(self.new_content_type, Unset): + new_content_type = UNSET + elif isinstance(self.new_content_type, NewContentTypeEnum): + new_content_type = self.new_content_type.value + else: + new_content_type = self.new_content_type + + new_url: Union[None, Unset, str] + if isinstance(self.new_url, Unset): + new_url = UNSET + else: + new_url = self.new_url + + new_tags = self.new_tags + + new_address: Union[None, Unset, str] + if isinstance(self.new_address, Unset): + new_address = UNSET + else: + new_address = self.new_address + + new_phone_number: Union[None, Unset, str] + if isinstance(self.new_phone_number, Unset): + new_phone_number = UNSET + else: + new_phone_number = self.new_phone_number + + new_social_link: Union[None, Unset, str] + if isinstance(self.new_social_link, Unset): + new_social_link = UNSET + else: + new_social_link = self.new_social_link + + new_reward_amount: Union[None, Unset, int] + if isinstance(self.new_reward_amount, Unset): + new_reward_amount = UNSET + else: + new_reward_amount = self.new_reward_amount + + new_reward_count: Union[None, Unset, int] + if isinstance(self.new_reward_count, Unset): + new_reward_count = UNSET + else: + new_reward_count = self.new_reward_count + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "title": title, + "type": type_, + "content": content, + "contents": contents, + "refined_contents": refined_contents, + "description": description, + "location": location, + "banner": banner, + "reward_amount": reward_amount, + "reward_count": reward_count, + "address": address, + "url": url, + "phone_number": phone_number, + "social_link": social_link, + "tags": tags, + "payment_state": payment_state, + "state": state, + "get_payment_state_display": get_payment_state_display, + "get_state_display": get_state_display, + "rejection_reason": rejection_reason, + "created_at": created_at, + "updated_at": updated_at, + "display_time": display_time, + "status": status, + "user_uuid": user_uuid, + "comments_count": comments_count, + "likes_count": likes_count, + "state_ordering": state_ordering, + "statistics": statistics, + } + ) + if category is not UNSET: + field_dict["category"] = category + if role is not UNSET: + field_dict["role"] = role + if price_model is not UNSET: + field_dict["price_model"] = price_model + if price_detail is not UNSET: + field_dict["price_detail"] = price_detail + if product_condition is not UNSET: + field_dict["product_condition"] = product_condition + if access_model is not UNSET: + field_dict["access_model"] = access_model + if attendance_type is not UNSET: + field_dict["attendance_type"] = attendance_type + if can_republish is not UNSET: + field_dict["can_republish"] = can_republish + if transportation_cost is not UNSET: + field_dict["transportation_cost"] = transportation_cost + if work_end_time is not UNSET: + field_dict["work_end_time"] = work_end_time + if work_start_time is not UNSET: + field_dict["work_start_time"] = work_start_time + if details is not UNSET: + field_dict["details"] = details + if location_is_approximate is not UNSET: + field_dict["location_is_approximate"] = location_is_approximate + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + if balance is not UNSET: + field_dict["balance"] = balance + if new_title is not UNSET: + field_dict["new_title"] = new_title + if new_location is not UNSET: + field_dict["new_location"] = new_location + if new_description is not UNSET: + field_dict["new_description"] = new_description + if new_banner is not UNSET: + field_dict["new_banner"] = new_banner + if new_content is not UNSET: + field_dict["new_content"] = new_content + if new_content_type is not UNSET: + field_dict["new_content_type"] = new_content_type + if new_url is not UNSET: + field_dict["new_url"] = new_url + if new_tags is not UNSET: + field_dict["new_tags"] = new_tags + if new_address is not UNSET: + field_dict["new_address"] = new_address + if new_phone_number is not UNSET: + field_dict["new_phone_number"] = new_phone_number + if new_social_link is not UNSET: + field_dict["new_social_link"] = new_social_link + if new_reward_amount is not UNSET: + field_dict["new_reward_amount"] = new_reward_amount + if new_reward_count is not UNSET: + field_dict["new_reward_count"] = new_reward_count + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_owner_location_type_0 import AdOwnerLocationType0 + from .ad_owner_new_location_type_0 import AdOwnerNewLocationType0 + from .ad_statistic import AdStatistic + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_title(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + title = _parse_title(d.pop("title")) + + type_ = Type0D9Enum(d.pop("type")) + + content = d.pop("content") + + contents = [] + _contents = d.pop("contents") + for contents_item_data in _contents: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents") + for refined_contents_item_data in _refined_contents: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + description = _parse_description(d.pop("description")) + + def _parse_location(data: object) -> Union["AdOwnerLocationType0", None]: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = AdOwnerLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["AdOwnerLocationType0", None], data) + + location = _parse_location(d.pop("location")) + + def _parse_banner(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + banner = _parse_banner(d.pop("banner")) + + reward_amount = d.pop("reward_amount") + + reward_count = d.pop("reward_count") + + def _parse_address(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + address = _parse_address(d.pop("address")) + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + def _parse_phone_number(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + phone_number = _parse_phone_number(d.pop("phone_number")) + + def _parse_social_link(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + social_link = _parse_social_link(d.pop("social_link")) + + def _parse_tags(data: object) -> Union[None, list[str]]: + if data is None: + return data + try: + if not isinstance(data, list): + raise TypeError() + tags_type_0 = cast(list[str], data) + + return tags_type_0 + except: # noqa: E722 + pass + return cast(Union[None, list[str]], data) + + tags = _parse_tags(d.pop("tags")) + + payment_state = PaymentStateEnum(d.pop("payment_state")) + + state = State634Enum(d.pop("state")) + + get_payment_state_display = d.pop("get_payment_state_display") + + get_state_display = d.pop("get_state_display") + + def _parse_rejection_reason(data: object) -> Union[None, RejectionReasonEnum]: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + rejection_reason_type_0 = RejectionReasonEnum(data) + + return rejection_reason_type_0 + except: # noqa: E722 + pass + return cast(Union[None, RejectionReasonEnum], data) + + rejection_reason = _parse_rejection_reason(d.pop("rejection_reason")) + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + display_time = d.pop("display_time") + + status = d.pop("status") + + user_uuid = UUID(d.pop("user_uuid")) + + comments_count = d.pop("comments_count") + + likes_count = d.pop("likes_count") + + state_ordering = d.pop("state_ordering") + + statistics = AdStatistic.from_dict(d.pop("statistics")) + + _category = d.pop("category", UNSET) + category: Union[Unset, CategoryEnum] + if isinstance(_category, Unset): + category = UNSET + else: + category = CategoryEnum(_category) + + _role = d.pop("role", UNSET) + role: Union[Unset, RoleEnum] + if isinstance(_role, Unset): + role = UNSET + else: + role = RoleEnum(_role) + + def _parse_price_model(data: object) -> Union[None, PriceModelEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + price_model_type_0 = PriceModelEnum(data) + + return price_model_type_0 + except: # noqa: E722 + pass + return cast(Union[None, PriceModelEnum, Unset], data) + + price_model = _parse_price_model(d.pop("price_model", UNSET)) + + price_detail = d.pop("price_detail", UNSET) + + def _parse_product_condition(data: object) -> Union[None, ProductConditionEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + product_condition_type_0 = ProductConditionEnum(data) + + return product_condition_type_0 + except: # noqa: E722 + pass + return cast(Union[None, ProductConditionEnum, Unset], data) + + product_condition = _parse_product_condition(d.pop("product_condition", UNSET)) + + _access_model = d.pop("access_model", UNSET) + access_model: Union[Unset, AccessModelEnum] + if isinstance(_access_model, Unset): + access_model = UNSET + else: + access_model = AccessModelEnum(_access_model) + + def _parse_attendance_type(data: object) -> Union[AttendanceTypeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + attendance_type_type_0 = AttendanceTypeEnum(data) + + return attendance_type_type_0 + except: # noqa: E722 + pass + return cast(Union[AttendanceTypeEnum, None, Unset], data) + + attendance_type = _parse_attendance_type(d.pop("attendance_type", UNSET)) + + def _parse_can_republish(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + can_republish = _parse_can_republish(d.pop("can_republish", UNSET)) + + def _parse_transportation_cost(data: object) -> Union[None, TransportationCostEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + transportation_cost_type_0 = TransportationCostEnum(data) + + return transportation_cost_type_0 + except: # noqa: E722 + pass + return cast(Union[None, TransportationCostEnum, Unset], data) + + transportation_cost = _parse_transportation_cost(d.pop("transportation_cost", UNSET)) + + def _parse_work_end_time(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + work_end_time = _parse_work_end_time(d.pop("work_end_time", UNSET)) + + def _parse_work_start_time(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + work_start_time = _parse_work_start_time(d.pop("work_start_time", UNSET)) + + details = d.pop("details", UNSET) + + location_is_approximate = d.pop("location_is_approximate", UNSET) + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + def _parse_balance(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + balance = _parse_balance(d.pop("balance", UNSET)) + + def _parse_new_title(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_title = _parse_new_title(d.pop("new_title", UNSET)) + + def _parse_new_location(data: object) -> Union["AdOwnerNewLocationType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + new_location_type_0 = AdOwnerNewLocationType0.from_dict(data) + + return new_location_type_0 + except: # noqa: E722 + pass + return cast(Union["AdOwnerNewLocationType0", None, Unset], data) + + new_location = _parse_new_location(d.pop("new_location", UNSET)) + + def _parse_new_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_description = _parse_new_description(d.pop("new_description", UNSET)) + + def _parse_new_banner(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_banner = _parse_new_banner(d.pop("new_banner", UNSET)) + + def _parse_new_content(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_content = _parse_new_content(d.pop("new_content", UNSET)) + + def _parse_new_content_type(data: object) -> Union[NewContentTypeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + new_content_type_type_0 = NewContentTypeEnum(data) + + return new_content_type_type_0 + except: # noqa: E722 + pass + return cast(Union[NewContentTypeEnum, None, Unset], data) + + new_content_type = _parse_new_content_type(d.pop("new_content_type", UNSET)) + + def _parse_new_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_url = _parse_new_url(d.pop("new_url", UNSET)) + + new_tags = d.pop("new_tags", UNSET) + + def _parse_new_address(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_address = _parse_new_address(d.pop("new_address", UNSET)) + + def _parse_new_phone_number(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_phone_number = _parse_new_phone_number(d.pop("new_phone_number", UNSET)) + + def _parse_new_social_link(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_social_link = _parse_new_social_link(d.pop("new_social_link", UNSET)) + + def _parse_new_reward_amount(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_amount = _parse_new_reward_amount(d.pop("new_reward_amount", UNSET)) + + def _parse_new_reward_count(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_count = _parse_new_reward_count(d.pop("new_reward_count", UNSET)) + + ad_owner = cls( + uuid=uuid, + title=title, + type_=type_, + content=content, + contents=contents, + refined_contents=refined_contents, + description=description, + location=location, + banner=banner, + reward_amount=reward_amount, + reward_count=reward_count, + address=address, + url=url, + phone_number=phone_number, + social_link=social_link, + tags=tags, + payment_state=payment_state, + state=state, + get_payment_state_display=get_payment_state_display, + get_state_display=get_state_display, + rejection_reason=rejection_reason, + created_at=created_at, + updated_at=updated_at, + display_time=display_time, + status=status, + user_uuid=user_uuid, + comments_count=comments_count, + likes_count=likes_count, + state_ordering=state_ordering, + statistics=statistics, + category=category, + role=role, + price_model=price_model, + price_detail=price_detail, + product_condition=product_condition, + access_model=access_model, + attendance_type=attendance_type, + can_republish=can_republish, + transportation_cost=transportation_cost, + work_end_time=work_end_time, + work_start_time=work_start_time, + details=details, + location_is_approximate=location_is_approximate, + refined_banner=refined_banner, + balance=balance, + new_title=new_title, + new_location=new_location, + new_description=new_description, + new_banner=new_banner, + new_content=new_content, + new_content_type=new_content_type, + new_url=new_url, + new_tags=new_tags, + new_address=new_address, + new_phone_number=new_phone_number, + new_social_link=new_social_link, + new_reward_amount=new_reward_amount, + new_reward_count=new_reward_count, + ) + + ad_owner.additional_properties = d + return ad_owner + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0.py b/utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0.py new file mode 100644 index 0000000..421f122 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_owner_location_type_0_type import AdOwnerLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdOwnerLocationType0") + + +@_attrs_define +class AdOwnerLocationType0: + """ + Attributes: + type_ (Union[Unset, AdOwnerLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdOwnerLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdOwnerLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdOwnerLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_owner_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_owner_location_type_0.additional_properties = d + return ad_owner_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0_type.py new file mode 100644 index 0000000..cd6f30e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_owner_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdOwnerLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0.py b/utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0.py new file mode 100644 index 0000000..48eb4f2 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_owner_new_location_type_0_type import AdOwnerNewLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdOwnerNewLocationType0") + + +@_attrs_define +class AdOwnerNewLocationType0: + """ + Attributes: + type_ (Union[Unset, AdOwnerNewLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdOwnerNewLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdOwnerNewLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdOwnerNewLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_owner_new_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_owner_new_location_type_0.additional_properties = d + return ad_owner_new_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0_type.py new file mode 100644 index 0000000..3e95c28 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_owner_new_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdOwnerNewLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_public.py b/utils/clients/gooyal_advertising_client/models/ad_public.py new file mode 100644 index 0000000..cff3f85 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_public.py @@ -0,0 +1,271 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .type_0d9_enum import Type0D9Enum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_public_location_type_0 import AdPublicLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="AdPublic") + + +@_attrs_define +class AdPublic: + """ + Attributes: + uuid (UUID): + title (Union[None, str]): + type_ (Type0D9Enum): * `1` - BILLBOARD + * `2` - CAPTURED_BILLBOARD + * `99` - PROMOTION + * `100` - CONSTANT + reward_amount (int): + content (str): + contents (list['AdContent']): + refined_contents (list['RefinedAdContent']): + description (Union[None, str]): + location (Union['AdPublicLocationType0', None]): + location_is_approximate (bool): + banner (Union[None, str]): + address (Union[None, str]): + url (Union[None, str]): + tags (list[str]): + details (Any): + refined_banner (Union[Unset, RefinedAdBanner]): + """ + + uuid: UUID + title: Union[None, str] + type_: Type0D9Enum + reward_amount: int + content: str + contents: list["AdContent"] + refined_contents: list["RefinedAdContent"] + description: Union[None, str] + location: Union["AdPublicLocationType0", None] + location_is_approximate: bool + banner: Union[None, str] + address: Union[None, str] + url: Union[None, str] + tags: list[str] + details: Any + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .ad_public_location_type_0 import AdPublicLocationType0 + + uuid = str(self.uuid) + + title: Union[None, str] + title = self.title + + type_ = self.type_.value + + reward_amount = self.reward_amount + + content = self.content + + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, str] + description = self.description + + location: Union[None, dict[str, Any]] + if isinstance(self.location, AdPublicLocationType0): + location = self.location.to_dict() + else: + location = self.location + + location_is_approximate = self.location_is_approximate + + banner: Union[None, str] + banner = self.banner + + address: Union[None, str] + address = self.address + + url: Union[None, str] + url = self.url + + tags = self.tags + + details = self.details + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "title": title, + "type": type_, + "reward_amount": reward_amount, + "content": content, + "contents": contents, + "refined_contents": refined_contents, + "description": description, + "location": location, + "location_is_approximate": location_is_approximate, + "banner": banner, + "address": address, + "url": url, + "tags": tags, + "details": details, + } + ) + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_public_location_type_0 import AdPublicLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_title(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + title = _parse_title(d.pop("title")) + + type_ = Type0D9Enum(d.pop("type")) + + reward_amount = d.pop("reward_amount") + + content = d.pop("content") + + contents = [] + _contents = d.pop("contents") + for contents_item_data in _contents: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents") + for refined_contents_item_data in _refined_contents: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + description = _parse_description(d.pop("description")) + + def _parse_location(data: object) -> Union["AdPublicLocationType0", None]: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = AdPublicLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["AdPublicLocationType0", None], data) + + location = _parse_location(d.pop("location")) + + location_is_approximate = d.pop("location_is_approximate") + + def _parse_banner(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + banner = _parse_banner(d.pop("banner")) + + def _parse_address(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + address = _parse_address(d.pop("address")) + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + tags = cast(list[str], d.pop("tags")) + + details = d.pop("details") + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + ad_public = cls( + uuid=uuid, + title=title, + type_=type_, + reward_amount=reward_amount, + content=content, + contents=contents, + refined_contents=refined_contents, + description=description, + location=location, + location_is_approximate=location_is_approximate, + banner=banner, + address=address, + url=url, + tags=tags, + details=details, + refined_banner=refined_banner, + ) + + ad_public.additional_properties = d + return ad_public + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_public_location_type_0.py b/utils/clients/gooyal_advertising_client/models/ad_public_location_type_0.py new file mode 100644 index 0000000..d818ddc --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_public_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_public_location_type_0_type import AdPublicLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdPublicLocationType0") + + +@_attrs_define +class AdPublicLocationType0: + """ + Attributes: + type_ (Union[Unset, AdPublicLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdPublicLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdPublicLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdPublicLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_public_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_public_location_type_0.additional_properties = d + return ad_public_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_public_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/ad_public_location_type_0_type.py new file mode 100644 index 0000000..c58dd40 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_public_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdPublicLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ad_report.py b/utils/clients/gooyal_advertising_client/models/ad_report.py new file mode 100644 index 0000000..90c2d5e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_report.py @@ -0,0 +1,113 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .report_category_enum import ReportCategoryEnum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdReport") + + +@_attrs_define +class AdReport: + """ + Attributes: + visit_uuid (UUID): + report_category (Union[None, ReportCategoryEnum, Unset]): + report_reason (Union[None, Unset, str]): + """ + + visit_uuid: UUID + report_category: Union[None, ReportCategoryEnum, Unset] = UNSET + report_reason: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + visit_uuid = str(self.visit_uuid) + + report_category: Union[None, Unset, int] + if isinstance(self.report_category, Unset): + report_category = UNSET + elif isinstance(self.report_category, ReportCategoryEnum): + report_category = self.report_category.value + else: + report_category = self.report_category + + report_reason: Union[None, Unset, str] + if isinstance(self.report_reason, Unset): + report_reason = UNSET + else: + report_reason = self.report_reason + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "visit_uuid": visit_uuid, + } + ) + if report_category is not UNSET: + field_dict["report_category"] = report_category + if report_reason is not UNSET: + field_dict["report_reason"] = report_reason + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + visit_uuid = UUID(d.pop("visit_uuid")) + + def _parse_report_category(data: object) -> Union[None, ReportCategoryEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + report_category_type_0 = ReportCategoryEnum(data) + + return report_category_type_0 + except: # noqa: E722 + pass + return cast(Union[None, ReportCategoryEnum, Unset], data) + + report_category = _parse_report_category(d.pop("report_category", UNSET)) + + def _parse_report_reason(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + report_reason = _parse_report_reason(d.pop("report_reason", UNSET)) + + ad_report = cls( + visit_uuid=visit_uuid, + report_category=report_category, + report_reason=report_reason, + ) + + ad_report.additional_properties = d + return ad_report + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_statistic.py b/utils/clients/gooyal_advertising_client/models/ad_statistic.py new file mode 100644 index 0000000..b8f0132 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_statistic.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AdStatistic") + + +@_attrs_define +class AdStatistic: + """ + Attributes: + visit_with_reward_count (int): + visit_without_reward_count (int): + balance (int): + total_amount (int): + visit_like_count (int): + reward_count (int): + reward_amount (int): + visit_link_click_count (int): + status (int): + """ + + visit_with_reward_count: int + visit_without_reward_count: int + balance: int + total_amount: int + visit_like_count: int + reward_count: int + reward_amount: int + visit_link_click_count: int + status: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + visit_with_reward_count = self.visit_with_reward_count + + visit_without_reward_count = self.visit_without_reward_count + + balance = self.balance + + total_amount = self.total_amount + + visit_like_count = self.visit_like_count + + reward_count = self.reward_count + + reward_amount = self.reward_amount + + visit_link_click_count = self.visit_link_click_count + + status = self.status + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "visit_with_reward_count": visit_with_reward_count, + "visit_without_reward_count": visit_without_reward_count, + "balance": balance, + "total_amount": total_amount, + "visit_like_count": visit_like_count, + "reward_count": reward_count, + "reward_amount": reward_amount, + "visit_link_click_count": visit_link_click_count, + "status": status, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + visit_with_reward_count = d.pop("visit_with_reward_count") + + visit_without_reward_count = d.pop("visit_without_reward_count") + + balance = d.pop("balance") + + total_amount = d.pop("total_amount") + + visit_like_count = d.pop("visit_like_count") + + reward_count = d.pop("reward_count") + + reward_amount = d.pop("reward_amount") + + visit_link_click_count = d.pop("visit_link_click_count") + + status = d.pop("status") + + ad_statistic = cls( + visit_with_reward_count=visit_with_reward_count, + visit_without_reward_count=visit_without_reward_count, + balance=balance, + total_amount=total_amount, + visit_like_count=visit_like_count, + reward_count=reward_count, + reward_amount=reward_amount, + visit_link_click_count=visit_link_click_count, + status=status, + ) + + ad_statistic.additional_properties = d + return ad_statistic + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_visit_statistic.py b/utils/clients/gooyal_advertising_client/models/ad_visit_statistic.py new file mode 100644 index 0000000..a56396a --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_visit_statistic.py @@ -0,0 +1,83 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="AdVisitStatistic") + + +@_attrs_define +class AdVisitStatistic: + """ + Attributes: + label (str): + with_reward_count (int): + without_reward_count (int): + reward_amount (int): + """ + + label: str + with_reward_count: int + without_reward_count: int + reward_amount: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + label = self.label + + with_reward_count = self.with_reward_count + + without_reward_count = self.without_reward_count + + reward_amount = self.reward_amount + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "label": label, + "with_reward_count": with_reward_count, + "without_reward_count": without_reward_count, + "reward_amount": reward_amount, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + label = d.pop("label") + + with_reward_count = d.pop("with_reward_count") + + without_reward_count = d.pop("without_reward_count") + + reward_amount = d.pop("reward_amount") + + ad_visit_statistic = cls( + label=label, + with_reward_count=with_reward_count, + without_reward_count=without_reward_count, + reward_amount=reward_amount, + ) + + ad_visit_statistic.additional_properties = d + return ad_visit_statistic + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_with_visit.py b/utils/clients/gooyal_advertising_client/models/ad_with_visit.py new file mode 100644 index 0000000..43809dd --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_with_visit.py @@ -0,0 +1,357 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .role_enum import RoleEnum +from .type_0d9_enum import Type0D9Enum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_with_visit_location_type_0 import AdWithVisitLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + from .visit import Visit + + +T = TypeVar("T", bound="AdWithVisit") + + +@_attrs_define +class AdWithVisit: + """ + Attributes: + uuid (UUID): + title (Union[None, str]): + type_ (Type0D9Enum): * `1` - BILLBOARD + * `2` - CAPTURED_BILLBOARD + * `99` - PROMOTION + * `100` - CONSTANT + role (RoleEnum): * `1` - provider + * `2` - requester + details (Any): + content (str): + contents (list['AdContent']): + refined_contents (list['RefinedAdContent']): + description (Union[None, str]): + location (Union['AdWithVisitLocationType0', None]): + location_is_approximate (bool): + banner (Union[None, str]): + reward_amount (int): + reward_count (int): + address (Union[None, str]): + url (Union[None, str]): + tags (list[str]): + created_at (datetime.datetime): + updated_at (datetime.datetime): + display_time (str): + status (str): + user_uuid (UUID): + comments_count (str): + likes_count (str): + visit (Visit): + refined_banner (Union[Unset, RefinedAdBanner]): + """ + + uuid: UUID + title: Union[None, str] + type_: Type0D9Enum + role: RoleEnum + details: Any + content: str + contents: list["AdContent"] + refined_contents: list["RefinedAdContent"] + description: Union[None, str] + location: Union["AdWithVisitLocationType0", None] + location_is_approximate: bool + banner: Union[None, str] + reward_amount: int + reward_count: int + address: Union[None, str] + url: Union[None, str] + tags: list[str] + created_at: datetime.datetime + updated_at: datetime.datetime + display_time: str + status: str + user_uuid: UUID + comments_count: str + likes_count: str + visit: "Visit" + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .ad_with_visit_location_type_0 import AdWithVisitLocationType0 + + uuid = str(self.uuid) + + title: Union[None, str] + title = self.title + + type_ = self.type_.value + + role = self.role.value + + details = self.details + + content = self.content + + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, str] + description = self.description + + location: Union[None, dict[str, Any]] + if isinstance(self.location, AdWithVisitLocationType0): + location = self.location.to_dict() + else: + location = self.location + + location_is_approximate = self.location_is_approximate + + banner: Union[None, str] + banner = self.banner + + reward_amount = self.reward_amount + + reward_count = self.reward_count + + address: Union[None, str] + address = self.address + + url: Union[None, str] + url = self.url + + tags = self.tags + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + display_time = self.display_time + + status = self.status + + user_uuid = str(self.user_uuid) + + comments_count = self.comments_count + + likes_count = self.likes_count + + visit = self.visit.to_dict() + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "title": title, + "type": type_, + "role": role, + "details": details, + "content": content, + "contents": contents, + "refined_contents": refined_contents, + "description": description, + "location": location, + "location_is_approximate": location_is_approximate, + "banner": banner, + "reward_amount": reward_amount, + "reward_count": reward_count, + "address": address, + "url": url, + "tags": tags, + "created_at": created_at, + "updated_at": updated_at, + "display_time": display_time, + "status": status, + "user_uuid": user_uuid, + "comments_count": comments_count, + "likes_count": likes_count, + "visit": visit, + } + ) + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_with_visit_location_type_0 import AdWithVisitLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + from .visit import Visit + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_title(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + title = _parse_title(d.pop("title")) + + type_ = Type0D9Enum(d.pop("type")) + + role = RoleEnum(d.pop("role")) + + details = d.pop("details") + + content = d.pop("content") + + contents = [] + _contents = d.pop("contents") + for contents_item_data in _contents: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents") + for refined_contents_item_data in _refined_contents: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + description = _parse_description(d.pop("description")) + + def _parse_location(data: object) -> Union["AdWithVisitLocationType0", None]: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = AdWithVisitLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["AdWithVisitLocationType0", None], data) + + location = _parse_location(d.pop("location")) + + location_is_approximate = d.pop("location_is_approximate") + + def _parse_banner(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + banner = _parse_banner(d.pop("banner")) + + reward_amount = d.pop("reward_amount") + + reward_count = d.pop("reward_count") + + def _parse_address(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + address = _parse_address(d.pop("address")) + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + tags = cast(list[str], d.pop("tags")) + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + display_time = d.pop("display_time") + + status = d.pop("status") + + user_uuid = UUID(d.pop("user_uuid")) + + comments_count = d.pop("comments_count") + + likes_count = d.pop("likes_count") + + visit = Visit.from_dict(d.pop("visit")) + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + ad_with_visit = cls( + uuid=uuid, + title=title, + type_=type_, + role=role, + details=details, + content=content, + contents=contents, + refined_contents=refined_contents, + description=description, + location=location, + location_is_approximate=location_is_approximate, + banner=banner, + reward_amount=reward_amount, + reward_count=reward_count, + address=address, + url=url, + tags=tags, + created_at=created_at, + updated_at=updated_at, + display_time=display_time, + status=status, + user_uuid=user_uuid, + comments_count=comments_count, + likes_count=likes_count, + visit=visit, + refined_banner=refined_banner, + ) + + ad_with_visit.additional_properties = d + return ad_with_visit + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0.py b/utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0.py new file mode 100644 index 0000000..9f6a573 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ad_with_visit_location_type_0_type import AdWithVisitLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="AdWithVisitLocationType0") + + +@_attrs_define +class AdWithVisitLocationType0: + """ + Attributes: + type_ (Union[Unset, AdWithVisitLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, AdWithVisitLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, AdWithVisitLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = AdWithVisitLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + ad_with_visit_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + ad_with_visit_location_type_0.additional_properties = d + return ad_with_visit_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0_type.py new file mode 100644 index 0000000..82ebdec --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ad_with_visit_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class AdWithVisitLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/attendance_type_enum.py b/utils/clients/gooyal_advertising_client/models/attendance_type_enum.py new file mode 100644 index 0000000..442f955 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/attendance_type_enum.py @@ -0,0 +1,10 @@ +from enum import IntEnum + + +class AttendanceTypeEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/ban.py b/utils/clients/gooyal_advertising_client/models/ban.py new file mode 100644 index 0000000..0bd08b0 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ban.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .ban_level_enum import BanLevelEnum + +T = TypeVar("T", bound="Ban") + + +@_attrs_define +class Ban: + """ + Attributes: + ban_details (list[Any]): + ban_detail (Any): + ban_level (BanLevelEnum): * `0` - Not Banned + * `100` - Banned + """ + + ban_details: list[Any] + ban_detail: Any + ban_level: BanLevelEnum + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + ban_details = self.ban_details + + ban_detail = self.ban_detail + + ban_level = self.ban_level.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "ban_details": ban_details, + "ban_detail": ban_detail, + "ban_level": ban_level, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + ban_details = cast(list[Any], d.pop("ban_details")) + + ban_detail = d.pop("ban_detail") + + ban_level = BanLevelEnum(d.pop("ban_level")) + + ban = cls( + ban_details=ban_details, + ban_detail=ban_detail, + ban_level=ban_level, + ) + + ban.additional_properties = d + return ban + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ban_level_enum.py b/utils/clients/gooyal_advertising_client/models/ban_level_enum.py new file mode 100644 index 0000000..3898f0c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ban_level_enum.py @@ -0,0 +1,9 @@ +from enum import IntEnum + + +class BanLevelEnum(IntEnum): + VALUE_0 = 0 + VALUE_100 = 100 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/capture.py b/utils/clients/gooyal_advertising_client/models/capture.py new file mode 100644 index 0000000..78a280c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/capture.py @@ -0,0 +1,588 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .rejection_reason_enum import RejectionReasonEnum +from .state_634_enum import State634Enum +from .type_0d9_enum import Type0D9Enum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_statistic import AdStatistic + from .capture_location_type_0 import CaptureLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="Capture") + + +@_attrs_define +class Capture: + """ + Attributes: + uuid (UUID): + title (Union[None, str]): + type_ (Type0D9Enum): * `1` - BILLBOARD + * `2` - CAPTURED_BILLBOARD + * `99` - PROMOTION + * `100` - CONSTANT + contents (list['AdContent']): + refined_contents (list['RefinedAdContent']): + description (Union[None, str]): + banner (Union[None, str]): + reward_amount (int): + reward_count (int): + balance (Union[None, int]): + address (Union[None, str]): + url (Union[None, str]): + tags (Union[None, list[str]]): + state (State634Enum): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + get_state_display (str): + rejection_reason (Union[None, RejectionReasonEnum]): + created_at (datetime.datetime): + updated_at (datetime.datetime): + display_time (str): + status (str): + user_uuid (UUID): + comments_count (str): + likes_count (str): + state_ordering (str): + statistics (AdStatistic): + details (Union[Unset, Any]): + location (Union['CaptureLocationType0', None, Unset]): + location_is_approximate (Union[Unset, bool]): + refined_banner (Union[Unset, RefinedAdBanner]): + new_title (Union[None, Unset, str]): + new_description (Union[None, Unset, str]): + new_banner (Union[None, Unset, str]): + new_url (Union[None, Unset, str]): + new_tags (Union[Unset, Any]): + new_address (Union[None, Unset, str]): + new_reward_amount (Union[None, Unset, int]): + new_reward_count (Union[None, Unset, int]): + """ + + uuid: UUID + title: Union[None, str] + type_: Type0D9Enum + contents: list["AdContent"] + refined_contents: list["RefinedAdContent"] + description: Union[None, str] + banner: Union[None, str] + reward_amount: int + reward_count: int + balance: Union[None, int] + address: Union[None, str] + url: Union[None, str] + tags: Union[None, list[str]] + state: State634Enum + get_state_display: str + rejection_reason: Union[None, RejectionReasonEnum] + created_at: datetime.datetime + updated_at: datetime.datetime + display_time: str + status: str + user_uuid: UUID + comments_count: str + likes_count: str + state_ordering: str + statistics: "AdStatistic" + details: Union[Unset, Any] = UNSET + location: Union["CaptureLocationType0", None, Unset] = UNSET + location_is_approximate: Union[Unset, bool] = UNSET + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + new_title: Union[None, Unset, str] = UNSET + new_description: Union[None, Unset, str] = UNSET + new_banner: Union[None, Unset, str] = UNSET + new_url: Union[None, Unset, str] = UNSET + new_tags: Union[Unset, Any] = UNSET + new_address: Union[None, Unset, str] = UNSET + new_reward_amount: Union[None, Unset, int] = UNSET + new_reward_count: Union[None, Unset, int] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .capture_location_type_0 import CaptureLocationType0 + + uuid = str(self.uuid) + + title: Union[None, str] + title = self.title + + type_ = self.type_.value + + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, str] + description = self.description + + banner: Union[None, str] + banner = self.banner + + reward_amount = self.reward_amount + + reward_count = self.reward_count + + balance: Union[None, int] + balance = self.balance + + address: Union[None, str] + address = self.address + + url: Union[None, str] + url = self.url + + tags: Union[None, list[str]] + if isinstance(self.tags, list): + tags = self.tags + + else: + tags = self.tags + + state = self.state.value + + get_state_display = self.get_state_display + + rejection_reason: Union[None, str] + if isinstance(self.rejection_reason, RejectionReasonEnum): + rejection_reason = self.rejection_reason.value + else: + rejection_reason = self.rejection_reason + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + display_time = self.display_time + + status = self.status + + user_uuid = str(self.user_uuid) + + comments_count = self.comments_count + + likes_count = self.likes_count + + state_ordering = self.state_ordering + + statistics = self.statistics.to_dict() + + details = self.details + + location: Union[None, Unset, dict[str, Any]] + if isinstance(self.location, Unset): + location = UNSET + elif isinstance(self.location, CaptureLocationType0): + location = self.location.to_dict() + else: + location = self.location + + location_is_approximate = self.location_is_approximate + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + new_title: Union[None, Unset, str] + if isinstance(self.new_title, Unset): + new_title = UNSET + else: + new_title = self.new_title + + new_description: Union[None, Unset, str] + if isinstance(self.new_description, Unset): + new_description = UNSET + else: + new_description = self.new_description + + new_banner: Union[None, Unset, str] + if isinstance(self.new_banner, Unset): + new_banner = UNSET + else: + new_banner = self.new_banner + + new_url: Union[None, Unset, str] + if isinstance(self.new_url, Unset): + new_url = UNSET + else: + new_url = self.new_url + + new_tags = self.new_tags + + new_address: Union[None, Unset, str] + if isinstance(self.new_address, Unset): + new_address = UNSET + else: + new_address = self.new_address + + new_reward_amount: Union[None, Unset, int] + if isinstance(self.new_reward_amount, Unset): + new_reward_amount = UNSET + else: + new_reward_amount = self.new_reward_amount + + new_reward_count: Union[None, Unset, int] + if isinstance(self.new_reward_count, Unset): + new_reward_count = UNSET + else: + new_reward_count = self.new_reward_count + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "title": title, + "type": type_, + "contents": contents, + "refined_contents": refined_contents, + "description": description, + "banner": banner, + "reward_amount": reward_amount, + "reward_count": reward_count, + "balance": balance, + "address": address, + "url": url, + "tags": tags, + "state": state, + "get_state_display": get_state_display, + "rejection_reason": rejection_reason, + "created_at": created_at, + "updated_at": updated_at, + "display_time": display_time, + "status": status, + "user_uuid": user_uuid, + "comments_count": comments_count, + "likes_count": likes_count, + "state_ordering": state_ordering, + "statistics": statistics, + } + ) + if details is not UNSET: + field_dict["details"] = details + if location is not UNSET: + field_dict["location"] = location + if location_is_approximate is not UNSET: + field_dict["location_is_approximate"] = location_is_approximate + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + if new_title is not UNSET: + field_dict["new_title"] = new_title + if new_description is not UNSET: + field_dict["new_description"] = new_description + if new_banner is not UNSET: + field_dict["new_banner"] = new_banner + if new_url is not UNSET: + field_dict["new_url"] = new_url + if new_tags is not UNSET: + field_dict["new_tags"] = new_tags + if new_address is not UNSET: + field_dict["new_address"] = new_address + if new_reward_amount is not UNSET: + field_dict["new_reward_amount"] = new_reward_amount + if new_reward_count is not UNSET: + field_dict["new_reward_count"] = new_reward_count + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_statistic import AdStatistic + from .capture_location_type_0 import CaptureLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + def _parse_title(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + title = _parse_title(d.pop("title")) + + type_ = Type0D9Enum(d.pop("type")) + + contents = [] + _contents = d.pop("contents") + for contents_item_data in _contents: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents") + for refined_contents_item_data in _refined_contents: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + description = _parse_description(d.pop("description")) + + def _parse_banner(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + banner = _parse_banner(d.pop("banner")) + + reward_amount = d.pop("reward_amount") + + reward_count = d.pop("reward_count") + + def _parse_balance(data: object) -> Union[None, int]: + if data is None: + return data + return cast(Union[None, int], data) + + balance = _parse_balance(d.pop("balance")) + + def _parse_address(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + address = _parse_address(d.pop("address")) + + def _parse_url(data: object) -> Union[None, str]: + if data is None: + return data + return cast(Union[None, str], data) + + url = _parse_url(d.pop("url")) + + def _parse_tags(data: object) -> Union[None, list[str]]: + if data is None: + return data + try: + if not isinstance(data, list): + raise TypeError() + tags_type_0 = cast(list[str], data) + + return tags_type_0 + except: # noqa: E722 + pass + return cast(Union[None, list[str]], data) + + tags = _parse_tags(d.pop("tags")) + + state = State634Enum(d.pop("state")) + + get_state_display = d.pop("get_state_display") + + def _parse_rejection_reason(data: object) -> Union[None, RejectionReasonEnum]: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + rejection_reason_type_0 = RejectionReasonEnum(data) + + return rejection_reason_type_0 + except: # noqa: E722 + pass + return cast(Union[None, RejectionReasonEnum], data) + + rejection_reason = _parse_rejection_reason(d.pop("rejection_reason")) + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + display_time = d.pop("display_time") + + status = d.pop("status") + + user_uuid = UUID(d.pop("user_uuid")) + + comments_count = d.pop("comments_count") + + likes_count = d.pop("likes_count") + + state_ordering = d.pop("state_ordering") + + statistics = AdStatistic.from_dict(d.pop("statistics")) + + details = d.pop("details", UNSET) + + def _parse_location(data: object) -> Union["CaptureLocationType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = CaptureLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["CaptureLocationType0", None, Unset], data) + + location = _parse_location(d.pop("location", UNSET)) + + location_is_approximate = d.pop("location_is_approximate", UNSET) + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + def _parse_new_title(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_title = _parse_new_title(d.pop("new_title", UNSET)) + + def _parse_new_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_description = _parse_new_description(d.pop("new_description", UNSET)) + + def _parse_new_banner(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_banner = _parse_new_banner(d.pop("new_banner", UNSET)) + + def _parse_new_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_url = _parse_new_url(d.pop("new_url", UNSET)) + + new_tags = d.pop("new_tags", UNSET) + + def _parse_new_address(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_address = _parse_new_address(d.pop("new_address", UNSET)) + + def _parse_new_reward_amount(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_amount = _parse_new_reward_amount(d.pop("new_reward_amount", UNSET)) + + def _parse_new_reward_count(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_count = _parse_new_reward_count(d.pop("new_reward_count", UNSET)) + + capture = cls( + uuid=uuid, + title=title, + type_=type_, + contents=contents, + refined_contents=refined_contents, + description=description, + banner=banner, + reward_amount=reward_amount, + reward_count=reward_count, + balance=balance, + address=address, + url=url, + tags=tags, + state=state, + get_state_display=get_state_display, + rejection_reason=rejection_reason, + created_at=created_at, + updated_at=updated_at, + display_time=display_time, + status=status, + user_uuid=user_uuid, + comments_count=comments_count, + likes_count=likes_count, + state_ordering=state_ordering, + statistics=statistics, + details=details, + location=location, + location_is_approximate=location_is_approximate, + refined_banner=refined_banner, + new_title=new_title, + new_description=new_description, + new_banner=new_banner, + new_url=new_url, + new_tags=new_tags, + new_address=new_address, + new_reward_amount=new_reward_amount, + new_reward_count=new_reward_count, + ) + + capture.additional_properties = d + return capture + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/capture_location_type_0.py b/utils/clients/gooyal_advertising_client/models/capture_location_type_0.py new file mode 100644 index 0000000..62413df --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/capture_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .capture_location_type_0_type import CaptureLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CaptureLocationType0") + + +@_attrs_define +class CaptureLocationType0: + """ + Attributes: + type_ (Union[Unset, CaptureLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, CaptureLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, CaptureLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = CaptureLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + capture_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + capture_location_type_0.additional_properties = d + return capture_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/capture_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/capture_location_type_0_type.py new file mode 100644 index 0000000..ac5ed24 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/capture_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class CaptureLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/category_enum.py b/utils/clients/gooyal_advertising_client/models/category_enum.py new file mode 100644 index 0000000..1ff8995 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/category_enum.py @@ -0,0 +1,10 @@ +from enum import IntEnum + + +class CategoryEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/check_in.py b/utils/clients/gooyal_advertising_client/models/check_in.py new file mode 100644 index 0000000..77fd641 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/check_in.py @@ -0,0 +1,124 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .check_in_location_type_0 import CheckInLocationType0 + + +T = TypeVar("T", bound="CheckIn") + + +@_attrs_define +class CheckIn: + """ + Attributes: + user (UUID): + zone (UUID): + score (int): + zone_state (str): + location (Union['CheckInLocationType0', None, Unset]): + """ + + user: UUID + zone: UUID + score: int + zone_state: str + location: Union["CheckInLocationType0", None, Unset] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .check_in_location_type_0 import CheckInLocationType0 + + user = str(self.user) + + zone = str(self.zone) + + score = self.score + + zone_state = self.zone_state + + location: Union[None, Unset, dict[str, Any]] + if isinstance(self.location, Unset): + location = UNSET + elif isinstance(self.location, CheckInLocationType0): + location = self.location.to_dict() + else: + location = self.location + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "user": user, + "zone": zone, + "score": score, + "zone_state": zone_state, + } + ) + if location is not UNSET: + field_dict["location"] = location + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .check_in_location_type_0 import CheckInLocationType0 + + d = dict(src_dict) + user = UUID(d.pop("user")) + + zone = UUID(d.pop("zone")) + + score = d.pop("score") + + zone_state = d.pop("zone_state") + + def _parse_location(data: object) -> Union["CheckInLocationType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = CheckInLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["CheckInLocationType0", None, Unset], data) + + location = _parse_location(d.pop("location", UNSET)) + + check_in = cls( + user=user, + zone=zone, + score=score, + zone_state=zone_state, + location=location, + ) + + check_in.additional_properties = d + return check_in + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/check_in_location_type_0.py b/utils/clients/gooyal_advertising_client/models/check_in_location_type_0.py new file mode 100644 index 0000000..1208c9c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/check_in_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .check_in_location_type_0_type import CheckInLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="CheckInLocationType0") + + +@_attrs_define +class CheckInLocationType0: + """ + Attributes: + type_ (Union[Unset, CheckInLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, CheckInLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, CheckInLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = CheckInLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + check_in_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + check_in_location_type_0.additional_properties = d + return check_in_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/check_in_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/check_in_location_type_0_type.py new file mode 100644 index 0000000..4dd1ea0 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/check_in_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class CheckInLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/cluster.py b/utils/clients/gooyal_advertising_client/models/cluster.py new file mode 100644 index 0000000..e1e808e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/cluster.py @@ -0,0 +1,83 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="Cluster") + + +@_attrs_define +class Cluster: + """ + Attributes: + cluster (int): + ads_rewards_amount (int): + ads_count (int): + location (Any): + """ + + cluster: int + ads_rewards_amount: int + ads_count: int + location: Any + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + cluster = self.cluster + + ads_rewards_amount = self.ads_rewards_amount + + ads_count = self.ads_count + + location = self.location + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "cluster": cluster, + "ads_rewards_amount": ads_rewards_amount, + "ads_count": ads_count, + "location": location, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + cluster = d.pop("cluster") + + ads_rewards_amount = d.pop("ads_rewards_amount") + + ads_count = d.pop("ads_count") + + location = d.pop("location") + + cluster = cls( + cluster=cluster, + ads_rewards_amount=ads_rewards_amount, + ads_count=ads_count, + location=location, + ) + + cluster.additional_properties = d + return cluster + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/comment.py b/utils/clients/gooyal_advertising_client/models/comment.py new file mode 100644 index 0000000..b952739 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/comment.py @@ -0,0 +1,134 @@ +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +T = TypeVar("T", bound="Comment") + + +@_attrs_define +class Comment: + """ + Attributes: + uuid (UUID): + user_uuid (UUID): + content (str): + likes_count (str): + dislikes_count (str): + user_reaction (str): + created_at (datetime.datetime): + updated_at (datetime.datetime): + ad (UUID): + replies (str): + """ + + uuid: UUID + user_uuid: UUID + content: str + likes_count: str + dislikes_count: str + user_reaction: str + created_at: datetime.datetime + updated_at: datetime.datetime + ad: UUID + replies: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + user_uuid = str(self.user_uuid) + + content = self.content + + likes_count = self.likes_count + + dislikes_count = self.dislikes_count + + user_reaction = self.user_reaction + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + ad = str(self.ad) + + replies = self.replies + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "user_uuid": user_uuid, + "content": content, + "likes_count": likes_count, + "dislikes_count": dislikes_count, + "user_reaction": user_reaction, + "created_at": created_at, + "updated_at": updated_at, + "ad": ad, + "replies": replies, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + user_uuid = UUID(d.pop("user_uuid")) + + content = d.pop("content") + + likes_count = d.pop("likes_count") + + dislikes_count = d.pop("dislikes_count") + + user_reaction = d.pop("user_reaction") + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + ad = UUID(d.pop("ad")) + + replies = d.pop("replies") + + comment = cls( + uuid=uuid, + user_uuid=user_uuid, + content=content, + likes_count=likes_count, + dislikes_count=dislikes_count, + user_reaction=user_reaction, + created_at=created_at, + updated_at=updated_at, + ad=ad, + replies=replies, + ) + + comment.additional_properties = d + return comment + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/comment_create.py b/utils/clients/gooyal_advertising_client/models/comment_create.py new file mode 100644 index 0000000..fb5c269 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/comment_create.py @@ -0,0 +1,101 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="CommentCreate") + + +@_attrs_define +class CommentCreate: + """ + Attributes: + uuid (UUID): + ad (UUID): + content (str): + parent (Union[None, UUID]): + """ + + uuid: UUID + ad: UUID + content: str + parent: Union[None, UUID] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + ad = str(self.ad) + + content = self.content + + parent: Union[None, str] + if isinstance(self.parent, UUID): + parent = str(self.parent) + else: + parent = self.parent + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "ad": ad, + "content": content, + "parent": parent, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + ad = UUID(d.pop("ad")) + + content = d.pop("content") + + def _parse_parent(data: object) -> Union[None, UUID]: + if data is None: + return data + try: + if not isinstance(data, str): + raise TypeError() + parent_type_0 = UUID(data) + + return parent_type_0 + except: # noqa: E722 + pass + return cast(Union[None, UUID], data) + + parent = _parse_parent(d.pop("parent")) + + comment_create = cls( + uuid=uuid, + ad=ad, + content=content, + parent=parent, + ) + + comment_create.additional_properties = d + return comment_create + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/config.py b/utils/clients/gooyal_advertising_client/models/config.py new file mode 100644 index 0000000..fd3b395 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/config.py @@ -0,0 +1,96 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .value_type_enum import ValueTypeEnum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="Config") + + +@_attrs_define +class Config: + """ + Attributes: + key (str): + value_type (ValueTypeEnum): * `INT` - Integer + * `FLOAT` - Float + * `BOOLEAN` - Boolean + * `STRING` - String + * `DATE` - Date + * `DATETIME` - DateTime + * `JSON` - JSON + value (Union[None, Unset, str]): + """ + + key: str + value_type: ValueTypeEnum + value: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + key = self.key + + value_type = self.value_type.value + + value: Union[None, Unset, str] + if isinstance(self.value, Unset): + value = UNSET + else: + value = self.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "key": key, + "value_type": value_type, + } + ) + if value is not UNSET: + field_dict["value"] = value + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + key = d.pop("key") + + value_type = ValueTypeEnum(d.pop("value_type")) + + def _parse_value(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + value = _parse_value(d.pop("value", UNSET)) + + config = cls( + key=key, + value_type=value_type, + value=value, + ) + + config.additional_properties = d + return config + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/content_type_enum.py b/utils/clients/gooyal_advertising_client/models/content_type_enum.py new file mode 100644 index 0000000..0a8f5a1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/content_type_enum.py @@ -0,0 +1,11 @@ +from enum import IntEnum + + +class ContentTypeEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + VALUE_4 = 4 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/new_content_type_enum.py b/utils/clients/gooyal_advertising_client/models/new_content_type_enum.py new file mode 100644 index 0000000..d93838b --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/new_content_type_enum.py @@ -0,0 +1,11 @@ +from enum import IntEnum + + +class NewContentTypeEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + VALUE_4 = 4 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/paginated_ad_content_list.py b/utils/clients/gooyal_advertising_client/models/paginated_ad_content_list.py new file mode 100644 index 0000000..43f4a17 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_ad_content_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + + +T = TypeVar("T", bound="PaginatedAdContentList") + + +@_attrs_define +class PaginatedAdContentList: + """ + Attributes: + count (int): Example: 123. + results (list['AdContent']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["AdContent"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = AdContent.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_ad_content_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_ad_content_list.additional_properties = d + return paginated_ad_content_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_ad_list.py b/utils/clients/gooyal_advertising_client/models/paginated_ad_list.py new file mode 100644 index 0000000..18b3693 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_ad_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad import Ad + + +T = TypeVar("T", bound="PaginatedAdList") + + +@_attrs_define +class PaginatedAdList: + """ + Attributes: + count (int): Example: 123. + results (list['Ad']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Ad"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad import Ad + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Ad.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_ad_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_ad_list.additional_properties = d + return paginated_ad_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_ad_owner_list.py b/utils/clients/gooyal_advertising_client/models/paginated_ad_owner_list.py new file mode 100644 index 0000000..cba4f66 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_ad_owner_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_owner import AdOwner + + +T = TypeVar("T", bound="PaginatedAdOwnerList") + + +@_attrs_define +class PaginatedAdOwnerList: + """ + Attributes: + count (int): Example: 123. + results (list['AdOwner']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["AdOwner"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_owner import AdOwner + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = AdOwner.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_ad_owner_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_ad_owner_list.additional_properties = d + return paginated_ad_owner_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_ad_public_list.py b/utils/clients/gooyal_advertising_client/models/paginated_ad_public_list.py new file mode 100644 index 0000000..a184d5d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_ad_public_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_public import AdPublic + + +T = TypeVar("T", bound="PaginatedAdPublicList") + + +@_attrs_define +class PaginatedAdPublicList: + """ + Attributes: + count (int): Example: 123. + results (list['AdPublic']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["AdPublic"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_public import AdPublic + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = AdPublic.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_ad_public_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_ad_public_list.additional_properties = d + return paginated_ad_public_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_ad_with_visit_list.py b/utils/clients/gooyal_advertising_client/models/paginated_ad_with_visit_list.py new file mode 100644 index 0000000..17b5f53 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_ad_with_visit_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_with_visit import AdWithVisit + + +T = TypeVar("T", bound="PaginatedAdWithVisitList") + + +@_attrs_define +class PaginatedAdWithVisitList: + """ + Attributes: + count (int): Example: 123. + results (list['AdWithVisit']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["AdWithVisit"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_with_visit import AdWithVisit + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = AdWithVisit.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_ad_with_visit_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_ad_with_visit_list.additional_properties = d + return paginated_ad_with_visit_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_comment_list.py b/utils/clients/gooyal_advertising_client/models/paginated_comment_list.py new file mode 100644 index 0000000..027ccdd --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_comment_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .comment import Comment + + +T = TypeVar("T", bound="PaginatedCommentList") + + +@_attrs_define +class PaginatedCommentList: + """ + Attributes: + count (int): Example: 123. + results (list['Comment']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Comment"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .comment import Comment + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Comment.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_comment_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_comment_list.additional_properties = d + return paginated_comment_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_config_list.py b/utils/clients/gooyal_advertising_client/models/paginated_config_list.py new file mode 100644 index 0000000..e48d9ca --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_config_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .config import Config + + +T = TypeVar("T", bound="PaginatedConfigList") + + +@_attrs_define +class PaginatedConfigList: + """ + Attributes: + count (int): Example: 123. + results (list['Config']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Config"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .config import Config + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Config.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_config_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_config_list.additional_properties = d + return paginated_config_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_refined_ad_content_list.py b/utils/clients/gooyal_advertising_client/models/paginated_refined_ad_content_list.py new file mode 100644 index 0000000..3e05b82 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_refined_ad_content_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="PaginatedRefinedAdContentList") + + +@_attrs_define +class PaginatedRefinedAdContentList: + """ + Attributes: + count (int): Example: 123. + results (list['RefinedAdContent']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["RefinedAdContent"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = RefinedAdContent.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_refined_ad_content_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_refined_ad_content_list.additional_properties = d + return paginated_refined_ad_content_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_suggestion_list.py b/utils/clients/gooyal_advertising_client/models/paginated_suggestion_list.py new file mode 100644 index 0000000..225194e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_suggestion_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .suggestion import Suggestion + + +T = TypeVar("T", bound="PaginatedSuggestionList") + + +@_attrs_define +class PaginatedSuggestionList: + """ + Attributes: + count (int): Example: 123. + results (list['Suggestion']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Suggestion"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .suggestion import Suggestion + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Suggestion.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_suggestion_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_suggestion_list.additional_properties = d + return paginated_suggestion_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_tag_list.py b/utils/clients/gooyal_advertising_client/models/paginated_tag_list.py new file mode 100644 index 0000000..a563eff --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_tag_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .tag import Tag + + +T = TypeVar("T", bound="PaginatedTagList") + + +@_attrs_define +class PaginatedTagList: + """ + Attributes: + count (int): Example: 123. + results (list['Tag']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Tag"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .tag import Tag + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Tag.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_tag_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_tag_list.additional_properties = d + return paginated_tag_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_ticket_list.py b/utils/clients/gooyal_advertising_client/models/paginated_ticket_list.py new file mode 100644 index 0000000..fff068c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_ticket_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ticket import Ticket + + +T = TypeVar("T", bound="PaginatedTicketList") + + +@_attrs_define +class PaginatedTicketList: + """ + Attributes: + count (int): Example: 123. + results (list['Ticket']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Ticket"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ticket import Ticket + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Ticket.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_ticket_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_ticket_list.additional_properties = d + return paginated_ticket_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_visit_list.py b/utils/clients/gooyal_advertising_client/models/paginated_visit_list.py new file mode 100644 index 0000000..360c5e1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_visit_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .visit import Visit + + +T = TypeVar("T", bound="PaginatedVisitList") + + +@_attrs_define +class PaginatedVisitList: + """ + Attributes: + count (int): Example: 123. + results (list['Visit']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Visit"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .visit import Visit + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Visit.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_visit_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_visit_list.additional_properties = d + return paginated_visit_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/paginated_zone_list.py b/utils/clients/gooyal_advertising_client/models/paginated_zone_list.py new file mode 100644 index 0000000..40f5039 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/paginated_zone_list.py @@ -0,0 +1,123 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .zone import Zone + + +T = TypeVar("T", bound="PaginatedZoneList") + + +@_attrs_define +class PaginatedZoneList: + """ + Attributes: + count (int): Example: 123. + results (list['Zone']): + next_ (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=400&limit=100. + previous (Union[None, Unset, str]): Example: http://api.example.org/accounts/?offset=200&limit=100. + """ + + count: int + results: list["Zone"] + next_: Union[None, Unset, str] = UNSET + previous: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + count = self.count + + results = [] + for results_item_data in self.results: + results_item = results_item_data.to_dict() + results.append(results_item) + + next_: Union[None, Unset, str] + if isinstance(self.next_, Unset): + next_ = UNSET + else: + next_ = self.next_ + + previous: Union[None, Unset, str] + if isinstance(self.previous, Unset): + previous = UNSET + else: + previous = self.previous + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "count": count, + "results": results, + } + ) + if next_ is not UNSET: + field_dict["next"] = next_ + if previous is not UNSET: + field_dict["previous"] = previous + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .zone import Zone + + d = dict(src_dict) + count = d.pop("count") + + results = [] + _results = d.pop("results") + for results_item_data in _results: + results_item = Zone.from_dict(results_item_data) + + results.append(results_item) + + def _parse_next_(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + next_ = _parse_next_(d.pop("next", UNSET)) + + def _parse_previous(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + previous = _parse_previous(d.pop("previous", UNSET)) + + paginated_zone_list = cls( + count=count, + results=results, + next_=next_, + previous=previous, + ) + + paginated_zone_list.additional_properties = d + return paginated_zone_list + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/patched_ad_owner.py b/utils/clients/gooyal_advertising_client/models/patched_ad_owner.py new file mode 100644 index 0000000..aa55e60 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/patched_ad_owner.py @@ -0,0 +1,1156 @@ +import datetime +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .access_model_enum import AccessModelEnum +from .attendance_type_enum import AttendanceTypeEnum +from .category_enum import CategoryEnum +from .new_content_type_enum import NewContentTypeEnum +from .payment_state_enum import PaymentStateEnum +from .price_model_enum import PriceModelEnum +from .product_condition_enum import ProductConditionEnum +from .rejection_reason_enum import RejectionReasonEnum +from .role_enum import RoleEnum +from .state_634_enum import State634Enum +from .transportation_cost_enum import TransportationCostEnum +from .type_0d9_enum import Type0D9Enum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .ad_content import AdContent + from .ad_statistic import AdStatistic + from .patched_ad_owner_location_type_0 import PatchedAdOwnerLocationType0 + from .patched_ad_owner_new_location_type_0 import PatchedAdOwnerNewLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + +T = TypeVar("T", bound="PatchedAdOwner") + + +@_attrs_define +class PatchedAdOwner: + """ + Attributes: + uuid (Union[Unset, UUID]): + title (Union[None, Unset, str]): + type_ (Union[Unset, Type0D9Enum]): * `1` - BILLBOARD + * `2` - CAPTURED_BILLBOARD + * `99` - PROMOTION + * `100` - CONSTANT + category (Union[Unset, CategoryEnum]): * `1` - PRODUCT + * `2` - SERVICE + * `3` - SOCIAL_CONTENT + role (Union[Unset, RoleEnum]): * `1` - provider + * `2` - requester + price_model (Union[None, PriceModelEnum, Unset]): + price_detail (Union[Unset, Any]): + product_condition (Union[None, ProductConditionEnum, Unset]): + access_model (Union[Unset, AccessModelEnum]): * `1` - free + * `2` - viewer_reward + * `3` - tip_supported + * `4` - paid_only + attendance_type (Union[AttendanceTypeEnum, None, Unset]): + can_republish (Union[None, Unset, bool]): + transportation_cost (Union[None, TransportationCostEnum, Unset]): + work_end_time (Union[None, Unset, int]): + work_start_time (Union[None, Unset, int]): + details (Union[Unset, Any]): + content (Union[Unset, str]): + contents (Union[Unset, list['AdContent']]): + refined_contents (Union[Unset, list['RefinedAdContent']]): + description (Union[None, Unset, str]): + location (Union['PatchedAdOwnerLocationType0', None, Unset]): + location_is_approximate (Union[Unset, bool]): + banner (Union[None, Unset, str]): + refined_banner (Union[Unset, RefinedAdBanner]): + reward_amount (Union[Unset, int]): + reward_count (Union[Unset, int]): + balance (Union[None, Unset, int]): + address (Union[None, Unset, str]): + url (Union[None, Unset, str]): + phone_number (Union[None, Unset, str]): + social_link (Union[None, Unset, str]): + tags (Union[None, Unset, list[str]]): + new_title (Union[None, Unset, str]): + new_location (Union['PatchedAdOwnerNewLocationType0', None, Unset]): + new_description (Union[None, Unset, str]): + new_banner (Union[None, Unset, str]): + new_content (Union[None, Unset, str]): + new_content_type (Union[NewContentTypeEnum, None, Unset]): + new_url (Union[None, Unset, str]): + new_tags (Union[Unset, Any]): + new_address (Union[None, Unset, str]): + new_phone_number (Union[None, Unset, str]): + new_social_link (Union[None, Unset, str]): + new_reward_amount (Union[None, Unset, int]): + new_reward_count (Union[None, Unset, int]): + payment_state (Union[Unset, PaymentStateEnum]): * `1` - created + * `2` - delayed + * `3` - pending + * `4` - incomplete + * `5` - success + * `6` - failed + * `7` - expected_failure + state (Union[Unset, State634Enum]): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + get_payment_state_display (Union[Unset, str]): + get_state_display (Union[Unset, str]): + rejection_reason (Union[None, RejectionReasonEnum, Unset]): + created_at (Union[Unset, datetime.datetime]): + updated_at (Union[Unset, datetime.datetime]): + display_time (Union[Unset, str]): + status (Union[Unset, str]): + user_uuid (Union[Unset, UUID]): + comments_count (Union[Unset, str]): + likes_count (Union[Unset, str]): + state_ordering (Union[Unset, str]): + statistics (Union[Unset, AdStatistic]): + """ + + uuid: Union[Unset, UUID] = UNSET + title: Union[None, Unset, str] = UNSET + type_: Union[Unset, Type0D9Enum] = UNSET + category: Union[Unset, CategoryEnum] = UNSET + role: Union[Unset, RoleEnum] = UNSET + price_model: Union[None, PriceModelEnum, Unset] = UNSET + price_detail: Union[Unset, Any] = UNSET + product_condition: Union[None, ProductConditionEnum, Unset] = UNSET + access_model: Union[Unset, AccessModelEnum] = UNSET + attendance_type: Union[AttendanceTypeEnum, None, Unset] = UNSET + can_republish: Union[None, Unset, bool] = UNSET + transportation_cost: Union[None, TransportationCostEnum, Unset] = UNSET + work_end_time: Union[None, Unset, int] = UNSET + work_start_time: Union[None, Unset, int] = UNSET + details: Union[Unset, Any] = UNSET + content: Union[Unset, str] = UNSET + contents: Union[Unset, list["AdContent"]] = UNSET + refined_contents: Union[Unset, list["RefinedAdContent"]] = UNSET + description: Union[None, Unset, str] = UNSET + location: Union["PatchedAdOwnerLocationType0", None, Unset] = UNSET + location_is_approximate: Union[Unset, bool] = UNSET + banner: Union[None, Unset, str] = UNSET + refined_banner: Union[Unset, "RefinedAdBanner"] = UNSET + reward_amount: Union[Unset, int] = UNSET + reward_count: Union[Unset, int] = UNSET + balance: Union[None, Unset, int] = UNSET + address: Union[None, Unset, str] = UNSET + url: Union[None, Unset, str] = UNSET + phone_number: Union[None, Unset, str] = UNSET + social_link: Union[None, Unset, str] = UNSET + tags: Union[None, Unset, list[str]] = UNSET + new_title: Union[None, Unset, str] = UNSET + new_location: Union["PatchedAdOwnerNewLocationType0", None, Unset] = UNSET + new_description: Union[None, Unset, str] = UNSET + new_banner: Union[None, Unset, str] = UNSET + new_content: Union[None, Unset, str] = UNSET + new_content_type: Union[NewContentTypeEnum, None, Unset] = UNSET + new_url: Union[None, Unset, str] = UNSET + new_tags: Union[Unset, Any] = UNSET + new_address: Union[None, Unset, str] = UNSET + new_phone_number: Union[None, Unset, str] = UNSET + new_social_link: Union[None, Unset, str] = UNSET + new_reward_amount: Union[None, Unset, int] = UNSET + new_reward_count: Union[None, Unset, int] = UNSET + payment_state: Union[Unset, PaymentStateEnum] = UNSET + state: Union[Unset, State634Enum] = UNSET + get_payment_state_display: Union[Unset, str] = UNSET + get_state_display: Union[Unset, str] = UNSET + rejection_reason: Union[None, RejectionReasonEnum, Unset] = UNSET + created_at: Union[Unset, datetime.datetime] = UNSET + updated_at: Union[Unset, datetime.datetime] = UNSET + display_time: Union[Unset, str] = UNSET + status: Union[Unset, str] = UNSET + user_uuid: Union[Unset, UUID] = UNSET + comments_count: Union[Unset, str] = UNSET + likes_count: Union[Unset, str] = UNSET + state_ordering: Union[Unset, str] = UNSET + statistics: Union[Unset, "AdStatistic"] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .patched_ad_owner_location_type_0 import PatchedAdOwnerLocationType0 + from .patched_ad_owner_new_location_type_0 import PatchedAdOwnerNewLocationType0 + + uuid: Union[Unset, str] = UNSET + if not isinstance(self.uuid, Unset): + uuid = str(self.uuid) + + title: Union[None, Unset, str] + if isinstance(self.title, Unset): + title = UNSET + else: + title = self.title + + type_: Union[Unset, int] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + category: Union[Unset, int] = UNSET + if not isinstance(self.category, Unset): + category = self.category.value + + role: Union[Unset, int] = UNSET + if not isinstance(self.role, Unset): + role = self.role.value + + price_model: Union[None, Unset, int] + if isinstance(self.price_model, Unset): + price_model = UNSET + elif isinstance(self.price_model, PriceModelEnum): + price_model = self.price_model.value + else: + price_model = self.price_model + + price_detail = self.price_detail + + product_condition: Union[None, Unset, int] + if isinstance(self.product_condition, Unset): + product_condition = UNSET + elif isinstance(self.product_condition, ProductConditionEnum): + product_condition = self.product_condition.value + else: + product_condition = self.product_condition + + access_model: Union[Unset, int] = UNSET + if not isinstance(self.access_model, Unset): + access_model = self.access_model.value + + attendance_type: Union[None, Unset, int] + if isinstance(self.attendance_type, Unset): + attendance_type = UNSET + elif isinstance(self.attendance_type, AttendanceTypeEnum): + attendance_type = self.attendance_type.value + else: + attendance_type = self.attendance_type + + can_republish: Union[None, Unset, bool] + if isinstance(self.can_republish, Unset): + can_republish = UNSET + else: + can_republish = self.can_republish + + transportation_cost: Union[None, Unset, int] + if isinstance(self.transportation_cost, Unset): + transportation_cost = UNSET + elif isinstance(self.transportation_cost, TransportationCostEnum): + transportation_cost = self.transportation_cost.value + else: + transportation_cost = self.transportation_cost + + work_end_time: Union[None, Unset, int] + if isinstance(self.work_end_time, Unset): + work_end_time = UNSET + else: + work_end_time = self.work_end_time + + work_start_time: Union[None, Unset, int] + if isinstance(self.work_start_time, Unset): + work_start_time = UNSET + else: + work_start_time = self.work_start_time + + details = self.details + + content = self.content + + contents: Union[Unset, list[dict[str, Any]]] = UNSET + if not isinstance(self.contents, Unset): + contents = [] + for contents_item_data in self.contents: + contents_item = contents_item_data.to_dict() + contents.append(contents_item) + + refined_contents: Union[Unset, list[dict[str, Any]]] = UNSET + if not isinstance(self.refined_contents, Unset): + refined_contents = [] + for refined_contents_item_data in self.refined_contents: + refined_contents_item = refined_contents_item_data.to_dict() + refined_contents.append(refined_contents_item) + + description: Union[None, Unset, str] + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + location: Union[None, Unset, dict[str, Any]] + if isinstance(self.location, Unset): + location = UNSET + elif isinstance(self.location, PatchedAdOwnerLocationType0): + location = self.location.to_dict() + else: + location = self.location + + location_is_approximate = self.location_is_approximate + + banner: Union[None, Unset, str] + if isinstance(self.banner, Unset): + banner = UNSET + else: + banner = self.banner + + refined_banner: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.refined_banner, Unset): + refined_banner = self.refined_banner.to_dict() + + reward_amount = self.reward_amount + + reward_count = self.reward_count + + balance: Union[None, Unset, int] + if isinstance(self.balance, Unset): + balance = UNSET + else: + balance = self.balance + + address: Union[None, Unset, str] + if isinstance(self.address, Unset): + address = UNSET + else: + address = self.address + + url: Union[None, Unset, str] + if isinstance(self.url, Unset): + url = UNSET + else: + url = self.url + + phone_number: Union[None, Unset, str] + if isinstance(self.phone_number, Unset): + phone_number = UNSET + else: + phone_number = self.phone_number + + social_link: Union[None, Unset, str] + if isinstance(self.social_link, Unset): + social_link = UNSET + else: + social_link = self.social_link + + tags: Union[None, Unset, list[str]] + if isinstance(self.tags, Unset): + tags = UNSET + elif isinstance(self.tags, list): + tags = self.tags + + else: + tags = self.tags + + new_title: Union[None, Unset, str] + if isinstance(self.new_title, Unset): + new_title = UNSET + else: + new_title = self.new_title + + new_location: Union[None, Unset, dict[str, Any]] + if isinstance(self.new_location, Unset): + new_location = UNSET + elif isinstance(self.new_location, PatchedAdOwnerNewLocationType0): + new_location = self.new_location.to_dict() + else: + new_location = self.new_location + + new_description: Union[None, Unset, str] + if isinstance(self.new_description, Unset): + new_description = UNSET + else: + new_description = self.new_description + + new_banner: Union[None, Unset, str] + if isinstance(self.new_banner, Unset): + new_banner = UNSET + else: + new_banner = self.new_banner + + new_content: Union[None, Unset, str] + if isinstance(self.new_content, Unset): + new_content = UNSET + else: + new_content = self.new_content + + new_content_type: Union[None, Unset, int] + if isinstance(self.new_content_type, Unset): + new_content_type = UNSET + elif isinstance(self.new_content_type, NewContentTypeEnum): + new_content_type = self.new_content_type.value + else: + new_content_type = self.new_content_type + + new_url: Union[None, Unset, str] + if isinstance(self.new_url, Unset): + new_url = UNSET + else: + new_url = self.new_url + + new_tags = self.new_tags + + new_address: Union[None, Unset, str] + if isinstance(self.new_address, Unset): + new_address = UNSET + else: + new_address = self.new_address + + new_phone_number: Union[None, Unset, str] + if isinstance(self.new_phone_number, Unset): + new_phone_number = UNSET + else: + new_phone_number = self.new_phone_number + + new_social_link: Union[None, Unset, str] + if isinstance(self.new_social_link, Unset): + new_social_link = UNSET + else: + new_social_link = self.new_social_link + + new_reward_amount: Union[None, Unset, int] + if isinstance(self.new_reward_amount, Unset): + new_reward_amount = UNSET + else: + new_reward_amount = self.new_reward_amount + + new_reward_count: Union[None, Unset, int] + if isinstance(self.new_reward_count, Unset): + new_reward_count = UNSET + else: + new_reward_count = self.new_reward_count + + payment_state: Union[Unset, int] = UNSET + if not isinstance(self.payment_state, Unset): + payment_state = self.payment_state.value + + state: Union[Unset, int] = UNSET + if not isinstance(self.state, Unset): + state = self.state.value + + get_payment_state_display = self.get_payment_state_display + + get_state_display = self.get_state_display + + rejection_reason: Union[None, Unset, str] + if isinstance(self.rejection_reason, Unset): + rejection_reason = UNSET + elif isinstance(self.rejection_reason, RejectionReasonEnum): + rejection_reason = self.rejection_reason.value + else: + rejection_reason = self.rejection_reason + + created_at: Union[Unset, str] = UNSET + if not isinstance(self.created_at, Unset): + created_at = self.created_at.isoformat() + + updated_at: Union[Unset, str] = UNSET + if not isinstance(self.updated_at, Unset): + updated_at = self.updated_at.isoformat() + + display_time = self.display_time + + status = self.status + + user_uuid: Union[Unset, str] = UNSET + if not isinstance(self.user_uuid, Unset): + user_uuid = str(self.user_uuid) + + comments_count = self.comments_count + + likes_count = self.likes_count + + state_ordering = self.state_ordering + + statistics: Union[Unset, dict[str, Any]] = UNSET + if not isinstance(self.statistics, Unset): + statistics = self.statistics.to_dict() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if uuid is not UNSET: + field_dict["uuid"] = uuid + if title is not UNSET: + field_dict["title"] = title + if type_ is not UNSET: + field_dict["type"] = type_ + if category is not UNSET: + field_dict["category"] = category + if role is not UNSET: + field_dict["role"] = role + if price_model is not UNSET: + field_dict["price_model"] = price_model + if price_detail is not UNSET: + field_dict["price_detail"] = price_detail + if product_condition is not UNSET: + field_dict["product_condition"] = product_condition + if access_model is not UNSET: + field_dict["access_model"] = access_model + if attendance_type is not UNSET: + field_dict["attendance_type"] = attendance_type + if can_republish is not UNSET: + field_dict["can_republish"] = can_republish + if transportation_cost is not UNSET: + field_dict["transportation_cost"] = transportation_cost + if work_end_time is not UNSET: + field_dict["work_end_time"] = work_end_time + if work_start_time is not UNSET: + field_dict["work_start_time"] = work_start_time + if details is not UNSET: + field_dict["details"] = details + if content is not UNSET: + field_dict["content"] = content + if contents is not UNSET: + field_dict["contents"] = contents + if refined_contents is not UNSET: + field_dict["refined_contents"] = refined_contents + if description is not UNSET: + field_dict["description"] = description + if location is not UNSET: + field_dict["location"] = location + if location_is_approximate is not UNSET: + field_dict["location_is_approximate"] = location_is_approximate + if banner is not UNSET: + field_dict["banner"] = banner + if refined_banner is not UNSET: + field_dict["refined_banner"] = refined_banner + if reward_amount is not UNSET: + field_dict["reward_amount"] = reward_amount + if reward_count is not UNSET: + field_dict["reward_count"] = reward_count + if balance is not UNSET: + field_dict["balance"] = balance + if address is not UNSET: + field_dict["address"] = address + if url is not UNSET: + field_dict["url"] = url + if phone_number is not UNSET: + field_dict["phone_number"] = phone_number + if social_link is not UNSET: + field_dict["social_link"] = social_link + if tags is not UNSET: + field_dict["tags"] = tags + if new_title is not UNSET: + field_dict["new_title"] = new_title + if new_location is not UNSET: + field_dict["new_location"] = new_location + if new_description is not UNSET: + field_dict["new_description"] = new_description + if new_banner is not UNSET: + field_dict["new_banner"] = new_banner + if new_content is not UNSET: + field_dict["new_content"] = new_content + if new_content_type is not UNSET: + field_dict["new_content_type"] = new_content_type + if new_url is not UNSET: + field_dict["new_url"] = new_url + if new_tags is not UNSET: + field_dict["new_tags"] = new_tags + if new_address is not UNSET: + field_dict["new_address"] = new_address + if new_phone_number is not UNSET: + field_dict["new_phone_number"] = new_phone_number + if new_social_link is not UNSET: + field_dict["new_social_link"] = new_social_link + if new_reward_amount is not UNSET: + field_dict["new_reward_amount"] = new_reward_amount + if new_reward_count is not UNSET: + field_dict["new_reward_count"] = new_reward_count + if payment_state is not UNSET: + field_dict["payment_state"] = payment_state + if state is not UNSET: + field_dict["state"] = state + if get_payment_state_display is not UNSET: + field_dict["get_payment_state_display"] = get_payment_state_display + if get_state_display is not UNSET: + field_dict["get_state_display"] = get_state_display + if rejection_reason is not UNSET: + field_dict["rejection_reason"] = rejection_reason + if created_at is not UNSET: + field_dict["created_at"] = created_at + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + if display_time is not UNSET: + field_dict["display_time"] = display_time + if status is not UNSET: + field_dict["status"] = status + if user_uuid is not UNSET: + field_dict["user_uuid"] = user_uuid + if comments_count is not UNSET: + field_dict["comments_count"] = comments_count + if likes_count is not UNSET: + field_dict["likes_count"] = likes_count + if state_ordering is not UNSET: + field_dict["state_ordering"] = state_ordering + if statistics is not UNSET: + field_dict["statistics"] = statistics + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_content import AdContent + from .ad_statistic import AdStatistic + from .patched_ad_owner_location_type_0 import PatchedAdOwnerLocationType0 + from .patched_ad_owner_new_location_type_0 import PatchedAdOwnerNewLocationType0 + from .refined_ad_banner import RefinedAdBanner + from .refined_ad_content import RefinedAdContent + + d = dict(src_dict) + _uuid = d.pop("uuid", UNSET) + uuid: Union[Unset, UUID] + if isinstance(_uuid, Unset): + uuid = UNSET + else: + uuid = UUID(_uuid) + + def _parse_title(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + title = _parse_title(d.pop("title", UNSET)) + + _type_ = d.pop("type", UNSET) + type_: Union[Unset, Type0D9Enum] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = Type0D9Enum(_type_) + + _category = d.pop("category", UNSET) + category: Union[Unset, CategoryEnum] + if isinstance(_category, Unset): + category = UNSET + else: + category = CategoryEnum(_category) + + _role = d.pop("role", UNSET) + role: Union[Unset, RoleEnum] + if isinstance(_role, Unset): + role = UNSET + else: + role = RoleEnum(_role) + + def _parse_price_model(data: object) -> Union[None, PriceModelEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + price_model_type_0 = PriceModelEnum(data) + + return price_model_type_0 + except: # noqa: E722 + pass + return cast(Union[None, PriceModelEnum, Unset], data) + + price_model = _parse_price_model(d.pop("price_model", UNSET)) + + price_detail = d.pop("price_detail", UNSET) + + def _parse_product_condition(data: object) -> Union[None, ProductConditionEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + product_condition_type_0 = ProductConditionEnum(data) + + return product_condition_type_0 + except: # noqa: E722 + pass + return cast(Union[None, ProductConditionEnum, Unset], data) + + product_condition = _parse_product_condition(d.pop("product_condition", UNSET)) + + _access_model = d.pop("access_model", UNSET) + access_model: Union[Unset, AccessModelEnum] + if isinstance(_access_model, Unset): + access_model = UNSET + else: + access_model = AccessModelEnum(_access_model) + + def _parse_attendance_type(data: object) -> Union[AttendanceTypeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + attendance_type_type_0 = AttendanceTypeEnum(data) + + return attendance_type_type_0 + except: # noqa: E722 + pass + return cast(Union[AttendanceTypeEnum, None, Unset], data) + + attendance_type = _parse_attendance_type(d.pop("attendance_type", UNSET)) + + def _parse_can_republish(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + can_republish = _parse_can_republish(d.pop("can_republish", UNSET)) + + def _parse_transportation_cost(data: object) -> Union[None, TransportationCostEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + transportation_cost_type_0 = TransportationCostEnum(data) + + return transportation_cost_type_0 + except: # noqa: E722 + pass + return cast(Union[None, TransportationCostEnum, Unset], data) + + transportation_cost = _parse_transportation_cost(d.pop("transportation_cost", UNSET)) + + def _parse_work_end_time(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + work_end_time = _parse_work_end_time(d.pop("work_end_time", UNSET)) + + def _parse_work_start_time(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + work_start_time = _parse_work_start_time(d.pop("work_start_time", UNSET)) + + details = d.pop("details", UNSET) + + content = d.pop("content", UNSET) + + contents = [] + _contents = d.pop("contents", UNSET) + for contents_item_data in _contents or []: + contents_item = AdContent.from_dict(contents_item_data) + + contents.append(contents_item) + + refined_contents = [] + _refined_contents = d.pop("refined_contents", UNSET) + for refined_contents_item_data in _refined_contents or []: + refined_contents_item = RefinedAdContent.from_dict(refined_contents_item_data) + + refined_contents.append(refined_contents_item) + + def _parse_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + description = _parse_description(d.pop("description", UNSET)) + + def _parse_location(data: object) -> Union["PatchedAdOwnerLocationType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = PatchedAdOwnerLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["PatchedAdOwnerLocationType0", None, Unset], data) + + location = _parse_location(d.pop("location", UNSET)) + + location_is_approximate = d.pop("location_is_approximate", UNSET) + + def _parse_banner(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + banner = _parse_banner(d.pop("banner", UNSET)) + + _refined_banner = d.pop("refined_banner", UNSET) + refined_banner: Union[Unset, RefinedAdBanner] + if isinstance(_refined_banner, Unset): + refined_banner = UNSET + else: + refined_banner = RefinedAdBanner.from_dict(_refined_banner) + + reward_amount = d.pop("reward_amount", UNSET) + + reward_count = d.pop("reward_count", UNSET) + + def _parse_balance(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + balance = _parse_balance(d.pop("balance", UNSET)) + + def _parse_address(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + address = _parse_address(d.pop("address", UNSET)) + + def _parse_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + url = _parse_url(d.pop("url", UNSET)) + + def _parse_phone_number(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + phone_number = _parse_phone_number(d.pop("phone_number", UNSET)) + + def _parse_social_link(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + social_link = _parse_social_link(d.pop("social_link", UNSET)) + + def _parse_tags(data: object) -> Union[None, Unset, list[str]]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, list): + raise TypeError() + tags_type_0 = cast(list[str], data) + + return tags_type_0 + except: # noqa: E722 + pass + return cast(Union[None, Unset, list[str]], data) + + tags = _parse_tags(d.pop("tags", UNSET)) + + def _parse_new_title(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_title = _parse_new_title(d.pop("new_title", UNSET)) + + def _parse_new_location(data: object) -> Union["PatchedAdOwnerNewLocationType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + new_location_type_0 = PatchedAdOwnerNewLocationType0.from_dict(data) + + return new_location_type_0 + except: # noqa: E722 + pass + return cast(Union["PatchedAdOwnerNewLocationType0", None, Unset], data) + + new_location = _parse_new_location(d.pop("new_location", UNSET)) + + def _parse_new_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_description = _parse_new_description(d.pop("new_description", UNSET)) + + def _parse_new_banner(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_banner = _parse_new_banner(d.pop("new_banner", UNSET)) + + def _parse_new_content(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_content = _parse_new_content(d.pop("new_content", UNSET)) + + def _parse_new_content_type(data: object) -> Union[NewContentTypeEnum, None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + new_content_type_type_0 = NewContentTypeEnum(data) + + return new_content_type_type_0 + except: # noqa: E722 + pass + return cast(Union[NewContentTypeEnum, None, Unset], data) + + new_content_type = _parse_new_content_type(d.pop("new_content_type", UNSET)) + + def _parse_new_url(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_url = _parse_new_url(d.pop("new_url", UNSET)) + + new_tags = d.pop("new_tags", UNSET) + + def _parse_new_address(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_address = _parse_new_address(d.pop("new_address", UNSET)) + + def _parse_new_phone_number(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_phone_number = _parse_new_phone_number(d.pop("new_phone_number", UNSET)) + + def _parse_new_social_link(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + new_social_link = _parse_new_social_link(d.pop("new_social_link", UNSET)) + + def _parse_new_reward_amount(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_amount = _parse_new_reward_amount(d.pop("new_reward_amount", UNSET)) + + def _parse_new_reward_count(data: object) -> Union[None, Unset, int]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, int], data) + + new_reward_count = _parse_new_reward_count(d.pop("new_reward_count", UNSET)) + + _payment_state = d.pop("payment_state", UNSET) + payment_state: Union[Unset, PaymentStateEnum] + if isinstance(_payment_state, Unset): + payment_state = UNSET + else: + payment_state = PaymentStateEnum(_payment_state) + + _state = d.pop("state", UNSET) + state: Union[Unset, State634Enum] + if isinstance(_state, Unset): + state = UNSET + else: + state = State634Enum(_state) + + get_payment_state_display = d.pop("get_payment_state_display", UNSET) + + get_state_display = d.pop("get_state_display", UNSET) + + def _parse_rejection_reason(data: object) -> Union[None, RejectionReasonEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + rejection_reason_type_0 = RejectionReasonEnum(data) + + return rejection_reason_type_0 + except: # noqa: E722 + pass + return cast(Union[None, RejectionReasonEnum, Unset], data) + + rejection_reason = _parse_rejection_reason(d.pop("rejection_reason", UNSET)) + + _created_at = d.pop("created_at", UNSET) + created_at: Union[Unset, datetime.datetime] + if isinstance(_created_at, Unset): + created_at = UNSET + else: + created_at = isoparse(_created_at) + + _updated_at = d.pop("updated_at", UNSET) + updated_at: Union[Unset, datetime.datetime] + if isinstance(_updated_at, Unset): + updated_at = UNSET + else: + updated_at = isoparse(_updated_at) + + display_time = d.pop("display_time", UNSET) + + status = d.pop("status", UNSET) + + _user_uuid = d.pop("user_uuid", UNSET) + user_uuid: Union[Unset, UUID] + if isinstance(_user_uuid, Unset): + user_uuid = UNSET + else: + user_uuid = UUID(_user_uuid) + + comments_count = d.pop("comments_count", UNSET) + + likes_count = d.pop("likes_count", UNSET) + + state_ordering = d.pop("state_ordering", UNSET) + + _statistics = d.pop("statistics", UNSET) + statistics: Union[Unset, AdStatistic] + if isinstance(_statistics, Unset): + statistics = UNSET + else: + statistics = AdStatistic.from_dict(_statistics) + + patched_ad_owner = cls( + uuid=uuid, + title=title, + type_=type_, + category=category, + role=role, + price_model=price_model, + price_detail=price_detail, + product_condition=product_condition, + access_model=access_model, + attendance_type=attendance_type, + can_republish=can_republish, + transportation_cost=transportation_cost, + work_end_time=work_end_time, + work_start_time=work_start_time, + details=details, + content=content, + contents=contents, + refined_contents=refined_contents, + description=description, + location=location, + location_is_approximate=location_is_approximate, + banner=banner, + refined_banner=refined_banner, + reward_amount=reward_amount, + reward_count=reward_count, + balance=balance, + address=address, + url=url, + phone_number=phone_number, + social_link=social_link, + tags=tags, + new_title=new_title, + new_location=new_location, + new_description=new_description, + new_banner=new_banner, + new_content=new_content, + new_content_type=new_content_type, + new_url=new_url, + new_tags=new_tags, + new_address=new_address, + new_phone_number=new_phone_number, + new_social_link=new_social_link, + new_reward_amount=new_reward_amount, + new_reward_count=new_reward_count, + payment_state=payment_state, + state=state, + get_payment_state_display=get_payment_state_display, + get_state_display=get_state_display, + rejection_reason=rejection_reason, + created_at=created_at, + updated_at=updated_at, + display_time=display_time, + status=status, + user_uuid=user_uuid, + comments_count=comments_count, + likes_count=likes_count, + state_ordering=state_ordering, + statistics=statistics, + ) + + patched_ad_owner.additional_properties = d + return patched_ad_owner + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0.py b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0.py new file mode 100644 index 0000000..59ff17c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .patched_ad_owner_location_type_0_type import PatchedAdOwnerLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PatchedAdOwnerLocationType0") + + +@_attrs_define +class PatchedAdOwnerLocationType0: + """ + Attributes: + type_ (Union[Unset, PatchedAdOwnerLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, PatchedAdOwnerLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, PatchedAdOwnerLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = PatchedAdOwnerLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + patched_ad_owner_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + patched_ad_owner_location_type_0.additional_properties = d + return patched_ad_owner_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0_type.py new file mode 100644 index 0000000..5b6fdd9 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class PatchedAdOwnerLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0.py b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0.py new file mode 100644 index 0000000..d449b93 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .patched_ad_owner_new_location_type_0_type import PatchedAdOwnerNewLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PatchedAdOwnerNewLocationType0") + + +@_attrs_define +class PatchedAdOwnerNewLocationType0: + """ + Attributes: + type_ (Union[Unset, PatchedAdOwnerNewLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, PatchedAdOwnerNewLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, PatchedAdOwnerNewLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = PatchedAdOwnerNewLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + patched_ad_owner_new_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + patched_ad_owner_new_location_type_0.additional_properties = d + return patched_ad_owner_new_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0_type.py new file mode 100644 index 0000000..7b110ce --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/patched_ad_owner_new_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class PatchedAdOwnerNewLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/patched_ticket.py b/utils/clients/gooyal_advertising_client/models/patched_ticket.py new file mode 100644 index 0000000..c3bec03 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/patched_ticket.py @@ -0,0 +1,164 @@ +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .ticket_state_enum import TicketStateEnum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="PatchedTicket") + + +@_attrs_define +class PatchedTicket: + """ + Attributes: + uuid (Union[Unset, UUID]): + user (Union[Unset, UUID]): + title (Union[Unset, str]): + description (Union[None, Unset, str]): + state (Union[Unset, TicketStateEnum]): * `1` - INIT + * `10` - CLOSED + created_at (Union[Unset, datetime.datetime]): + updated_at (Union[Unset, datetime.datetime]): + """ + + uuid: Union[Unset, UUID] = UNSET + user: Union[Unset, UUID] = UNSET + title: Union[Unset, str] = UNSET + description: Union[None, Unset, str] = UNSET + state: Union[Unset, TicketStateEnum] = UNSET + created_at: Union[Unset, datetime.datetime] = UNSET + updated_at: Union[Unset, datetime.datetime] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid: Union[Unset, str] = UNSET + if not isinstance(self.uuid, Unset): + uuid = str(self.uuid) + + user: Union[Unset, str] = UNSET + if not isinstance(self.user, Unset): + user = str(self.user) + + title = self.title + + description: Union[None, Unset, str] + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + state: Union[Unset, int] = UNSET + if not isinstance(self.state, Unset): + state = self.state.value + + created_at: Union[Unset, str] = UNSET + if not isinstance(self.created_at, Unset): + created_at = self.created_at.isoformat() + + updated_at: Union[Unset, str] = UNSET + if not isinstance(self.updated_at, Unset): + updated_at = self.updated_at.isoformat() + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if uuid is not UNSET: + field_dict["uuid"] = uuid + if user is not UNSET: + field_dict["user"] = user + if title is not UNSET: + field_dict["title"] = title + if description is not UNSET: + field_dict["description"] = description + if state is not UNSET: + field_dict["state"] = state + if created_at is not UNSET: + field_dict["created_at"] = created_at + if updated_at is not UNSET: + field_dict["updated_at"] = updated_at + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _uuid = d.pop("uuid", UNSET) + uuid: Union[Unset, UUID] + if isinstance(_uuid, Unset): + uuid = UNSET + else: + uuid = UUID(_uuid) + + _user = d.pop("user", UNSET) + user: Union[Unset, UUID] + if isinstance(_user, Unset): + user = UNSET + else: + user = UUID(_user) + + title = d.pop("title", UNSET) + + def _parse_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + description = _parse_description(d.pop("description", UNSET)) + + _state = d.pop("state", UNSET) + state: Union[Unset, TicketStateEnum] + if isinstance(_state, Unset): + state = UNSET + else: + state = TicketStateEnum(_state) + + _created_at = d.pop("created_at", UNSET) + created_at: Union[Unset, datetime.datetime] + if isinstance(_created_at, Unset): + created_at = UNSET + else: + created_at = isoparse(_created_at) + + _updated_at = d.pop("updated_at", UNSET) + updated_at: Union[Unset, datetime.datetime] + if isinstance(_updated_at, Unset): + updated_at = UNSET + else: + updated_at = isoparse(_updated_at) + + patched_ticket = cls( + uuid=uuid, + user=user, + title=title, + description=description, + state=state, + created_at=created_at, + updated_at=updated_at, + ) + + patched_ticket.additional_properties = d + return patched_ticket + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/payment_state_enum.py b/utils/clients/gooyal_advertising_client/models/payment_state_enum.py new file mode 100644 index 0000000..a99f281 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/payment_state_enum.py @@ -0,0 +1,14 @@ +from enum import IntEnum + + +class PaymentStateEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + VALUE_4 = 4 + VALUE_5 = 5 + VALUE_6 = 6 + VALUE_7 = 7 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/price_model_enum.py b/utils/clients/gooyal_advertising_client/models/price_model_enum.py new file mode 100644 index 0000000..fd93c86 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/price_model_enum.py @@ -0,0 +1,12 @@ +from enum import IntEnum + + +class PriceModelEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + VALUE_4 = 4 + VALUE_5 = 5 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/product_condition_enum.py b/utils/clients/gooyal_advertising_client/models/product_condition_enum.py new file mode 100644 index 0000000..fdf0dcd --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/product_condition_enum.py @@ -0,0 +1,10 @@ +from enum import IntEnum + + +class ProductConditionEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/reaction_toggle.py b/utils/clients/gooyal_advertising_client/models/reaction_toggle.py new file mode 100644 index 0000000..bf0908e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/reaction_toggle.py @@ -0,0 +1,59 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="ReactionToggle") + + +@_attrs_define +class ReactionToggle: + """ + Attributes: + reaction_type (str): + """ + + reaction_type: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + reaction_type = self.reaction_type + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "reaction_type": reaction_type, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + reaction_type = d.pop("reaction_type") + + reaction_toggle = cls( + reaction_type=reaction_type, + ) + + reaction_toggle.additional_properties = d + return reaction_toggle + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/refined_ad_banner.py b/utils/clients/gooyal_advertising_client/models/refined_ad_banner.py new file mode 100644 index 0000000..911b41d --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/refined_ad_banner.py @@ -0,0 +1,125 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .content_type_enum import ContentTypeEnum +from .state_634_enum import State634Enum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="RefinedAdBanner") + + +@_attrs_define +class RefinedAdBanner: + """ + Attributes: + uuid (UUID): + object_key (str): + filename (str): + state (State634Enum): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + url (str): + content_type (Union[Unset, ContentTypeEnum]): * `1` - image + * `2` - voice + * `3` - video + * `4` - document + """ + + uuid: UUID + object_key: str + filename: str + state: State634Enum + url: str + content_type: Union[Unset, ContentTypeEnum] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + object_key = self.object_key + + filename = self.filename + + state = self.state.value + + url = self.url + + content_type: Union[Unset, int] = UNSET + if not isinstance(self.content_type, Unset): + content_type = self.content_type.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "object_key": object_key, + "filename": filename, + "state": state, + "url": url, + } + ) + if content_type is not UNSET: + field_dict["content_type"] = content_type + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + object_key = d.pop("object_key") + + filename = d.pop("filename") + + state = State634Enum(d.pop("state")) + + url = d.pop("url") + + _content_type = d.pop("content_type", UNSET) + content_type: Union[Unset, ContentTypeEnum] + if isinstance(_content_type, Unset): + content_type = UNSET + else: + content_type = ContentTypeEnum(_content_type) + + refined_ad_banner = cls( + uuid=uuid, + object_key=object_key, + filename=filename, + state=state, + url=url, + content_type=content_type, + ) + + refined_ad_banner.additional_properties = d + return refined_ad_banner + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/refined_ad_content.py b/utils/clients/gooyal_advertising_client/models/refined_ad_content.py new file mode 100644 index 0000000..4717a0e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/refined_ad_content.py @@ -0,0 +1,125 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .content_type_enum import ContentTypeEnum +from .state_634_enum import State634Enum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="RefinedAdContent") + + +@_attrs_define +class RefinedAdContent: + """ + Attributes: + uuid (UUID): + object_key (str): + filename (str): + state (State634Enum): * `0` - draft + * `1` - ready_for_check + * `2` - Checking + * `9` - Rejected + * `10` - Modified + * `11` - modification_checking + * `12` - modification_rejected + * `18` - stoped + * `19` - unpublished + * `20` - published + * `100` - deleted + url (str): + content_type (Union[Unset, ContentTypeEnum]): * `1` - image + * `2` - voice + * `3` - video + * `4` - document + """ + + uuid: UUID + object_key: str + filename: str + state: State634Enum + url: str + content_type: Union[Unset, ContentTypeEnum] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + object_key = self.object_key + + filename = self.filename + + state = self.state.value + + url = self.url + + content_type: Union[Unset, int] = UNSET + if not isinstance(self.content_type, Unset): + content_type = self.content_type.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "object_key": object_key, + "filename": filename, + "state": state, + "url": url, + } + ) + if content_type is not UNSET: + field_dict["content_type"] = content_type + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + object_key = d.pop("object_key") + + filename = d.pop("filename") + + state = State634Enum(d.pop("state")) + + url = d.pop("url") + + _content_type = d.pop("content_type", UNSET) + content_type: Union[Unset, ContentTypeEnum] + if isinstance(_content_type, Unset): + content_type = UNSET + else: + content_type = ContentTypeEnum(_content_type) + + refined_ad_content = cls( + uuid=uuid, + object_key=object_key, + filename=filename, + state=state, + url=url, + content_type=content_type, + ) + + refined_ad_content.additional_properties = d + return refined_ad_content + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/rejection_reason_enum.py b/utils/clients/gooyal_advertising_client/models/rejection_reason_enum.py new file mode 100644 index 0000000..96ca254 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/rejection_reason_enum.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class RejectionReasonEnum(str, Enum): + ANTI_SECURITY = "anti_security" + BAD_CONTENT = "bad_content" + OTHERS = "others" + PRIVACY_BREACH = "privacy_breach" + UNETHICAL = "unethical" + VIOLATION_OF_THE_RULES = "violation_of_the_rules" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/report_category_enum.py b/utils/clients/gooyal_advertising_client/models/report_category_enum.py new file mode 100644 index 0000000..28a96a0 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/report_category_enum.py @@ -0,0 +1,8 @@ +from enum import IntEnum + + +class ReportCategoryEnum(IntEnum): + VALUE_100 = 100 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/role_enum.py b/utils/clients/gooyal_advertising_client/models/role_enum.py new file mode 100644 index 0000000..c19ce2f --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/role_enum.py @@ -0,0 +1,9 @@ +from enum import IntEnum + + +class RoleEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/sign_content.py b/utils/clients/gooyal_advertising_client/models/sign_content.py new file mode 100644 index 0000000..ed18f8c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/sign_content.py @@ -0,0 +1,67 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="SignContent") + + +@_attrs_define +class SignContent: + """ + Attributes: + filename (str): + content_type (str): + """ + + filename: str + content_type: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + filename = self.filename + + content_type = self.content_type + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "filename": filename, + "content_type": content_type, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + filename = d.pop("filename") + + content_type = d.pop("content_type") + + sign_content = cls( + filename=filename, + content_type=content_type, + ) + + sign_content.additional_properties = d + return sign_content + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/state_634_enum.py b/utils/clients/gooyal_advertising_client/models/state_634_enum.py new file mode 100644 index 0000000..9e861f5 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/state_634_enum.py @@ -0,0 +1,18 @@ +from enum import IntEnum + + +class State634Enum(IntEnum): + VALUE_0 = 0 + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_9 = 9 + VALUE_10 = 10 + VALUE_11 = 11 + VALUE_12 = 12 + VALUE_18 = 18 + VALUE_19 = 19 + VALUE_20 = 20 + VALUE_100 = 100 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/statistic.py b/utils/clients/gooyal_advertising_client/models/statistic.py new file mode 100644 index 0000000..42c684a --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/statistic.py @@ -0,0 +1,129 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +if TYPE_CHECKING: + from .ad_visit_statistic import AdVisitStatistic + + +T = TypeVar("T", bound="Statistic") + + +@_attrs_define +class Statistic: + """ + Attributes: + total_reward_input (int): + total_visit_count (int): + total_ads_count (int): + monthly_data (list['AdVisitStatistic']): + daily_data (list['AdVisitStatistic']): + hourly_data (list['AdVisitStatistic']): + """ + + total_reward_input: int + total_visit_count: int + total_ads_count: int + monthly_data: list["AdVisitStatistic"] + daily_data: list["AdVisitStatistic"] + hourly_data: list["AdVisitStatistic"] + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + total_reward_input = self.total_reward_input + + total_visit_count = self.total_visit_count + + total_ads_count = self.total_ads_count + + monthly_data = [] + for monthly_data_item_data in self.monthly_data: + monthly_data_item = monthly_data_item_data.to_dict() + monthly_data.append(monthly_data_item) + + daily_data = [] + for daily_data_item_data in self.daily_data: + daily_data_item = daily_data_item_data.to_dict() + daily_data.append(daily_data_item) + + hourly_data = [] + for hourly_data_item_data in self.hourly_data: + hourly_data_item = hourly_data_item_data.to_dict() + hourly_data.append(hourly_data_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "total_reward_input": total_reward_input, + "total_visit_count": total_visit_count, + "total_ads_count": total_ads_count, + "monthly_data": monthly_data, + "daily_data": daily_data, + "hourly_data": hourly_data, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .ad_visit_statistic import AdVisitStatistic + + d = dict(src_dict) + total_reward_input = d.pop("total_reward_input") + + total_visit_count = d.pop("total_visit_count") + + total_ads_count = d.pop("total_ads_count") + + monthly_data = [] + _monthly_data = d.pop("monthly_data") + for monthly_data_item_data in _monthly_data: + monthly_data_item = AdVisitStatistic.from_dict(monthly_data_item_data) + + monthly_data.append(monthly_data_item) + + daily_data = [] + _daily_data = d.pop("daily_data") + for daily_data_item_data in _daily_data: + daily_data_item = AdVisitStatistic.from_dict(daily_data_item_data) + + daily_data.append(daily_data_item) + + hourly_data = [] + _hourly_data = d.pop("hourly_data") + for hourly_data_item_data in _hourly_data: + hourly_data_item = AdVisitStatistic.from_dict(hourly_data_item_data) + + hourly_data.append(hourly_data_item) + + statistic = cls( + total_reward_input=total_reward_input, + total_visit_count=total_visit_count, + total_ads_count=total_ads_count, + monthly_data=monthly_data, + daily_data=daily_data, + hourly_data=hourly_data, + ) + + statistic.additional_properties = d + return statistic + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_bookmarked_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_bookmarked_list_ordering_item.py new file mode 100644 index 0000000..386e962 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_bookmarked_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsBookmarkedListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_clusterized_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_clusterized_list_ordering_item.py new file mode 100644 index 0000000..dd3faa8 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_clusterized_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsClusterizedListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_list_ordering_item.py new file mode 100644 index 0000000..df576b9 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_public_clusterized_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_public_clusterized_list_ordering_item.py new file mode 100644 index 0000000..bef982b --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_public_clusterized_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsPublicClusterizedListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_public_list_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_public_list_list_ordering_item.py new file mode 100644 index 0000000..a7f0268 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_public_list_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsPublicListListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_visited_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_visited_list_ordering_item.py new file mode 100644 index 0000000..d9e7060 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_visited_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsVisitedListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_ads_with_visits_list_ordering_item.py b/utils/clients/gooyal_advertising_client/models/stores_ads_with_visits_list_ordering_item.py new file mode 100644 index 0000000..e35e634 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_ads_with_visits_list_ordering_item.py @@ -0,0 +1,13 @@ +from enum import Enum + + +class StoresAdsWithVisitsListOrderingItem(str, Enum): + DISTANCE = "distance" + REWARD_AMOUNT = "reward_amount" + UPDATED_AT = "updated_at" + VALUE_0 = "-distance" + VALUE_1 = "-reward_amount" + VALUE_2 = "-updated_at" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/stores_statistic_retrieve_accept_language.py b/utils/clients/gooyal_advertising_client/models/stores_statistic_retrieve_accept_language.py new file mode 100644 index 0000000..1064c75 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/stores_statistic_retrieve_accept_language.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class StoresStatisticRetrieveAcceptLanguage(str, Enum): + AR = "ar" + EN = "en" + FA = "fa" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/suggestion.py b/utils/clients/gooyal_advertising_client/models/suggestion.py new file mode 100644 index 0000000..6a7ec0c --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/suggestion.py @@ -0,0 +1,67 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="Suggestion") + + +@_attrs_define +class Suggestion: + """ + Attributes: + concept (str): + content (str): + """ + + concept: str + content: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + concept = self.concept + + content = self.content + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "concept": concept, + "content": content, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + concept = d.pop("concept") + + content = d.pop("content") + + suggestion = cls( + concept=concept, + content=content, + ) + + suggestion.additional_properties = d + return suggestion + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/tag.py b/utils/clients/gooyal_advertising_client/models/tag.py new file mode 100644 index 0000000..2f7cda1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/tag.py @@ -0,0 +1,67 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +T = TypeVar("T", bound="Tag") + + +@_attrs_define +class Tag: + """ + Attributes: + name (str): + slug (str): + """ + + name: str + slug: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + name = self.name + + slug = self.slug + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "name": name, + "slug": slug, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + name = d.pop("name") + + slug = d.pop("slug") + + tag = cls( + name=name, + slug=slug, + ) + + tag.additional_properties = d + return tag + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ticket.py b/utils/clients/gooyal_advertising_client/models/ticket.py new file mode 100644 index 0000000..af85fa1 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ticket.py @@ -0,0 +1,126 @@ +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from .ticket_state_enum import TicketStateEnum +from ..types import UNSET, Unset + +T = TypeVar("T", bound="Ticket") + + +@_attrs_define +class Ticket: + """ + Attributes: + uuid (UUID): + user (UUID): + title (str): + state (TicketStateEnum): * `1` - INIT + * `10` - CLOSED + created_at (datetime.datetime): + updated_at (datetime.datetime): + description (Union[None, Unset, str]): + """ + + uuid: UUID + user: UUID + title: str + state: TicketStateEnum + created_at: datetime.datetime + updated_at: datetime.datetime + description: Union[None, Unset, str] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + uuid = str(self.uuid) + + user = str(self.user) + + title = self.title + + state = self.state.value + + created_at = self.created_at.isoformat() + + updated_at = self.updated_at.isoformat() + + description: Union[None, Unset, str] + if isinstance(self.description, Unset): + description = UNSET + else: + description = self.description + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "user": user, + "title": title, + "state": state, + "created_at": created_at, + "updated_at": updated_at, + } + ) + if description is not UNSET: + field_dict["description"] = description + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + user = UUID(d.pop("user")) + + title = d.pop("title") + + state = TicketStateEnum(d.pop("state")) + + created_at = isoparse(d.pop("created_at")) + + updated_at = isoparse(d.pop("updated_at")) + + def _parse_description(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + description = _parse_description(d.pop("description", UNSET)) + + ticket = cls( + uuid=uuid, + user=user, + title=title, + state=state, + created_at=created_at, + updated_at=updated_at, + description=description, + ) + + ticket.additional_properties = d + return ticket + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/ticket_state_enum.py b/utils/clients/gooyal_advertising_client/models/ticket_state_enum.py new file mode 100644 index 0000000..8b85067 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/ticket_state_enum.py @@ -0,0 +1,9 @@ +from enum import IntEnum + + +class TicketStateEnum(IntEnum): + VALUE_1 = 1 + VALUE_10 = 10 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/transportation_cost_enum.py b/utils/clients/gooyal_advertising_client/models/transportation_cost_enum.py new file mode 100644 index 0000000..a0970ef --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/transportation_cost_enum.py @@ -0,0 +1,10 @@ +from enum import IntEnum + + +class TransportationCostEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/type_0d9_enum.py b/utils/clients/gooyal_advertising_client/models/type_0d9_enum.py new file mode 100644 index 0000000..356b8c8 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/type_0d9_enum.py @@ -0,0 +1,11 @@ +from enum import IntEnum + + +class Type0D9Enum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_99 = 99 + VALUE_100 = 100 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/value_type_enum.py b/utils/clients/gooyal_advertising_client/models/value_type_enum.py new file mode 100644 index 0000000..136fbdc --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/value_type_enum.py @@ -0,0 +1,14 @@ +from enum import Enum + + +class ValueTypeEnum(str, Enum): + BOOLEAN = "BOOLEAN" + DATE = "DATE" + DATETIME = "DATETIME" + FLOAT = "FLOAT" + INT = "INT" + JSON = "JSON" + STRING = "STRING" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/visit.py b/utils/clients/gooyal_advertising_client/models/visit.py new file mode 100644 index 0000000..dcdfce6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit.py @@ -0,0 +1,256 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .report_category_enum import ReportCategoryEnum +from .visit_state_enum import VisitStateEnum +from ..types import UNSET, Unset + +if TYPE_CHECKING: + from .visit_location_type_0 import VisitLocationType0 + + +T = TypeVar("T", bound="Visit") + + +@_attrs_define +class Visit: + """ + Attributes: + uuid (UUID): + ad (UUID): + state (VisitStateEnum): * `0` - init + * `1` - Start + * `2` - done + * `3` - Timeout + * `4` - CACHED_BACK + reward_amount (int): + opportunity_until (str): + display_time (str): + location (Union['VisitLocationType0', None, Unset]): + reaction (Union[None, Unset, str]): + favorite (Union[None, Unset, bool]): + bookmark (Union[None, Unset, bool]): + report_reason (Union[None, Unset, str]): + report_category (Union[None, ReportCategoryEnum, Unset]): + """ + + uuid: UUID + ad: UUID + state: VisitStateEnum + reward_amount: int + opportunity_until: str + display_time: str + location: Union["VisitLocationType0", None, Unset] = UNSET + reaction: Union[None, Unset, str] = UNSET + favorite: Union[None, Unset, bool] = UNSET + bookmark: Union[None, Unset, bool] = UNSET + report_reason: Union[None, Unset, str] = UNSET + report_category: Union[None, ReportCategoryEnum, Unset] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .visit_location_type_0 import VisitLocationType0 + + uuid = str(self.uuid) + + ad = str(self.ad) + + state = self.state.value + + reward_amount = self.reward_amount + + opportunity_until = self.opportunity_until + + display_time = self.display_time + + location: Union[None, Unset, dict[str, Any]] + if isinstance(self.location, Unset): + location = UNSET + elif isinstance(self.location, VisitLocationType0): + location = self.location.to_dict() + else: + location = self.location + + reaction: Union[None, Unset, str] + if isinstance(self.reaction, Unset): + reaction = UNSET + else: + reaction = self.reaction + + favorite: Union[None, Unset, bool] + if isinstance(self.favorite, Unset): + favorite = UNSET + else: + favorite = self.favorite + + bookmark: Union[None, Unset, bool] + if isinstance(self.bookmark, Unset): + bookmark = UNSET + else: + bookmark = self.bookmark + + report_reason: Union[None, Unset, str] + if isinstance(self.report_reason, Unset): + report_reason = UNSET + else: + report_reason = self.report_reason + + report_category: Union[None, Unset, int] + if isinstance(self.report_category, Unset): + report_category = UNSET + elif isinstance(self.report_category, ReportCategoryEnum): + report_category = self.report_category.value + else: + report_category = self.report_category + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "ad": ad, + "state": state, + "reward_amount": reward_amount, + "opportunity_until": opportunity_until, + "display_time": display_time, + } + ) + if location is not UNSET: + field_dict["location"] = location + if reaction is not UNSET: + field_dict["reaction"] = reaction + if favorite is not UNSET: + field_dict["favorite"] = favorite + if bookmark is not UNSET: + field_dict["bookmark"] = bookmark + if report_reason is not UNSET: + field_dict["report_reason"] = report_reason + if report_category is not UNSET: + field_dict["report_category"] = report_category + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .visit_location_type_0 import VisitLocationType0 + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + ad = UUID(d.pop("ad")) + + state = VisitStateEnum(d.pop("state")) + + reward_amount = d.pop("reward_amount") + + opportunity_until = d.pop("opportunity_until") + + display_time = d.pop("display_time") + + def _parse_location(data: object) -> Union["VisitLocationType0", None, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, dict): + raise TypeError() + location_type_0 = VisitLocationType0.from_dict(data) + + return location_type_0 + except: # noqa: E722 + pass + return cast(Union["VisitLocationType0", None, Unset], data) + + location = _parse_location(d.pop("location", UNSET)) + + def _parse_reaction(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + reaction = _parse_reaction(d.pop("reaction", UNSET)) + + def _parse_favorite(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + favorite = _parse_favorite(d.pop("favorite", UNSET)) + + def _parse_bookmark(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + bookmark = _parse_bookmark(d.pop("bookmark", UNSET)) + + def _parse_report_reason(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + report_reason = _parse_report_reason(d.pop("report_reason", UNSET)) + + def _parse_report_category(data: object) -> Union[None, ReportCategoryEnum, Unset]: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, int): + raise TypeError() + report_category_type_0 = ReportCategoryEnum(data) + + return report_category_type_0 + except: # noqa: E722 + pass + return cast(Union[None, ReportCategoryEnum, Unset], data) + + report_category = _parse_report_category(d.pop("report_category", UNSET)) + + visit = cls( + uuid=uuid, + ad=ad, + state=state, + reward_amount=reward_amount, + opportunity_until=opportunity_until, + display_time=display_time, + location=location, + reaction=reaction, + favorite=favorite, + bookmark=bookmark, + report_reason=report_reason, + report_category=report_category, + ) + + visit.additional_properties = d + return visit + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/visit_interaction.py b/utils/clients/gooyal_advertising_client/models/visit_interaction.py new file mode 100644 index 0000000..bea5ca6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit_interaction.py @@ -0,0 +1,64 @@ +from collections.abc import Mapping +from typing import Any, TypeVar + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .visit_interaction_type_enum import VisitInteractionTypeEnum + +T = TypeVar("T", bound="VisitInteraction") + + +@_attrs_define +class VisitInteraction: + """ + Attributes: + type_ (VisitInteractionTypeEnum): * `link_click` - link_click + * `phone_number_visit` - phone_number_visit + * `direction_select` - direction_select + * `share` - share + """ + + type_: VisitInteractionTypeEnum + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_ = self.type_.value + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "type": type_, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + type_ = VisitInteractionTypeEnum(d.pop("type")) + + visit_interaction = cls( + type_=type_, + ) + + visit_interaction.additional_properties = d + return visit_interaction + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/visit_interaction_type_enum.py b/utils/clients/gooyal_advertising_client/models/visit_interaction_type_enum.py new file mode 100644 index 0000000..533f062 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit_interaction_type_enum.py @@ -0,0 +1,11 @@ +from enum import Enum + + +class VisitInteractionTypeEnum(str, Enum): + DIRECTION_SELECT = "direction_select" + LINK_CLICK = "link_click" + PHONE_NUMBER_VISIT = "phone_number_visit" + SHARE = "share" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/visit_location_type_0.py b/utils/clients/gooyal_advertising_client/models/visit_location_type_0.py new file mode 100644 index 0000000..ca532cf --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit_location_type_0.py @@ -0,0 +1,78 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .visit_location_type_0_type import VisitLocationType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="VisitLocationType0") + + +@_attrs_define +class VisitLocationType0: + """ + Attributes: + type_ (Union[Unset, VisitLocationType0Type]): + coordinates (Union[Unset, list[float]]): Example: [12.9721, 77.5933]. + """ + + type_: Union[Unset, VisitLocationType0Type] = UNSET + coordinates: Union[Unset, list[float]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[float]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = self.coordinates + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, VisitLocationType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = VisitLocationType0Type(_type_) + + coordinates = cast(list[float], d.pop("coordinates", UNSET)) + + visit_location_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + visit_location_type_0.additional_properties = d + return visit_location_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/visit_location_type_0_type.py b/utils/clients/gooyal_advertising_client/models/visit_location_type_0_type.py new file mode 100644 index 0000000..c8a1ff6 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit_location_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class VisitLocationType0Type(str, Enum): + POINT = "Point" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/visit_reaction.py b/utils/clients/gooyal_advertising_client/models/visit_reaction.py new file mode 100644 index 0000000..dcf7130 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit_reaction.py @@ -0,0 +1,122 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +T = TypeVar("T", bound="VisitReaction") + + +@_attrs_define +class VisitReaction: + """ + Attributes: + visit_uuid (UUID): + reaction (Union[None, Unset, str]): + favorite (Union[None, Unset, bool]): + bookmark (Union[None, Unset, bool]): + """ + + visit_uuid: UUID + reaction: Union[None, Unset, str] = UNSET + favorite: Union[None, Unset, bool] = UNSET + bookmark: Union[None, Unset, bool] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + visit_uuid = str(self.visit_uuid) + + reaction: Union[None, Unset, str] + if isinstance(self.reaction, Unset): + reaction = UNSET + else: + reaction = self.reaction + + favorite: Union[None, Unset, bool] + if isinstance(self.favorite, Unset): + favorite = UNSET + else: + favorite = self.favorite + + bookmark: Union[None, Unset, bool] + if isinstance(self.bookmark, Unset): + bookmark = UNSET + else: + bookmark = self.bookmark + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "visit_uuid": visit_uuid, + } + ) + if reaction is not UNSET: + field_dict["reaction"] = reaction + if favorite is not UNSET: + field_dict["favorite"] = favorite + if bookmark is not UNSET: + field_dict["bookmark"] = bookmark + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + visit_uuid = UUID(d.pop("visit_uuid")) + + def _parse_reaction(data: object) -> Union[None, Unset, str]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, str], data) + + reaction = _parse_reaction(d.pop("reaction", UNSET)) + + def _parse_favorite(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + favorite = _parse_favorite(d.pop("favorite", UNSET)) + + def _parse_bookmark(data: object) -> Union[None, Unset, bool]: + if data is None: + return data + if isinstance(data, Unset): + return data + return cast(Union[None, Unset, bool], data) + + bookmark = _parse_bookmark(d.pop("bookmark", UNSET)) + + visit_reaction = cls( + visit_uuid=visit_uuid, + reaction=reaction, + favorite=favorite, + bookmark=bookmark, + ) + + visit_reaction.additional_properties = d + return visit_reaction + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/visit_state_enum.py b/utils/clients/gooyal_advertising_client/models/visit_state_enum.py new file mode 100644 index 0000000..12d091e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/visit_state_enum.py @@ -0,0 +1,12 @@ +from enum import IntEnum + + +class VisitStateEnum(IntEnum): + VALUE_0 = 0 + VALUE_1 = 1 + VALUE_2 = 2 + VALUE_3 = 3 + VALUE_4 = 4 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/zone.py b/utils/clients/gooyal_advertising_client/models/zone.py new file mode 100644 index 0000000..fa7a06e --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/zone.py @@ -0,0 +1,146 @@ +from collections.abc import Mapping +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .zone_state_enum import ZoneStateEnum +from .zone_type_enum import ZoneTypeEnum + +if TYPE_CHECKING: + from .zone_area_type_0 import ZoneAreaType0 + + +T = TypeVar("T", bound="Zone") + + +@_attrs_define +class Zone: + """ + Attributes: + uuid (UUID): + name (str): + type_ (ZoneTypeEnum): * `1` - manual + * `2` - neighborhood partition + area (Union['ZoneAreaType0', None]): + state (ZoneStateEnum): * `1` - not_active + * `10` - active + total_score (int): + activation_score (str): + location (Any): + """ + + uuid: UUID + name: str + type_: ZoneTypeEnum + area: Union["ZoneAreaType0", None] + state: ZoneStateEnum + total_score: int + activation_score: str + location: Any + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + from .zone_area_type_0 import ZoneAreaType0 + + uuid = str(self.uuid) + + name = self.name + + type_ = self.type_.value + + area: Union[None, dict[str, Any]] + if isinstance(self.area, ZoneAreaType0): + area = self.area.to_dict() + else: + area = self.area + + state = self.state.value + + total_score = self.total_score + + activation_score = self.activation_score + + location = self.location + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "uuid": uuid, + "name": name, + "type": type_, + "area": area, + "state": state, + "total_score": total_score, + "activation_score": activation_score, + "location": location, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + from .zone_area_type_0 import ZoneAreaType0 + + d = dict(src_dict) + uuid = UUID(d.pop("uuid")) + + name = d.pop("name") + + type_ = ZoneTypeEnum(d.pop("type")) + + def _parse_area(data: object) -> Union["ZoneAreaType0", None]: + if data is None: + return data + try: + if not isinstance(data, dict): + raise TypeError() + area_type_0 = ZoneAreaType0.from_dict(data) + + return area_type_0 + except: # noqa: E722 + pass + return cast(Union["ZoneAreaType0", None], data) + + area = _parse_area(d.pop("area")) + + state = ZoneStateEnum(d.pop("state")) + + total_score = d.pop("total_score") + + activation_score = d.pop("activation_score") + + location = d.pop("location") + + zone = cls( + uuid=uuid, + name=name, + type_=type_, + area=area, + state=state, + total_score=total_score, + activation_score=activation_score, + location=location, + ) + + zone.additional_properties = d + return zone + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/zone_area_type_0.py b/utils/clients/gooyal_advertising_client/models/zone_area_type_0.py new file mode 100644 index 0000000..fce9183 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/zone_area_type_0.py @@ -0,0 +1,105 @@ +from collections.abc import Mapping +from typing import Any, TypeVar, Union, cast + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from .zone_area_type_0_type import ZoneAreaType0Type +from ..types import UNSET, Unset + +T = TypeVar("T", bound="ZoneAreaType0") + + +@_attrs_define +class ZoneAreaType0: + """ + Attributes: + type_ (Union[Unset, ZoneAreaType0Type]): + coordinates (Union[Unset, list[list[list[list[float]]]]]): + """ + + type_: Union[Unset, ZoneAreaType0Type] = UNSET + coordinates: Union[Unset, list[list[list[list[float]]]]] = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + type_: Union[Unset, str] = UNSET + if not isinstance(self.type_, Unset): + type_ = self.type_.value + + coordinates: Union[Unset, list[list[list[list[float]]]]] = UNSET + if not isinstance(self.coordinates, Unset): + coordinates = [] + for coordinates_item_data in self.coordinates: + coordinates_item = [] + for coordinates_item_item_data in coordinates_item_data: + coordinates_item_item = [] + for coordinates_item_item_item_data in coordinates_item_item_data: + coordinates_item_item_item = coordinates_item_item_item_data + + coordinates_item_item.append(coordinates_item_item_item) + + coordinates_item.append(coordinates_item_item) + + coordinates.append(coordinates_item) + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({}) + if type_ is not UNSET: + field_dict["type"] = type_ + if coordinates is not UNSET: + field_dict["coordinates"] = coordinates + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + _type_ = d.pop("type", UNSET) + type_: Union[Unset, ZoneAreaType0Type] + if isinstance(_type_, Unset): + type_ = UNSET + else: + type_ = ZoneAreaType0Type(_type_) + + coordinates = [] + _coordinates = d.pop("coordinates", UNSET) + for coordinates_item_data in _coordinates or []: + coordinates_item = [] + _coordinates_item = coordinates_item_data + for coordinates_item_item_data in _coordinates_item: + coordinates_item_item = [] + _coordinates_item_item = coordinates_item_item_data + for coordinates_item_item_item_data in _coordinates_item_item: + coordinates_item_item_item = cast(list[float], coordinates_item_item_item_data) + + coordinates_item_item.append(coordinates_item_item_item) + + coordinates_item.append(coordinates_item_item) + + coordinates.append(coordinates_item) + + zone_area_type_0 = cls( + type_=type_, + coordinates=coordinates, + ) + + zone_area_type_0.additional_properties = d + return zone_area_type_0 + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/utils/clients/gooyal_advertising_client/models/zone_area_type_0_type.py b/utils/clients/gooyal_advertising_client/models/zone_area_type_0_type.py new file mode 100644 index 0000000..9a128c7 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/zone_area_type_0_type.py @@ -0,0 +1,8 @@ +from enum import Enum + + +class ZoneAreaType0Type(str, Enum): + MULTIPOLYGON = "MultiPolygon" + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/zone_state_enum.py b/utils/clients/gooyal_advertising_client/models/zone_state_enum.py new file mode 100644 index 0000000..1724b98 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/zone_state_enum.py @@ -0,0 +1,9 @@ +from enum import IntEnum + + +class ZoneStateEnum(IntEnum): + VALUE_1 = 1 + VALUE_10 = 10 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/models/zone_type_enum.py b/utils/clients/gooyal_advertising_client/models/zone_type_enum.py new file mode 100644 index 0000000..0a09ded --- /dev/null +++ b/utils/clients/gooyal_advertising_client/models/zone_type_enum.py @@ -0,0 +1,9 @@ +from enum import IntEnum + + +class ZoneTypeEnum(IntEnum): + VALUE_1 = 1 + VALUE_2 = 2 + + def __str__(self) -> str: + return str(self.value) diff --git a/utils/clients/gooyal_advertising_client/py.typed b/utils/clients/gooyal_advertising_client/py.typed new file mode 100644 index 0000000..1aad327 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561 \ No newline at end of file diff --git a/utils/clients/gooyal_advertising_client/types.py b/utils/clients/gooyal_advertising_client/types.py new file mode 100644 index 0000000..1b96ca4 --- /dev/null +++ b/utils/clients/gooyal_advertising_client/types.py @@ -0,0 +1,54 @@ +"""Contains some shared types for properties""" + +from collections.abc import Mapping, MutableMapping +from http import HTTPStatus +from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union + +from attrs import define + + +class Unset: + def __bool__(self) -> Literal[False]: + return False + + +UNSET: Unset = Unset() + +# The types that `httpx.Client(files=)` can accept, copied from that library. +FileContent = Union[IO[bytes], bytes, str] +FileTypes = Union[ + # (filename, file (or bytes), content_type) + tuple[Optional[str], FileContent, Optional[str]], + # (filename, file (or bytes), content_type, headers) + tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], +] +RequestFiles = list[tuple[str, FileTypes]] + + +@define +class File: + """Contains information for file uploads""" + + payload: BinaryIO + file_name: Optional[str] = None + mime_type: Optional[str] = None + + def to_tuple(self) -> FileTypes: + """Return a tuple representation that httpx will accept for multipart/form-data""" + return self.file_name, self.payload, self.mime_type + + +T = TypeVar("T") + + +@define +class Response(Generic[T]): + """A response from an endpoint""" + + status_code: HTTPStatus + content: bytes + headers: MutableMapping[str, str] + parsed: Optional[T] + + +__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]