From fb8bbc74cda27ec1cb22ed3d6afe1fe5160e9356 Mon Sep 17 00:00:00 2001 From: sbansla <104902068+sbansla@users.noreply.github.com> Date: Fri, 4 Oct 2024 17:50:26 +0530 Subject: [PATCH] chore: Autogenerating code and RC Release preparation (#1092) * chore: autogenerating code from open api spec and RC Release preparation --- CHANGELOG.md | 9 + README.md | 24 ++ UPGRADE.md | 11 + .../api/account_provisioning/v3/__init__.py | 1 + .../v3/authenticate_account.py | 52 +++++ .../account_provisioning/v3/create_account.py | 65 ++++++ .../account_provisioning/v3/delete_account.py | 52 +++++ .../v3/get_account_state.py | 52 +++++ .../account_provisioning/v3/list_account.py | 53 +++++ .../v3/list_account_offering.py | 52 +++++ .../account_provisioning/v3/list_offering.py | 48 ++++ .../v3/models/__init__.py | 80 +++++++ .../v3/models/account_list.py | 33 +++ .../v3/models/account_provisioning_account.py | 25 +++ .../models/account_provisioning_account_id.py | 22 ++ .../v3/models/account_provisioning_catalog.py | 23 ++ .../account_provisioning_offering_list.py | 25 +++ .../account_provisioning_offering_v1.py | 38 ++++ .../models/account_provisioning_pagination.py | 25 +++ .../v3/models/account_provisioning_profile.py | 53 +++++ .../models/account_provisioning_state_read.py | 23 ++ .../account_provisioning_state_write.py | 23 ++ .../v3/models/catalog_entry.py | 38 ++++ .../v3/models/catalog_entry_entitlements.py | 41 ++++ .../v3/models/create_account_params.py | 38 ++++ .../v3/models/error_response.py | 37 +++ .../v3/models/offerings_to_add.py | 25 +++ .../account_provisioning/v3/models/state.py | 10 + .../account_provisioning/v3/models/state1.py | 7 + .../account_provisioning/v3/models/type.py | 7 + .../v3/update_account_offering.py | 60 +++++ .../v3/update_account_state.py | 62 +++++ sendgrid/rest/api/alerts/v3/__init__.py | 1 + sendgrid/rest/api/alerts/v3/create_alert.py | 63 ++++++ sendgrid/rest/api/alerts/v3/delete_alert.py | 62 +++++ sendgrid/rest/api/alerts/v3/get_alert.py | 62 +++++ sendgrid/rest/api/alerts/v3/list_alert.py | 58 +++++ .../rest/api/alerts/v3/models/__init__.py | 50 +++++ .../v3/models/create_alert201_response.py | 53 +++++ .../alerts/v3/models/create_alert_request.py | 42 ++++ .../api/alerts/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../alerts/v3/models/get_alert200_response.py | 54 +++++ .../v3/models/list_alert200_response_inner.py | 54 +++++ sendgrid/rest/api/alerts/v3/models/type.py | 7 + sendgrid/rest/api/alerts/v3/models/type1.py | 7 + sendgrid/rest/api/alerts/v3/models/type2.py | 7 + sendgrid/rest/api/alerts/v3/models/type3.py | 7 + .../v3/models/update_alert200_response.py | 54 +++++ .../alerts/v3/models/update_alert_request.py | 37 +++ sendgrid/rest/api/alerts/v3/update_alert.py | 67 ++++++ sendgrid/rest/api/api_keys/v3/__init__.py | 1 + .../rest/api/api_keys/v3/create_api_key.py | 65 ++++++ .../rest/api/api_keys/v3/delete_api_key.py | 62 +++++ sendgrid/rest/api/api_keys/v3/get_api_key.py | 62 +++++ sendgrid/rest/api/api_keys/v3/list_api_key.py | 59 +++++ .../rest/api/api_keys/v3/models/__init__.py | 54 +++++ .../api_keys/v3/models/api_key_response.py | 25 +++ .../v3/models/api_key_scopes_response.py | 37 +++ .../v3/models/create_api_key201_response.py | 41 ++++ .../v3/models/create_api_key_request.py | 25 +++ .../api/api_keys/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/get_api_key200_response.py | 25 +++ .../v3/models/list_api_key200_response.py | 23 ++ .../v3/models/update_api_key_name_request.py | 22 ++ .../v3/models/update_api_key_request.py | 25 +++ .../rest/api/api_keys/v3/update_api_key.py | 69 ++++++ .../api/api_keys/v3/update_api_key_name.py | 69 ++++++ .../api/domain_authentication/v3/__init__.py | 1 + .../v3/add_ip_to_authenticated_domain.py | 71 ++++++ .../v3/associate_subuser_with_domain.py | 63 ++++++ .../associate_subuser_with_domain_multiple.py | 63 ++++++ .../v3/authenticate_domain.py | 65 ++++++ .../v3/delete_authenticated_domain.py | 62 +++++ .../v3/delete_ip_from_authenticated_domain.py | 64 ++++++ ...ssociate_authenticated_domain_from_user.py | 52 +++++ .../v3/disassociate_subuser_from_domain.py | 56 +++++ .../v3/email_dns_record.py | 57 +++++ .../v3/get_authenticated_domain.py | 62 +++++ ...list_all_authenticated_domain_with_user.py | 50 +++++ .../v3/list_authenticated_domain.py | 63 ++++++ .../v3/list_authenticated_domain_with_user.py | 50 +++++ .../v3/list_default_authenticated_domain.py | 59 +++++ .../v3/models/__init__.py | 118 ++++++++++ .../add_ip_to_authenticated_domain_request.py | 22 ++ .../associate_subuser_with_domain_request.py | 22 ++ .../v3/models/authenticate_domain_request.py | 61 +++++ .../v3/models/authenticated_domain.py | 76 +++++++ .../v3/models/authenticated_domain_spf.py | 76 +++++++ .../v3/models/authenticated_domain_spf_dns.py | 53 +++++ .../authenticated_domain_spf_dns_dkim.py | 41 ++++ ...authenticated_domain_spf_dns_domain_spf.py | 41 ++++ ...uthenticated_domain_spf_dns_mail_server.py | 41 ++++ ...henticated_domain_spf_dns_subdomain_spf.py | 41 ++++ .../v3/models/email_dns_record400_response.py | 25 +++ .../email_dns_record400_response_errors.py | 25 +++ .../v3/models/email_dns_record_request.py | 41 ++++ ...ated_domain_with_user200_response_inner.py | 76 +++++++ ..._domain_with_user200_response_inner_dns.py | 49 ++++ ...n_with_user200_response_inner_dns_dkim1.py | 41 ++++ ...h_user200_response_inner_dns_mail_cname.py | 41 ++++ .../update_authenticated_domain_request.py | 30 +++ ...lidate_authenticated_domain200_response.py | 42 ++++ ...d_domain200_response_validation_results.py | 58 +++++ ...in200_response_validation_results_dkim1.py | 25 +++ ..._response_validation_results_mail_cname.py | 25 +++ ...main200_response_validation_results_spf.py | 25 +++ ...lidate_authenticated_domain500_response.py | 30 +++ ...ticated_domain500_response_errors_inner.py | 24 ++ .../v3/update_authenticated_domain.py | 71 ++++++ .../v3/validate_authenticated_domain.py | 62 +++++ .../rest/api/email_activity/v3/__init__.py | 1 + .../api/email_activity/v3/download_csv.py | 52 +++++ .../rest/api/email_activity/v3/get_message.py | 52 +++++ .../api/email_activity/v3/list_message.py | 53 +++++ .../api/email_activity/v3/models/__init__.py | 84 +++++++ .../email_activity/v3/models/abbv_message.py | 58 +++++ .../email_activity/v3/models/bounce_type.py | 7 + .../email_activity/v3/models/bounce_type1.py | 7 + .../v3/models/download_csv200_response.py | 28 +++ .../email_activity_response_base_props.py | 46 ++++ .../api/email_activity/v3/models/event.py | 59 +++++ .../email_activity/v3/models/event_name.py | 16 ++ .../email_activity/v3/models/event_name1.py | 16 ++ .../v3/models/get_message404_response.py | 25 +++ .../get_message404_response_errors_inner.py | 25 +++ .../v3/models/list_message200_response.py | 23 ++ .../v3/models/list_message400_response.py | 27 +++ .../list_message400_response_errors_inner.py | 22 ++ .../v3/models/list_message429_response.py | 27 +++ .../list_message429_response_errors_inner.py | 22 ++ .../api/email_activity/v3/models/message.py | 88 ++++++++ .../v3/models/outbound_ip_type.py | 7 + .../v3/models/outbound_ip_type1.py | 7 + .../v3/models/request_csv202_response.py | 26 +++ .../api/email_activity/v3/models/status.py | 8 + .../api/email_activity/v3/models/status1.py | 8 + .../api/email_activity/v3/models/status2.py | 6 + .../api/email_activity/v3/models/status3.py | 8 + .../rest/api/email_activity/v3/request_csv.py | 52 +++++ .../rest/api/email_validation/v3/__init__.py | 1 + .../v3/get_email_job_for_verification.py | 52 +++++ .../v3/get_validations_email_jobs.py | 48 ++++ .../v3/list_email_job_for_verification.py | 59 +++++ .../email_validation/v3/models/__init__.py | 92 ++++++++ .../v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../email_validation/v3/models/file_type.py | 7 + .../get_validations_email_jobs200_response.py | 28 +++ ...ons_email_jobs200_response_result_inner.py | 42 ++++ ...lidations_email_jobs_job_id200_response.py | 27 +++ ...ns_email_jobs_job_id200_response_result.py | 63 ++++++ ..._job_id200_response_result_errors_inner.py | 24 ++ ...list_email_job_for_verification_request.py | 23 ++ .../put_validations_email_jobs200_response.py | 42 ++++ ...l_jobs200_response_upload_headers_inner.py | 25 +++ .../api/email_validation/v3/models/status.py | 11 + .../api/email_validation/v3/models/status1.py | 11 + .../v3/models/validate_email200_response.py | 25 +++ .../validate_email200_response_result.py | 65 ++++++ ...alidate_email200_response_result_checks.py | 46 ++++ ...il200_response_result_checks_additional.py | 33 +++ ..._email200_response_result_checks_domain.py | 39 ++++ ...il200_response_result_checks_local_part.py | 26 +++ .../v3/models/validate_email_request.py | 25 +++ .../api/email_validation/v3/models/verdict.py | 8 + .../api/email_validation/v3/validate_email.py | 57 +++++ sendgrid/rest/api/enforced_tls/v3/__init__.py | 1 + .../v3/list_enforced_tls_setting.py | 58 +++++ .../api/enforced_tls/v3/models/__init__.py | 30 +++ .../models/enforced_tls_request_response.py | 38 ++++ .../enforced_tls/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../api/enforced_tls/v3/models/version.py | 12 + .../v3/update_enforced_tls_setting.py | 65 ++++++ sendgrid/rest/api/integrations/v3/__init__.py | 1 + .../api/integrations/v3/add_integration.py | 54 +++++ .../api/integrations/v3/delete_integration.py | 53 +++++ .../integrations/v3/find_integration_by_id.py | 52 +++++ .../v3/get_integrations_by_user.py | 48 ++++ .../api/integrations/v3/models/__init__.py | 114 ++++++++++ .../v3/models/add_integration400_response.py | 23 ++ .../models/delete_integration400_response.py | 25 +++ .../models/delete_integration404_response.py | 25 +++ .../api/integrations/v3/models/destination.py | 6 + .../integrations/v3/models/destination1.py | 6 + .../integrations/v3/models/destination2.py | 6 + .../integrations/v3/models/destination3.py | 6 + .../v3/models/destination_region.py | 7 + .../v3/models/destination_region1.py | 7 + .../v3/models/destination_region2.py | 7 + .../api/integrations/v3/models/forbidden.py | 22 ++ .../get_integrations_by_user200_response.py | 23 ++ .../get_integrations_by_user403_response.py | 23 ++ .../get_integrations_by_user500_response.py | 23 ++ .../rest/api/integrations/v3/models/id.py | 22 ++ .../api/integrations/v3/models/integration.py | 56 +++++ .../v3/models/integration_filters.py | 23 ++ .../v3/models/integration_input.py | 48 ++++ .../v3/models/integration_input_filters.py | 23 ++ .../v3/models/integration_input_properties.py | 36 +++ .../v3/models/integration_not_found.py | 22 ++ .../v3/models/integration_patch.py | 48 ++++ .../v3/models/integration_patch_filters.py | 23 ++ .../v3/models/integration_patch_properties.py | 36 +++ .../v3/models/integration_properties.py | 36 +++ .../integrations/v3/models/internal_error.py | 22 ++ .../v3/models/invalid_delete_request.py | 28 +++ .../integrations/v3/models/invalid_request.py | 25 +++ .../rest/api/integrations/v3/models/items.py | 17 ++ .../rest/api/integrations/v3/models/items1.py | 17 ++ .../rest/api/integrations/v3/models/items2.py | 17 ++ .../api/integrations/v3/update_integration.py | 58 +++++ .../api/ip_access_management/v3/__init__.py | 1 + .../v3/add_ip_to_allow_list.py | 65 ++++++ .../v3/delete_allowed_ip.py | 62 +++++ .../v3/delete_allowed_ips.py | 65 ++++++ .../ip_access_management/v3/get_allowed_ip.py | 62 +++++ .../v3/list_access_activity.py | 59 +++++ .../v3/list_allowed_ip.py | 58 +++++ .../v3/models/__init__.py | 54 +++++ .../v3/models/add_ip_to_allow_list_request.py | 25 +++ .../add_ip_to_allow_list_request_ips_inner.py | 22 ++ .../v3/models/delete_allowed_ips_request.py | 22 ++ .../v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/ip_access_management2xx.py | 25 +++ .../ip_access_management2xx_result_inner.py | 41 ++++ .../list_access_activity200_response.py | 27 +++ ...ccess_activity200_response_result_inner.py | 49 ++++ .../api/ip_address_management/v3/__init__.py | 1 + .../api/ip_address_management/v3/add_ip.py | 57 +++++ .../v3/add_ips_to_ip_pool.py | 61 +++++ .../v3/add_sub_users_to_ip.py | 61 +++++ .../v3/create_ip_pool.py | 57 +++++ .../v3/delete_ip_pool.py | 52 +++++ .../v3/delete_ips_from_ip_pool.py | 61 +++++ .../v3/delete_sub_users_from_ip.py | 61 +++++ .../api/ip_address_management/v3/get_ip.py | 52 +++++ .../ip_address_management/v3/get_ip_pool.py | 52 +++++ .../api/ip_address_management/v3/list_ip.py | 64 ++++++ .../v3/list_ip_assigned_to_ip_pool.py | 54 +++++ .../ip_address_management/v3/list_ip_pool.py | 57 +++++ .../v3/list_sub_user_assigned_to_ip.py | 53 +++++ .../v3/models/__init__.py | 180 +++++++++++++++ .../v3/models/add_ip201_response.py | 46 ++++ .../v3/models/add_ip_request.py | 46 ++++ .../models/add_ips_to_ip_pool200_response.py | 35 +++ .../v3/models/add_ips_to_ip_pool_request.py | 22 ++ .../models/add_sub_users_to_ip200_response.py | 25 +++ .../v3/models/add_sub_users_to_ip_request.py | 22 ++ .../v3/models/create_ip_pool201_response.py | 35 +++ .../v3/models/create_ip_pool_request.py | 23 ++ .../models/delete_ips_from_ip_pool_request.py | 22 ++ .../delete_sub_users_from_ip_request.py | 22 ++ .../v3/models/get_ip200_response.py | 64 ++++++ .../models/get_ip200_response_pools_inner.py | 25 +++ .../v3/models/get_ip_pool200_response.py | 50 +++++ ...ol200_response_ip_count_by_region_inner.py | 26 +++ .../ip_address_management_error_response.py | 27 +++ ..._management_error_response_errors_inner.py | 25 +++ .../ip_address_management/v3/models/items.py | 7 + .../v3/models/list_ip200_response.py | 38 ++++ .../v3/models/list_ip200_response_metadata.py | 27 +++ ...ist_ip200_response_metadata_next_params.py | 74 ++++++ .../list_ip200_response_result_inner.py | 65 ++++++ ...ip200_response_result_inner_pools_inner.py | 25 +++ ...list_ip_assigned_to_ip_pool200_response.py | 38 ++++ ...ssigned_to_ip_pool200_response_metadata.py | 32 +++ ...p_pool200_response_metadata_next_params.py | 37 +++ ...ned_to_ip_pool200_response_result_inner.py | 41 ++++ .../v3/models/list_ip_pool200_response.py | 38 ++++ .../list_ip_pool200_response_metadata.py | 27 +++ ...p_pool200_response_metadata_next_params.py | 46 ++++ .../list_ip_pool200_response_result_inner.py | 46 ++++ ...ist_sub_user_assigned_to_ip200_response.py | 35 +++ ...ser_assigned_to_ip200_response_metadata.py | 32 +++ ..._to_ip200_response_metadata_next_params.py | 25 +++ .../ip_address_management/v3/models/region.py | 7 + .../v3/models/region1.py | 8 + .../v3/models/region2.py | 7 + .../v3/models/region3.py | 7 + .../v3/models/region4.py | 8 + .../v3/models/region5.py | 7 + .../v3/models/region6.py | 7 + .../v3/models/region7.py | 8 + .../v3/models/update_ip200_response.py | 41 ++++ .../v3/models/update_ip_pool200_response.py | 23 ++ .../v3/models/update_ip_pool_request.py | 22 ++ .../v3/models/update_ip_request.py | 37 +++ .../api/ip_address_management/v3/update_ip.py | 61 +++++ .../v3/update_ip_pool.py | 61 +++++ sendgrid/rest/api/ip_warmup/v3/__init__.py | 1 + .../rest/api/ip_warmup/v3/get_warm_up_ip.py | 52 +++++ .../rest/api/ip_warmup/v3/list_warm_up_ip.py | 48 ++++ .../rest/api/ip_warmup/v3/models/__init__.py | 46 ++++ .../v3/models/get_warm_up_ip404_response.py | 27 +++ ...get_warm_up_ip404_response_errors_inner.py | 25 +++ .../ip_warmup/v3/models/ip_warmup200_inner.py | 25 +++ .../v3/models/stop_ip_warm_up404_response.py | 27 +++ ...top_ip_warm_up404_response_errors_inner.py | 25 +++ .../v3/models/warm_up_ip404_response.py | 25 +++ .../warm_up_ip404_response_errors_inner.py | 25 +++ .../ip_warmup/v3/models/warm_up_ip_request.py | 22 ++ .../rest/api/ip_warmup/v3/stop_ip_warm_up.py | 52 +++++ sendgrid/rest/api/ip_warmup/v3/warm_up_ip.py | 55 +++++ sendgrid/rest/api/ips/v3/__init__.py | 1 + sendgrid/rest/api/ips/v3/add_ip.py | 55 +++++ sendgrid/rest/api/ips/v3/add_ip_to_ip_pool.py | 61 +++++ sendgrid/rest/api/ips/v3/create_ip_pool.py | 55 +++++ .../rest/api/ips/v3/delete_ip_from_ip_pool.py | 54 +++++ sendgrid/rest/api/ips/v3/delete_ip_pool.py | 52 +++++ sendgrid/rest/api/ips/v3/get_ip.py | 52 +++++ sendgrid/rest/api/ips/v3/get_ip_pool.py | 52 +++++ sendgrid/rest/api/ips/v3/list_assigned_ip.py | 48 ++++ sendgrid/rest/api/ips/v3/list_ip.py | 58 +++++ sendgrid/rest/api/ips/v3/list_ip_pool.py | 48 ++++ .../api/ips/v3/list_remaining_ip_count.py | 48 ++++ sendgrid/rest/api/ips/v3/models/__init__.py | 98 ++++++++ .../api/ips/v3/models/add_ip201_response.py | 40 ++++ .../v3/models/add_ip201_response_ips_inner.py | 25 +++ .../rest/api/ips/v3/models/add_ip_request.py | 37 +++ .../models/add_ip_to_ip_pool201_response.py | 41 ++++ .../models/add_ip_to_ip_pool404_response.py | 27 +++ ..._ip_to_ip_pool404_response_errors_inner.py | 25 +++ .../v3/models/add_ip_to_ip_pool_request.py | 22 ++ .../ips/v3/models/create_ip_pool_request.py | 22 ++ .../delete_ip_from_ip_pool404_response.py | 22 ++ .../v3/models/delete_ip_pool404_response.py | 22 ++ .../rest/api/ips/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../api/ips/v3/models/get_ip200_response.py | 53 +++++ .../ips/v3/models/get_ip_pool200_response.py | 27 +++ .../ips/v3/models/get_ip_pool404_response.py | 25 +++ .../get_ip_pool404_response_errors_inner.py | 25 +++ .../rest/api/ips/v3/models/ip_pools200.py | 22 ++ .../list_assigned_ip200_response_inner.py | 41 ++++ .../v3/models/list_ip200_response_inner.py | 57 +++++ .../list_remaining_ip_count200_response.py | 28 +++ ...ning_ip_count200_response_results_inner.py | 37 +++ .../api/ips/v3/models/sort_by_direction.py | 7 + .../v3/models/update_ip_pool404_response.py | 27 +++ ...update_ip_pool404_response_errors_inner.py | 25 +++ .../ips/v3/models/update_ip_pool_request.py | 22 ++ sendgrid/rest/api/ips/v3/update_ip_pool.py | 59 +++++ .../rest/api/link_branding/v3/__init__.py | 1 + .../v3/associate_branded_link_with_subuser.py | 63 ++++++ .../link_branding/v3/create_branded_link.py | 65 ++++++ .../link_branding/v3/delete_branded_link.py | 62 +++++ .../disassociate_branded_link_from_subuser.py | 50 +++++ .../api/link_branding/v3/get_branded_link.py | 62 +++++ .../api/link_branding/v3/list_branded_link.py | 59 +++++ .../v3/list_default_branded_link.py | 59 +++++ .../v3/list_subuser_branded_link.py | 50 +++++ .../api/link_branding/v3/models/__init__.py | 94 ++++++++ ...ciate_branded_link_with_subuser_request.py | 22 ++ .../v3/models/create_branded_link_request.py | 43 ++++ .../api/link_branding/v3/models/default.py | 11 + .../api/link_branding/v3/models/default1.py | 11 + .../api/link_branding/v3/models/default2.py | 11 + .../api/link_branding/v3/models/legacy.py | 11 + .../v3/models/link_branding200.py | 67 ++++++ .../v3/models/link_branding200_dns.py | 39 ++++ .../link_branding200_dns_domain_cname.py | 43 ++++ .../link_branding200_dns_owner_cname.py | 43 ++++ .../api/link_branding/v3/models/region.py | 7 + .../rest/api/link_branding/v3/models/type.py | 8 + .../rest/api/link_branding/v3/models/type1.py | 8 + .../v3/models/update_branded_link_request.py | 23 ++ .../rest/api/link_branding/v3/models/valid.py | 11 + .../api/link_branding/v3/models/valid1.py | 11 + .../api/link_branding/v3/models/valid2.py | 11 + .../api/link_branding/v3/models/valid3.py | 11 + .../api/link_branding/v3/models/valid4.py | 11 + .../api/link_branding/v3/models/valid5.py | 11 + .../validate_branded_link200_response.py | 43 ++++ ...ded_link200_response_validation_results.py | 43 ++++ ...esponse_validation_results_domain_cname.py | 26 +++ ...response_validation_results_owner_cname.py | 26 +++ .../validate_branded_link500_response.py | 27 +++ ...e_branded_link500_response_errors_inner.py | 22 ++ .../link_branding/v3/update_branded_link.py | 69 ++++++ .../link_branding/v3/validate_branded_link.py | 62 +++++ .../rest/api/lmc_campaigns/v3/__init__.py | 1 + .../api/lmc_campaigns/v3/create_campaign.py | 65 ++++++ .../api/lmc_campaigns/v3/delete_campaign.py | 62 +++++ .../rest/api/lmc_campaigns/v3/get_campaign.py | 62 +++++ .../v3/get_scheduled_campaign.py | 62 +++++ .../api/lmc_campaigns/v3/list_campaign.py | 60 +++++ .../api/lmc_campaigns/v3/models/__init__.py | 78 +++++++ .../lmc_campaigns/v3/models/campaigns2xx.py | 82 +++++++ .../api/lmc_campaigns/v3/models/editor.py | 7 + .../lmc_campaigns/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/get_campaign200_response.py | 77 +++++++ .../v3/models/list_campaign200_response.py | 23 ++ .../v3/models/post_campaigns_request.py | 74 ++++++ .../v3/models/schedule_a_campaign_request.py | 22 ++ .../v3/models/schedule_a_campaign_response.py | 38 ++++ .../v3/models/send_a_campaign_response.py | 23 ++ .../v3/models/send_a_test_campaign_request.py | 22 ++ .../v3/models/send_test_campaign_request.py | 22 ++ .../api/lmc_campaigns/v3/models/status.py | 6 + .../v3/models/update_a_campaign_request.py | 45 ++++ .../update_a_scheduled_campaign_request.py | 22 ++ .../update_a_scheduled_campaign_response.py | 37 +++ ...w_scheduled_time_of_a_campaign_response.py | 22 ++ .../api/lmc_campaigns/v3/schedule_campaign.py | 69 ++++++ .../api/lmc_campaigns/v3/send_campaign.py | 62 +++++ .../lmc_campaigns/v3/send_test_campaign.py | 69 ++++++ .../lmc_campaigns/v3/un_schedule_campaign.py | 62 +++++ .../api/lmc_campaigns/v3/update_campaign.py | 69 ++++++ .../v3/update_scheduled_campaign.py | 71 ++++++ .../rest/api/lmc_contactdb/v3/__init__.py | 1 + .../api/lmc_contactdb/v3/add_recipient.py | 65 ++++++ .../v3/add_recipient_to_contact_db_list.py | 64 ++++++ .../v3/add_recipients_to_contact_db_list.py | 66 ++++++ .../v3/create_contact_db_list.py | 65 ++++++ .../lmc_contactdb/v3/create_custom_field.py | 65 ++++++ .../api/lmc_contactdb/v3/create_segment.py | 65 ++++++ .../v3/delete_contact_db_list.py | 68 ++++++ .../v3/delete_contact_db_lists.py | 62 +++++ .../lmc_contactdb/v3/delete_custom_field.py | 62 +++++ .../api/lmc_contactdb/v3/delete_recipient.py | 62 +++++ .../delete_recipient_from_contact_db_list.py | 68 ++++++ .../api/lmc_contactdb/v3/delete_recipients.py | 62 +++++ .../api/lmc_contactdb/v3/delete_segment.py | 67 ++++++ .../rest/api/lmc_contactdb/v3/get_billable.py | 58 +++++ .../lmc_contactdb/v3/get_contact_db_list.py | 62 +++++ .../api/lmc_contactdb/v3/get_custom_field.py | 62 +++++ .../api/lmc_contactdb/v3/get_recipient.py | 62 +++++ .../lmc_contactdb/v3/get_recipient_list.py | 62 +++++ .../rest/api/lmc_contactdb/v3/get_segment.py | 62 +++++ .../lmc_contactdb/v3/list_contact_db_list.py | 58 +++++ .../api/lmc_contactdb/v3/list_custom_field.py | 58 +++++ .../api/lmc_contactdb/v3/list_recipient.py | 60 +++++ .../lmc_contactdb/v3/list_recipient_count.py | 58 +++++ .../v3/list_recipient_for_segment.py | 64 ++++++ .../list_recipients_from_contact_db_list.py | 64 ++++++ .../lmc_contactdb/v3/list_reserved_field.py | 58 +++++ .../lmc_contactdb/v3/list_search_recipient.py | 59 +++++ .../rest/api/lmc_contactdb/v3/list_segment.py | 58 +++++ .../rest/api/lmc_contactdb/v3/list_status.py | 58 +++++ .../api/lmc_contactdb/v3/models/__init__.py | 170 ++++++++++++++ .../v3/models/add_recipient_request_inner.py | 41 ++++ .../api/lmc_contactdb/v3/models/and_or.py | 8 + .../v3/models/contactdb_custom_field.py | 24 ++ .../v3/models/contactdb_custom_field_id2xx.py | 36 +++ .../models/contactdb_custom_field_id_value.py | 42 ++++ .../v3/models/contactdb_list2xx.py | 37 +++ .../v3/models/contactdb_recipient200.py | 27 +++ ...contactdb_recipient200_recipients_inner.py | 68 ++++++ .../v3/models/contactdb_recipient_count200.py | 24 ++ .../models/contactdb_recipient_response201.py | 52 +++++ ...ctdb_recipient_response201_errors_inner.py | 30 +++ .../v3/models/contactdb_segments.py | 44 ++++ .../models/contactdb_segments_conditions.py | 43 ++++ .../v3/models/contactdb_segments_id200.py | 48 ++++ .../v3/models/create_a_list_request.py | 22 ++ .../v3/models/create_custom_field_request.py | 25 +++ .../v3/models/delete_contacts.py | 11 + .../lmc_contactdb/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../models/get_recipient_list200_response.py | 23 ++ .../models/list_all_custom_fields_response.py | 25 +++ .../v3/models/list_all_lists_response.py | 23 ++ .../v3/models/list_all_segments_response.py | 25 +++ ...pients_from_contact_db_list200_response.py | 27 +++ .../list_recipients_on_a_segment_response.py | 25 +++ .../v3/models/list_recipients_response.py | 22 ++ .../models/list_reserved_field200_response.py | 32 +++ ...field200_response_reserved_fields_inner.py | 25 +++ .../v3/models/list_status200_response.py | 25 +++ .../list_status200_response_status_inner.py | 25 +++ .../api/lmc_contactdb/v3/models/operator.py | 10 + .../v3/models/search_recipient200_response.py | 36 +++ ..._recipient200_response_recipients_inner.py | 66 ++++++ ...se_recipients_inner_custom_fields_inner.py | 46 ++++ ...ipients_inner_custom_fields_inner_value.py | 26 +++ .../v3/models/search_recipient_request.py | 35 +++ .../rest/api/lmc_contactdb/v3/models/type.py | 8 + .../v3/models/update_a_list_request.py | 22 ++ .../update_contact_db_list200_response.py | 37 +++ .../models/update_recipient_request_inner.py | 37 +++ .../v3/models/update_segment_request.py | 40 ++++ .../api/lmc_contactdb/v3/search_recipient.py | 57 +++++ .../v3/update_contact_db_list.py | 69 ++++++ .../api/lmc_contactdb/v3/update_recipient.py | 67 ++++++ .../api/lmc_contactdb/v3/update_segment.py | 69 ++++++ sendgrid/rest/api/lmc_senders/v3/__init__.py | 1 + .../rest/api/lmc_senders/v3/create_sender.py | 65 ++++++ .../rest/api/lmc_senders/v3/delete_sender.py | 62 +++++ .../rest/api/lmc_senders/v3/get_sender.py | 62 +++++ .../rest/api/lmc_senders/v3/list_sender.py | 58 +++++ .../api/lmc_senders/v3/models/__init__.py | 46 ++++ .../v3/models/create_sender400_response.py | 27 +++ .../create_sender400_response_errors_inner.py | 25 +++ .../v3/models/create_sender_request.py | 61 +++++ .../v3/models/list_sender200_response.py | 23 ++ .../api/lmc_senders/v3/models/sender_id.py | 87 +++++++ .../v3/models/sender_id_request.py | 67 ++++++ .../v3/models/sender_id_request_from.py | 23 ++ .../v3/models/sender_id_request_reply_to.py | 25 +++ .../v3/reset_sender_verification.py | 62 +++++ .../rest/api/lmc_senders/v3/update_sender.py | 67 ++++++ sendgrid/rest/api/mail/v3/__init__.py | 1 + .../rest/api/mail/v3/create_mail_batch.py | 58 +++++ sendgrid/rest/api/mail/v3/get_mail_batch.py | 58 +++++ sendgrid/rest/api/mail/v3/models/__init__.py | 98 ++++++++ .../api/mail/v3/models/content_encoding.py | 6 + .../rest/api/mail/v3/models/disposition.py | 7 + .../rest/api/mail/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../api/mail/v3/models/mail_batch_response.py | 22 ++ sendgrid/rest/api/mail/v3/models/mail_from.py | 23 ++ sendgrid/rest/api/mail/v3/models/mail_to.py | 23 ++ .../api/mail/v3/models/send_mail_request.py | 111 +++++++++ .../mail/v3/models/send_mail_request_asm.py | 33 +++ .../send_mail_request_attachments_inner.py | 46 ++++ .../models/send_mail_request_content_inner.py | 25 +++ .../models/send_mail_request_mail_settings.py | 75 +++++++ ..._mail_settings_bypass_bounce_management.py | 24 ++ ...st_mail_settings_bypass_list_management.py | 24 ++ ...st_mail_settings_bypass_spam_management.py | 24 ++ ..._settings_bypass_unsubscribe_management.py | 24 ++ .../send_mail_request_mail_settings_footer.py | 37 +++ ...mail_request_mail_settings_sandbox_mode.py | 22 ++ ...end_mail_request_personalizations_inner.py | 67 ++++++ .../send_mail_request_tracking_settings.py | 55 +++++ ...equest_tracking_settings_click_tracking.py | 30 +++ ...il_request_tracking_settings_ganalytics.py | 49 ++++ ...request_tracking_settings_open_tracking.py | 31 +++ ...tracking_settings_subscription_tracking.py | 41 ++++ sendgrid/rest/api/mail/v3/send_mail.py | 64 ++++++ .../rest/api/mail_settings/v3/__init__.py | 1 + .../v3/list_address_whitelist.py | 58 +++++ .../api/mail_settings/v3/list_bounce_purge.py | 58 +++++ .../rest/api/mail_settings/v3/list_footer.py | 58 +++++ .../mail_settings/v3/list_forward_bounce.py | 58 +++++ .../api/mail_settings/v3/list_forward_spam.py | 58 +++++ .../api/mail_settings/v3/list_mail_setting.py | 60 +++++ .../api/mail_settings/v3/list_template.py | 58 +++++ .../api/mail_settings/v3/models/__init__.py | 62 +++++ .../models/list_mail_setting200_response.py | 27 +++ ...t_mail_setting200_response_result_inner.py | 41 ++++ .../mail_settings_address_whitelabel200.py | 27 +++ .../v3/models/mail_settings_bounce_purge.py | 37 +++ .../v3/models/mail_settings_footer.py | 37 +++ .../v3/models/mail_settings_forward_bounce.py | 25 +++ .../v3/models/mail_settings_forward_spam.py | 25 +++ .../v3/models/mail_settings_template200.py | 30 +++ .../update_address_whitelist_request.py | 27 +++ .../v3/models/update_template200_response.py | 30 +++ .../v3/models/update_template_request.py | 30 +++ .../v3/update_address_whitelist.py | 67 ++++++ .../mail_settings/v3/update_bounce_purge.py | 65 ++++++ .../api/mail_settings/v3/update_footer.py | 65 ++++++ .../mail_settings/v3/update_forward_bounce.py | 65 ++++++ .../mail_settings/v3/update_forward_spam.py | 65 ++++++ .../api/mail_settings/v3/update_template.py | 65 ++++++ sendgrid/rest/api/mc_contacts/v3/__init__.py | 1 + .../rest/api/mc_contacts/v3/delete_contact.py | 53 +++++ .../v3/delete_contact_identifier.py | 63 ++++++ .../rest/api/mc_contacts/v3/export_contact.py | 57 +++++ .../rest/api/mc_contacts/v3/get_contact.py | 52 +++++ .../v3/get_contact_by_identifiers.py | 64 ++++++ .../api/mc_contacts/v3/get_export_contact.py | 52 +++++ .../api/mc_contacts/v3/get_import_contact.py | 52 +++++ .../rest/api/mc_contacts/v3/import_contact.py | 57 +++++ .../mc_contacts/v3/list_batched_contact.py | 57 +++++ .../rest/api/mc_contacts/v3/list_contact.py | 48 ++++ .../mc_contacts/v3/list_contact_by_email.py | 57 +++++ .../api/mc_contacts/v3/list_contact_count.py | 48 ++++ .../api/mc_contacts/v3/list_export_contact.py | 48 ++++ .../api/mc_contacts/v3/models/__init__.py | 212 ++++++++++++++++++ .../mc_contacts/v3/models/contact_details3.py | 126 +++++++++++ .../mc_contacts/v3/models/contact_export.py | 67 ++++++ .../mc_contacts/v3/models/contact_import.py | 52 +++++ .../v3/models/contact_import_results.py | 49 ++++ .../mc_contacts/v3/models/contact_request.py | 84 +++++++ .../models/contact_request_custom_fields.py | 22 ++ .../mc_contacts/v3/models/contacts_error.py | 41 ++++ .../v3/models/delete_contact202_response.py | 22 ++ .../v3/models/delete_contact400_response.py | 22 ++ .../delete_contact_identifier202_response.py | 22 ++ .../delete_contact_identifier_request.py | 34 +++ .../mc_contacts/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/export_contact202_response.py | 26 +++ .../v3/models/export_contact_request.py | 49 ++++ .../export_contact_request_notifications.py | 22 ++ .../api/mc_contacts/v3/models/file_type.py | 7 + .../api/mc_contacts/v3/models/file_type1.py | 6 + .../get_contact_by_identifiers200_response.py | 22 ++ ...by_identifiers200_response_result_value.py | 28 +++ .../get_contact_by_identifiers_request.py | 22 ++ .../models/get_import_contact400_response.py | 23 ++ .../mc_contacts/v3/models/identifier_type.py | 9 + .../mc_contacts/v3/models/identifier_type1.py | 9 + .../v3/models/import_contact200_response.py | 42 ++++ ...ontact200_response_upload_headers_inner.py | 25 +++ .../v3/models/import_contact400_response.py | 23 ++ .../v3/models/import_contact404_response.py | 23 ++ .../v3/models/import_contact_request.py | 38 ++++ .../list_batched_contact200_response.py | 23 ++ .../v3/models/list_batched_contact_request.py | 22 ++ .../v3/models/list_contact200_response.py | 39 ++++ .../v3/models/list_contact400_response.py | 23 ++ .../list_contact_by_email200_response.py | 22 ++ .../models/list_contact_by_email_request.py | 41 ++++ .../models/list_contact_count200_response.py | 42 ++++ ...ct_count200_response_billable_breakdown.py | 25 +++ .../models/list_export_contact200_response.py | 38 ++++ ...ist_export_contact200_response_metadata.py | 37 +++ ...export_contact200_response_result_inner.py | 79 +++++++ ...ntact200_response_result_inner_metadata.py | 37 +++ ...00_response_result_inner_segments_inner.py | 25 +++ .../models/list_export_contact400_response.py | 27 +++ ...export_contact400_response_errors_inner.py | 28 +++ .../api/mc_contacts/v3/models/metadata.py | 41 ++++ .../v3/models/search_contact200_response.py | 39 ++++ .../v3/models/search_contact400_response.py | 27 +++ ...search_contact400_response_errors_inner.py | 25 +++ .../v3/models/search_contact500_response.py | 27 +++ ...search_contact500_response_errors_inner.py | 22 ++ .../v3/models/search_contact_request.py | 22 ++ .../mc_contacts/v3/models/self_metadata.py | 22 ++ .../rest/api/mc_contacts/v3/models/status.py | 8 + .../v3/models/update_contact202_response.py | 22 ++ .../v3/models/update_contact_request.py | 33 +++ .../rest/api/mc_contacts/v3/search_contact.py | 57 +++++ .../rest/api/mc_contacts/v3/update_contact.py | 57 +++++ .../rest/api/mc_custom_fields/v3/__init__.py | 1 + .../v3/create_field_definition.py | 57 +++++ .../v3/delete_field_definition.py | 52 +++++ .../v3/list_field_definition.py | 48 ++++ .../mc_custom_fields/v3/models/__init__.py | 58 +++++ .../create_field_definition200_response.py | 43 ++++ .../create_field_definition400_response.py | 25 +++ .../models/create_field_definition_request.py | 28 +++ .../custom_field_definitions_response.py | 38 ++++ .../v3/models/custom_fields_error.py | 41 ++++ .../mc_custom_fields/v3/models/field_type.py | 8 + .../mc_custom_fields/v3/models/field_type1.py | 8 + .../mc_custom_fields/v3/models/field_type2.py | 8 + .../list_field_definition200_response.py | 44 ++++ .../mc_custom_fields/v3/models/metadata.py | 41 ++++ ...served_field_definitions_response_inner.py | 38 ++++ .../models/update_field_definition_request.py | 22 ++ .../v3/update_field_definition.py | 61 +++++ sendgrid/rest/api/mc_designs/v3/__init__.py | 1 + .../rest/api/mc_designs/v3/create_design.py | 55 +++++ .../rest/api/mc_designs/v3/delete_design.py | 52 +++++ .../api/mc_designs/v3/duplicate_design.py | 61 +++++ .../v3/duplicate_pre_built_design.py | 61 +++++ sendgrid/rest/api/mc_designs/v3/get_design.py | 52 +++++ .../api/mc_designs/v3/get_pre_built_design.py | 52 +++++ .../rest/api/mc_designs/v3/list_design.py | 54 +++++ .../mc_designs/v3/list_pre_built_design.py | 54 +++++ .../rest/api/mc_designs/v3/models/__init__.py | 50 +++++ .../api/mc_designs/v3/models/api_error.py | 37 +++ .../api/mc_designs/v3/models/api_errors.py | 23 ++ .../v3/models/design_common_properties.py | 46 ++++ .../v3/models/design_duplicate_input.py | 26 +++ .../api/mc_designs/v3/models/design_input.py | 42 ++++ .../api/mc_designs/v3/models/design_output.py | 42 ++++ .../v3/models/design_output_summary.py | 50 +++++ .../rest/api/mc_designs/v3/models/editor.py | 7 + .../v3/models/list_design200_response.py | 36 +++ .../rest/api/mc_designs/v3/models/metadata.py | 41 ++++ .../v3/models/update_design_request.py | 49 ++++ .../rest/api/mc_designs/v3/update_design.py | 61 +++++ sendgrid/rest/api/mc_lists/v3/__init__.py | 1 + .../api/mc_lists/v3/create_marketing_list.py | 57 +++++ .../rest/api/mc_lists/v3/delete_contact.py | 54 +++++ .../api/mc_lists/v3/delete_marketing_list.py | 56 +++++ .../api/mc_lists/v3/get_marketing_list.py | 56 +++++ .../api/mc_lists/v3/list_contact_count.py | 52 +++++ .../api/mc_lists/v3/list_marketing_list.py | 53 +++++ .../rest/api/mc_lists/v3/models/__init__.py | 64 ++++++ .../api/mc_lists/v3/models/contact_details.py | 126 +++++++++++ .../create_marketing_list400_response.py | 23 ++ .../models/create_marketing_list_request.py | 22 ++ .../v3/models/delete_contact202_response.py | 22 ++ .../delete_marketing_list200_response.py | 22 ++ .../delete_marketing_list404_response.py | 22 ++ sendgrid/rest/api/mc_lists/v3/models/error.py | 41 ++++ .../models/get_marketing_list200_response.py | 47 ++++ sendgrid/rest/api/mc_lists/v3/models/list.py | 42 ++++ .../models/list_contact_count200_response.py | 31 +++ .../models/list_marketing_list200_response.py | 31 +++ .../rest/api/mc_lists/v3/models/metadata.py | 41 ++++ .../api/mc_lists/v3/models/self_metadata.py | 22 ++ .../models/update_marketing_list_request.py | 22 ++ .../api/mc_lists/v3/update_marketing_list.py | 61 +++++ sendgrid/rest/api/mc_segments/v3/__init__.py | 1 + .../rest/api/mc_segments/v3/delete_segment.py | 52 +++++ .../rest/api/mc_segments/v3/get_segment.py | 56 +++++ .../rest/api/mc_segments/v3/list_segment.py | 54 +++++ .../api/mc_segments/v3/models/__init__.py | 56 +++++ .../mc_segments/v3/models/contact_response.py | 96 ++++++++ .../models/contact_response_custom_fields.py | 33 +++ .../mc_segments/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../api/mc_segments/v3/models/full_segment.py | 74 ++++++ .../v3/models/get_segment404_response.py | 25 +++ .../get_segment404_response_errors_inner.py | 25 +++ .../v3/models/list_segment200_response.py | 23 ++ .../v3/models/list_segment500_response.py | 27 +++ .../list_segment500_response_errors_inner.py | 22 ++ .../mc_segments/v3/models/segment_summary.py | 57 +++++ .../mc_segments/v3/models/segment_write_v2.py | 37 +++ .../rest/api/mc_segments_2/v3/__init__.py | 1 + .../api/mc_segments_2/v3/create_segment.py | 55 +++++ .../api/mc_segments_2/v3/delete_segment.py | 52 +++++ .../rest/api/mc_segments_2/v3/get_segment.py | 56 +++++ .../rest/api/mc_segments_2/v3/list_segment.py | 54 +++++ .../api/mc_segments_2/v3/models/__init__.py | 54 +++++ .../v3/models/all_segments200.py | 73 ++++++ .../v3/models/contact_response.py | 96 ++++++++ .../models/contact_response_custom_fields.py | 33 +++ .../v3/models/errors_segment_v2.py | 25 +++ .../models/errors_segment_v2_errors_inner.py | 25 +++ .../api/mc_segments_2/v3/models/metadata.py | 41 ++++ .../api/mc_segments_2/v3/models/segment2xx.py | 89 ++++++++ .../mc_segments_2/v3/models/segment_error.py | 22 ++ .../v3/models/segment_refresh202.py | 22 ++ .../v3/models/segment_refresh_request.py | 22 ++ .../v3/models/segment_status_response.py | 33 +++ .../mc_segments_2/v3/models/segment_update.py | 25 +++ .../v3/models/segment_write_v2.py | 37 +++ .../api/mc_segments_2/v3/refresh_segment.py | 60 +++++ .../api/mc_segments_2/v3/update_segment.py | 59 +++++ sendgrid/rest/api/mc_senders/v3/__init__.py | 1 + .../rest/api/mc_senders/v3/create_sender.py | 65 ++++++ .../rest/api/mc_senders/v3/delete_sender.py | 62 +++++ sendgrid/rest/api/mc_senders/v3/get_sender.py | 62 +++++ .../rest/api/mc_senders/v3/list_sender.py | 58 +++++ .../rest/api/mc_senders/v3/models/__init__.py | 50 +++++ .../v3/models/create_sender_request.py | 67 ++++++ .../v3/models/create_sender_request_from.py | 25 +++ .../models/create_sender_request_reply_to.py | 25 +++ .../mc_senders/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/list_sender200_response.py | 23 ++ .../rest/api/mc_senders/v3/models/sender.py | 87 +++++++ .../mc_senders/v3/models/sender_request.py | 65 ++++++ .../v3/models/sender_request_from.py | 23 ++ .../v3/models/sender_request_reply_to.py | 25 +++ .../v3/reset_sender_verification.py | 62 +++++ .../rest/api/mc_senders/v3/update_sender.py | 67 ++++++ .../rest/api/mc_singlesends/v3/__init__.py | 1 + .../mc_singlesends/v3/create_single_send.py | 57 +++++ .../v3/delete_scheduled_single_send.py | 52 +++++ .../mc_singlesends/v3/delete_single_send.py | 52 +++++ .../mc_singlesends/v3/delete_single_sends.py | 52 +++++ .../v3/duplicate_single_send.py | 61 +++++ .../api/mc_singlesends/v3/get_single_send.py | 52 +++++ .../api/mc_singlesends/v3/list_category.py | 48 ++++ .../api/mc_singlesends/v3/list_single_send.py | 53 +++++ .../api/mc_singlesends/v3/models/__init__.py | 112 +++++++++ .../v3/models/ab_test_summary.py | 55 +++++ .../models/duplicate_single_send_request.py | 22 ++ .../api/mc_singlesends/v3/models/editor.py | 7 + .../api/mc_singlesends/v3/models/editor1.py | 7 + .../api/mc_singlesends/v3/models/items.py | 8 + .../v3/models/list_category200_response.py | 22 ++ .../v3/models/list_single_send200_response.py | 36 +++ .../v3/models/list_single_send500_response.py | 27 +++ ...st_single_send500_response_errors_inner.py | 37 +++ .../api/mc_singlesends/v3/models/metadata.py | 41 ++++ .../schedule_single_send201_response.py | 28 +++ .../v3/models/schedule_single_send_request.py | 22 ++ .../models/search_single_send200_response.py | 36 +++ .../v3/models/singlesend_request.py | 51 +++++ .../models/singlesend_request_email_config.py | 66 ++++++ .../v3/models/singlesend_request_send_to.py | 37 +++ .../v3/models/singlesend_response.py | 75 +++++++ .../singlesend_response_email_config.py | 66 ++++++ .../v3/models/singlesend_response_send_to.py | 37 +++ .../v3/models/singlesend_response_short.py | 63 ++++++ .../singlesend_response_warnings_inner.py | 37 +++ .../v3/models/singlesend_schedule.py | 28 +++ .../v3/models/singlesend_search.py | 38 ++++ .../api/mc_singlesends/v3/models/status.py | 6 + .../api/mc_singlesends/v3/models/status1.py | 8 + .../api/mc_singlesends/v3/models/status2.py | 8 + .../api/mc_singlesends/v3/models/status3.py | 8 + .../rest/api/mc_singlesends/v3/models/type.py | 7 + .../v3/models/winner_criteria.py | 8 + .../mc_singlesends/v3/schedule_single_send.py | 61 +++++ .../mc_singlesends/v3/search_single_send.py | 59 +++++ .../mc_singlesends/v3/update_single_send.py | 61 +++++ sendgrid/rest/api/mc_stats/v3/__init__.py | 1 + .../api/mc_stats/v3/export_automation_stat.py | 53 +++++ .../mc_stats/v3/export_single_send_stat.py | 53 +++++ .../api/mc_stats/v3/get_automation_stat.py | 66 ++++++ .../api/mc_stats/v3/get_single_send_stat.py | 65 ++++++ .../api/mc_stats/v3/list_automation_stat.py | 54 +++++ .../mc_stats/v3/list_click_tracking_stat.py | 60 +++++ .../api/mc_stats/v3/list_single_send_stat.py | 54 +++++ .../v3/list_single_send_tracking_stat.py | 62 +++++ .../rest/api/mc_stats/v3/models/__init__.py | 78 +++++++ .../rest/api/mc_stats/v3/models/ab_phase.py | 8 + .../rest/api/mc_stats/v3/models/ab_phase1.py | 8 + .../api/mc_stats/v3/models/ab_phase_id.py | 7 + .../api/mc_stats/v3/models/aggregated_by.py | 7 + .../models/autmoations_link_stats_response.py | 43 ++++ ...tions_link_stats_response_results_inner.py | 41 ++++ .../v3/models/automations_response.py | 36 +++ .../automations_response_results_inner.py | 42 ++++ .../api/mc_stats/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ sendgrid/rest/api/mc_stats/v3/models/items.py | 6 + .../rest/api/mc_stats/v3/models/items1.py | 7 + .../rest/api/mc_stats/v3/models/items2.py | 7 + .../v3/models/link_tracking_metadata.py | 41 ++++ .../rest/api/mc_stats/v3/models/metadata.py | 41 ++++ .../rest/api/mc_stats/v3/models/metrics.py | 73 ++++++ .../models/singlesends_link_stats_response.py | 43 ++++ ...sends_link_stats_response_results_inner.py | 46 ++++ .../v3/models/singlesends_response.py | 36 +++ .../singlesends_response_results_inner.py | 47 ++++ sendgrid/rest/api/mc_test/v3/__init__.py | 1 + .../rest/api/mc_test/v3/models/__init__.py | 24 ++ .../api/mc_test/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../send_test_marketing_email_request.py | 53 +++++ .../mc_test/v3/send_test_marketing_email.py | 59 +++++ sendgrid/rest/api/partner/v3/__init__.py | 1 + .../api/partner/v3/list_partner_setting.py | 60 +++++ .../rest/api/partner/v3/models/__init__.py | 23 ++ .../list_partner_setting200_response.py | 27 +++ ...artner_setting200_response_result_inner.py | 41 ++++ .../recipients_data_erasure/v3/__init__.py | 1 + .../v3/erase_recipient_email_data.py | 67 ++++++ .../v3/models/__init__.py | 30 +++ ...s_data_erasure_erase_recipients_request.py | 24 ++ .../recipients_data_erasure_error_v1.py | 25 +++ .../models/recipients_data_erasure_job_id.py | 22 ++ sendgrid/rest/api/reverse_dns/v3/__init__.py | 1 + .../api/reverse_dns/v3/delete_reverse_dns.py | 62 +++++ .../api/reverse_dns/v3/get_reverse_dns.py | 62 +++++ .../api/reverse_dns/v3/list_reverse_dns.py | 61 +++++ .../api/reverse_dns/v3/models/__init__.py | 64 ++++++ .../api/reverse_dns/v3/models/reverse_dns.py | 71 ++++++ .../v3/models/reverse_dns_a_record.py | 41 ++++ .../v3/models/reverse_dns_users_inner.py | 28 +++ .../v3/models/set_up_reverse_dns_request.py | 37 +++ .../rest/api/reverse_dns/v3/models/valid.py | 11 + .../rest/api/reverse_dns/v3/models/valid1.py | 11 + .../validate_reverse_dns200_response.py | 43 ++++ ...erse_dns200_response_validation_results.py | 32 +++ ...00_response_validation_results_a_record.py | 26 +++ .../validate_reverse_dns404_response.py | 27 +++ ...te_reverse_dns404_response_errors_inner.py | 22 ++ .../validate_reverse_dns500_response.py | 27 +++ ...te_reverse_dns500_response_errors_inner.py | 22 ++ .../api/reverse_dns/v3/set_up_reverse_dns.py | 65 ++++++ .../reverse_dns/v3/validate_reverse_dns.py | 62 +++++ .../rest/api/scheduled_sends/v3/__init__.py | 1 + .../v3/create_scheduled_send.py | 67 ++++++ .../v3/delete_scheduled_send.py | 62 +++++ .../scheduled_sends/v3/get_scheduled_send.py | 62 +++++ .../scheduled_sends/v3/list_scheduled_send.py | 58 +++++ .../api/scheduled_sends/v3/models/__init__.py | 44 ++++ ...ancel_or_pause_a_scheduled_send_request.py | 26 +++ .../v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/mail_batch_id.py | 22 ++ .../v3/models/scheduled_send_status.py | 28 +++ .../api/scheduled_sends/v3/models/status.py | 7 + .../api/scheduled_sends/v3/models/status1.py | 7 + .../api/scheduled_sends/v3/models/status2.py | 7 + .../models/update_scheduled_send_request.py | 23 ++ .../v3/update_scheduled_send.py | 69 ++++++ sendgrid/rest/api/scopes/v3/__init__.py | 1 + .../api/scopes/v3/approve_scope_request.py | 52 +++++ .../rest/api/scopes/v3/deny_scope_request.py | 52 +++++ sendgrid/rest/api/scopes/v3/list_scope.py | 58 +++++ .../rest/api/scopes/v3/list_scope_request.py | 53 +++++ .../rest/api/scopes/v3/models/__init__.py | 52 +++++ .../approve_scope_request200_response.py | 24 ++ .../models/deny_scope_request404_response.py | 27 +++ ..._scope_request404_response_errors_inner.py | 25 +++ .../api/scopes/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/list_scope200_response.py | 22 ++ .../v3/models/list_scope401_response.py | 25 +++ .../list_scope401_response_errors_inner.py | 25 +++ .../list_scope_request200_response_inner.py | 49 ++++ sendgrid/rest/api/seq/v3/__init__.py | 1 + .../seq/v3/list_engagement_quality_score.py | 61 +++++ .../list_subuser_engagement_quality_score.py | 62 +++++ sendgrid/rest/api/seq/v3/models/__init__.py | 24 ++ sendgrid/rest/api/seq/v3/models/seq_error.py | 23 ++ .../rest/api/seq/v3/models/seq_metadata.py | 25 +++ .../seq/v3/models/seq_metadata_next_params.py | 22 ++ .../rest/api/seq/v3/models/seq_metrics.py | 45 ++++ sendgrid/rest/api/seq/v3/models/seq_score.py | 46 ++++ sendgrid/rest/api/sso/v3/__init__.py | 1 + .../rest/api/sso/v3/create_sso_certificate.py | 57 +++++ .../rest/api/sso/v3/create_sso_integration.py | 57 +++++ .../rest/api/sso/v3/create_sso_teammate.py | 57 +++++ .../rest/api/sso/v3/delete_sso_certificate.py | 52 +++++ .../rest/api/sso/v3/delete_sso_integration.py | 52 +++++ .../rest/api/sso/v3/get_sso_certificate.py | 52 +++++ .../rest/api/sso/v3/get_sso_integration.py | 56 +++++ .../rest/api/sso/v3/list_sso_integration.py | 52 +++++ .../v3/list_sso_integration_certificate.py | 52 +++++ sendgrid/rest/api/sso/v3/models/__init__.py | 74 ++++++ .../models/create_sso_certificate_request.py | 37 +++ .../sso/v3/models/patch_sso_teammates200.py | 107 +++++++++ .../rest/api/sso/v3/models/permission_type.py | 7 + .../api/sso/v3/models/permission_type1.py | 7 + sendgrid/rest/api/sso/v3/models/persona.py | 9 + .../models/post_patch_integration_request.py | 49 ++++ .../sso/v3/models/post_sso_teammates201.py | 62 +++++ .../v3/models/post_sso_teammates_request.py | 63 ++++++ .../api/sso/v3/models/sso_certificate_body.py | 45 ++++ .../sso/v3/models/sso_error_response_inner.py | 37 +++ .../rest/api/sso/v3/models/sso_integration.py | 65 ++++++ .../sso_teammates_base_request_props.py | 59 +++++ ...base_request_props_subuser_access_inner.py | 38 ++++ .../sso_teammates_base_response_props.py | 49 ++++ ...mates_restricted_subuser_response_props.py | 38 ++++ ...ser_response_props_subuser_access_inner.py | 50 +++++ .../models/update_sso_certificate_request.py | 37 +++ sendgrid/rest/api/sso/v3/models/user_type.py | 8 + .../rest/api/sso/v3/update_sso_certificate.py | 61 +++++ .../rest/api/sso/v3/update_sso_integration.py | 62 +++++ .../rest/api/sso/v3/update_sso_teammate.py | 61 +++++ sendgrid/rest/api/stats/v3/__init__.py | 1 + sendgrid/rest/api/stats/v3/get_client_stat.py | 67 ++++++ .../rest/api/stats/v3/list_browser_stat.py | 65 ++++++ sendgrid/rest/api/stats/v3/list_category.py | 61 +++++ .../rest/api/stats/v3/list_category_stat.py | 63 ++++++ .../api/stats/v3/list_category_stat_sum.py | 67 ++++++ .../rest/api/stats/v3/list_client_stat.py | 62 +++++ .../rest/api/stats/v3/list_device_stat.py | 64 ++++++ sendgrid/rest/api/stats/v3/list_geo_stat.py | 66 ++++++ .../stats/v3/list_mailbox_provider_stat.py | 65 ++++++ sendgrid/rest/api/stats/v3/list_stat.py | 64 ++++++ sendgrid/rest/api/stats/v3/models/__init__.py | 110 +++++++++ .../stats/v3/models/advanced_stats_clicks.py | 30 +++ .../v3/models/advanced_stats_clicks_opens.py | 41 ++++ .../models/advanced_stats_mailbox_provider.py | 57 +++++ .../stats/v3/models/advanced_stats_opens.py | 28 +++ .../rest/api/stats/v3/models/aggregated_by.py | 8 + .../api/stats/v3/models/aggregated_by1.py | 8 + .../api/stats/v3/models/aggregated_by2.py | 8 + .../api/stats/v3/models/aggregated_by3.py | 8 + .../api/stats/v3/models/category_stats.py | 30 +++ .../v3/models/category_stats_stats_inner.py | 40 ++++ .../category_stats_stats_inner_metrics.py | 89 ++++++++ .../rest/api/stats/v3/models/client_type.py | 9 + sendgrid/rest/api/stats/v3/models/country.py | 7 + .../list_browser_stat200_response_inner.py | 32 +++ ...wser_stat200_response_inner_stats_inner.py | 38 ++++ .../models/list_category200_response_inner.py | 22 ++ .../v3/models/list_category400_response.py | 27 +++ .../list_category400_response_errors_inner.py | 25 +++ .../list_client_stat200_response_inner.py | 32 +++ ...ient_stat200_response_inner_stats_inner.py | 38 ++++ .../models/list_geo_stat200_response_inner.py | 32 +++ ..._geo_stat200_response_inner_stats_inner.py | 40 ++++ ...mailbox_provider_stat200_response_inner.py | 32 +++ ...ider_stat200_response_inner_stats_inner.py | 40 ++++ .../v3/models/list_stat200_response_inner.py | 32 +++ ...list_stat200_response_inner_stats_inner.py | 25 +++ .../api/stats/v3/models/sort_by_direction.py | 7 + .../v3/models/stats_advanced_global_stats.py | 89 ++++++++ sendgrid/rest/api/subusers/v3/__init__.py | 1 + .../rest/api/subusers/v3/create_subuser.py | 57 +++++ .../rest/api/subusers/v3/delete_subuser.py | 52 +++++ .../api/subusers/v3/get_subuser_credit.py | 52 +++++ .../rest/api/subusers/v3/list_monthly_stat.py | 59 +++++ .../rest/api/subusers/v3/list_reputation.py | 52 +++++ sendgrid/rest/api/subusers/v3/list_stat.py | 58 +++++ .../rest/api/subusers/v3/list_stat_sum.py | 59 +++++ sendgrid/rest/api/subusers/v3/list_subuser.py | 57 +++++ .../subusers/v3/list_subuser_monthly_stat.py | 61 +++++ .../rest/api/subusers/v3/models/__init__.py | 108 +++++++++ .../api/subusers/v3/models/aggregated_by.py | 8 + .../api/subusers/v3/models/category_stats.py | 30 +++ .../v3/models/category_stats_stats_inner.py | 40 ++++ .../category_stats_stats_inner_metrics.py | 89 ++++++++ .../v3/models/create_subuser_request.py | 50 +++++ .../api/subusers/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../list_reputation200_response_inner.py | 30 +++ .../rest/api/subusers/v3/models/region.py | 8 + .../rest/api/subusers/v3/models/region1.py | 7 + .../rest/api/subusers/v3/models/region2.py | 7 + .../rest/api/subusers/v3/models/region3.py | 7 + .../api/subusers/v3/models/reset_frequency.py | 8 + .../subusers/v3/models/reset_frequency1.py | 8 + .../subusers/v3/models/sort_by_direction.py | 7 + .../subusers/v3/models/sort_by_direction1.py | 7 + .../subusers/v3/models/sort_by_direction2.py | 7 + .../api/subusers/v3/models/sort_by_metric.py | 14 ++ .../rest/api/subusers/v3/models/subuser.py | 46 ++++ .../api/subusers/v3/models/subuser_credits.py | 47 ++++ .../v3/models/subuser_credits_request.py | 39 ++++ .../api/subusers/v3/models/subuser_post.py | 49 ++++ .../models/subuser_post_credit_allocation.py | 22 ++ .../api/subusers/v3/models/subuser_stats.py | 30 +++ .../v3/models/subuser_stats_stats_inner.py | 48 ++++ .../subuser_stats_stats_inner_metrics.py | 89 ++++++++ sendgrid/rest/api/subusers/v3/models/type.py | 8 + sendgrid/rest/api/subusers/v3/models/type1.py | 8 + .../models/update_subuser_ip200_response.py | 22 ++ ...update_subuser_remaining_credit_request.py | 24 ++ .../v3/models/update_subuser_request.py | 22 ++ .../update_subuser_website_access_request.py | 22 ++ .../rest/api/subusers/v3/update_subuser.py | 61 +++++ .../api/subusers/v3/update_subuser_credit.py | 60 +++++ .../rest/api/subusers/v3/update_subuser_ip.py | 58 +++++ .../v3/update_subuser_remaining_credit.py | 62 +++++ .../v3/update_subuser_website_access.py | 63 ++++++ sendgrid/rest/api/suppressions/v3/__init__.py | 1 + .../v3/add_suppression_to_asm_group.py | 69 ++++++ .../api/suppressions/v3/creat_asm_group.py | 67 ++++++ .../v3/create_global_suppression.py | 65 ++++++ .../api/suppressions/v3/delete_asm_group.py | 62 +++++ .../v3/delete_global_suppression.py | 62 +++++ .../suppressions/v3/delete_invalid_email.py | 62 +++++ .../suppressions/v3/delete_invalid_emails.py | 65 ++++++ .../api/suppressions/v3/delete_spam_report.py | 62 +++++ .../suppressions/v3/delete_spam_reports.py | 65 ++++++ .../v3/delete_suppression_block.py | 62 +++++ .../v3/delete_suppression_blocks.py | 67 ++++++ .../v3/delete_suppression_bounce.py | 62 +++++ .../v3/delete_suppression_bounces.py | 67 ++++++ .../v3/delete_suppression_from_asm_group.py | 64 ++++++ .../rest/api/suppressions/v3/get_asm_group.py | 62 +++++ .../suppressions/v3/get_asm_suppression.py | 62 +++++ .../suppressions/v3/get_global_suppression.py | 62 +++++ .../api/suppressions/v3/get_invalid_email.py | 62 +++++ .../api/suppressions/v3/get_spam_report.py | 62 +++++ .../suppressions/v3/get_suppression_block.py | 62 +++++ .../v3/get_suppression_bounces.py | 62 +++++ ...get_suppression_bounces_classifications.py | 68 ++++++ .../api/suppressions/v3/list_asm_group.py | 59 +++++ .../suppressions/v3/list_asm_suppression.py | 58 +++++ .../v3/list_global_suppression.py | 63 ++++++ .../api/suppressions/v3/list_invalid_email.py | 63 ++++++ .../api/suppressions/v3/list_spam_report.py | 63 ++++++ .../suppressions/v3/list_suppression_block.py | 63 ++++++ .../v3/list_suppression_bounces.py | 65 ++++++ ...ist_suppression_bounces_classifications.py | 63 ++++++ .../v3/list_suppression_from_asm_group.py | 62 +++++ .../api/suppressions/v3/models/__init__.py | 134 +++++++++++ .../rest/api/suppressions/v3/models/accept.py | 7 + .../api/suppressions/v3/models/accept1.py | 7 + ...dd_suppression_to_asm_group201_response.py | 24 ++ .../v3/models/blocks_response_inner.py | 41 ++++ .../suppressions/v3/models/bounce_response.py | 41 ++++ .../suppressions/v3/models/classification.py | 12 + .../suppressions/v3/models/classification1.py | 12 + .../v3/models/creat_asm_group201_response.py | 41 ++++ .../create_global_suppression201_response.py | 24 ++ .../models/delete_invalid_emails_request.py | 30 +++ .../v3/models/delete_spam_reports_request.py | 30 +++ .../delete_suppression_blocks_request.py | 30 +++ .../delete_suppression_bounces_request.py | 30 +++ .../suppressions/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/get_asm_group200_response.py | 49 ++++ .../models/get_asm_suppression200_response.py | 30 +++ ...pression200_response_suppressions_inner.py | 45 ++++ ...ion_bounces_classifications200_response.py | 32 +++ ...lassifications200_response_result_inner.py | 34 +++ ...ns200_response_result_inner_stats_inner.py | 25 +++ .../suppressions/v3/models/invalid_email.py | 37 +++ .../list_asm_suppression200_response_inner.py | 41 ++++ ...st_global_suppression200_response_inner.py | 25 +++ ...ion_bounces_classifications200_response.py | 32 +++ ...lassifications200_response_result_inner.py | 34 +++ ...ns200_response_result_inner_stats_inner.py | 33 +++ .../retrieve_a_global_suppression_response.py | 24 ++ .../v3/models/spam_reports_response_inner.py | 37 +++ .../v3/models/suppression_group.py | 49 ++++ .../suppression_group_request_base_props.py | 37 +++ .../v3/models/suppressions_request.py | 22 ++ .../v3/models/update_asm_group_request.py | 37 +++ .../v3/search_suppression_from_asm_group.py | 69 ++++++ .../api/suppressions/v3/update_asm_group.py | 69 ++++++ sendgrid/rest/api/teammates/v3/__init__.py | 1 + .../teammates/v3/delete_pending_teammate.py | 62 +++++ .../rest/api/teammates/v3/delete_teammate.py | 62 +++++ .../rest/api/teammates/v3/get_teammate.py | 62 +++++ .../rest/api/teammates/v3/invite_teammate.py | 65 ++++++ .../api/teammates/v3/list_pending_teammate.py | 58 +++++ .../teammates/v3/list_subuser_by_template.py | 58 +++++ .../rest/api/teammates/v3/list_teammate.py | 60 +++++ .../rest/api/teammates/v3/models/__init__.py | 98 ++++++++ .../v3/models/get_teammate200_response.py | 86 +++++++ .../v3/models/invite_teammate201_response.py | 41 ++++ .../v3/models/invite_teammate400_response.py | 27 +++ ...nvite_teammate400_response_errors_inner.py | 25 +++ .../v3/models/invite_teammate_request.py | 37 +++ .../list_pending_teammate200_response.py | 27 +++ ...nding_teammate200_response_result_inner.py | 45 ++++ .../list_subuser_by_template200_response.py | 45 ++++ ...ubuser_by_template200_response_metadata.py | 32 +++ ...mplate200_response_metadata_next_params.py | 37 +++ ...mplate200_response_subuser_access_inner.py | 50 +++++ .../list_subuser_by_template400_response.py | 27 +++ ...er_by_template400_response_errors_inner.py | 25 +++ .../v3/models/list_teammate200_response.py | 27 +++ .../list_teammate200_response_result_inner.py | 82 +++++++ .../teammates/v3/models/permission_type.py | 7 + .../resend_teammate_invite200_response.py | 41 ++++ .../v3/models/update_teammate200_response.py | 86 +++++++ .../v3/models/update_teammate_request.py | 27 +++ .../rest/api/teammates/v3/models/user_type.py | 8 + .../api/teammates/v3/models/user_type1.py | 8 + .../api/teammates/v3/models/user_type2.py | 8 + .../teammates/v3/resend_teammate_invite.py | 62 +++++ .../rest/api/teammates/v3/update_teammate.py | 69 ++++++ sendgrid/rest/api/templates/v3/__init__.py | 1 + .../templates/v3/activate_template_version.py | 64 ++++++ .../rest/api/templates/v3/create_template.py | 65 ++++++ .../templates/v3/create_template_version.py | 71 ++++++ .../rest/api/templates/v3/delete_template.py | 62 +++++ .../templates/v3/delete_template_version.py | 64 ++++++ .../api/templates/v3/duplicate_template.py | 69 ++++++ .../rest/api/templates/v3/get_template.py | 62 +++++ .../api/templates/v3/get_template_version.py | 64 ++++++ .../rest/api/templates/v3/list_template.py | 62 +++++ .../rest/api/templates/v3/models/__init__.py | 82 +++++++ .../rest/api/templates/v3/models/active.py | 7 + .../rest/api/templates/v3/models/active1.py | 7 + .../v3/models/create_template_request.py | 28 +++ .../v3/models/duplicate_template_request.py | 22 ++ .../rest/api/templates/v3/models/editor.py | 7 + .../rest/api/templates/v3/models/editor1.py | 7 + .../api/templates/v3/models/generation.py | 7 + .../api/templates/v3/models/generation1.py | 7 + .../api/templates/v3/models/generations.py | 8 + .../v3/models/list_template200_response.py | 36 +++ .../v3/models/list_template400_response.py | 27 +++ .../list_template400_response_errors_inner.py | 28 +++ .../rest/api/templates/v3/models/metadata.py | 41 ++++ .../v3/models/transactional_template.py | 56 +++++ .../transactional_template_version_create.py | 59 +++++ .../transactional_template_version_output.py | 82 +++++++ .../models/transactional_template_warning.py | 22 ++ .../transactional_templates_template_lean.py | 49 ++++ ...sactional_templates_version_output_lean.py | 71 ++++++ .../v3/models/update_template_request.py | 22 ++ .../rest/api/templates/v3/update_template.py | 69 ++++++ .../templates/v3/update_template_version.py | 73 ++++++ .../rest/api/tracking_settings/v3/__init__.py | 1 + .../v3/list_click_tracking_setting.py | 58 +++++ .../list_google_analytics_tracking_setting.py | 58 +++++ .../v3/list_open_tracking_setting.py | 58 +++++ .../v3/list_subscription_tracking_setting.py | 58 +++++ .../v3/list_tracking_setting.py | 58 +++++ .../tracking_settings/v3/models/__init__.py | 48 ++++ .../v3/models/click_tracking.py | 30 +++ .../v3/models/google_analytics_settings.py | 49 ++++ .../list_open_tracking_setting200_response.py | 22 ++ .../list_tracking_setting200_response.py | 27 +++ ...acking_setting200_response_result_inner.py | 41 ++++ .../models/subscription_tracking_settings.py | 49 ++++ .../update_click_tracking_setting_request.py | 22 ++ .../update_open_tracking_setting_request.py | 22 ++ .../v3/update_click_tracking_setting.py | 67 ++++++ ...pdate_google_analytics_tracking_setting.py | 65 ++++++ .../v3/update_open_tracking_setting.py | 67 ++++++ .../update_subscription_tracking_setting.py | 65 ++++++ sendgrid/rest/api/user/v3/__init__.py | 1 + sendgrid/rest/api/user/v3/list_account.py | 58 +++++ sendgrid/rest/api/user/v3/list_credit.py | 58 +++++ sendgrid/rest/api/user/v3/list_email.py | 58 +++++ sendgrid/rest/api/user/v3/list_profile.py | 58 +++++ sendgrid/rest/api/user/v3/list_username.py | 58 +++++ sendgrid/rest/api/user/v3/models/__init__.py | 64 ++++++ .../rest/api/user/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/get_user_account_response.py | 26 +++ .../v3/models/get_user_profile_response.py | 69 ++++++ .../user/v3/models/list_credit200_response.py | 53 +++++ .../user/v3/models/list_email200_response.py | 22 ++ .../v3/models/list_username200_response.py | 28 +++ sendgrid/rest/api/user/v3/models/type.py | 7 + .../v3/models/update_email200_response.py | 22 ++ .../user/v3/models/update_email_request.py | 22 ++ .../user/v3/models/update_password_request.py | 31 +++ .../v3/models/update_username200_response.py | 22 ++ .../user/v3/models/update_username_request.py | 22 ++ .../rest/api/user/v3/models/user_profile.py | 69 ++++++ sendgrid/rest/api/user/v3/update_email.py | 63 ++++++ sendgrid/rest/api/user/v3/update_password.py | 65 ++++++ sendgrid/rest/api/user/v3/update_profile.py | 63 ++++++ sendgrid/rest/api/user/v3/update_username.py | 65 ++++++ .../rest/api/verified_senders/v3/__init__.py | 1 + .../v3/create_verified_sender.py | 57 +++++ .../v3/delete_verified_sender.py | 52 +++++ .../v3/list_verified_sender.py | 54 +++++ .../v3/list_verified_sender_domain.py | 48 ++++ .../list_verified_sender_steps_completed.py | 48 ++++ .../verified_senders/v3/models/__init__.py | 72 ++++++ .../create_verified_sender400_response.py | 27 +++ ...erified_sender400_response_errors_inner.py | 37 +++ .../delete_verified_sender403_response.py | 27 +++ ...erified_sender403_response_errors_inner.py | 28 +++ .../delete_verified_sender404_response.py | 27 +++ .../v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../list_verified_sender200_response.py | 25 +++ ...list_verified_sender_domain200_response.py | 27 +++ ...ified_sender_domain200_response_results.py | 33 +++ ...fied_sender_steps_completed200_response.py | 30 +++ ...der_steps_completed200_response_results.py | 33 +++ .../v3/models/verified_sender_request.py | 69 ++++++ .../v3/models/verified_sender_response.py | 81 +++++++ .../v3/resend_verified_sender.py | 52 +++++ .../v3/update_verified_sender.py | 61 +++++ .../v3/verify_sender_token.py | 52 +++++ sendgrid/rest/api/webhooks/v3/__init__.py | 1 + .../api/webhooks/v3/create_event_webhook.py | 65 ++++++ .../api/webhooks/v3/create_parse_setting.py | 63 ++++++ .../api/webhooks/v3/delete_event_webhook.py | 62 +++++ .../api/webhooks/v3/delete_parse_setting.py | 62 +++++ .../rest/api/webhooks/v3/get_event_webhook.py | 63 ++++++ .../rest/api/webhooks/v3/get_parse_setting.py | 62 +++++ .../webhooks/v3/get_signed_event_webhook.py | 62 +++++ .../api/webhooks/v3/list_event_webhook.py | 59 +++++ .../api/webhooks/v3/list_parse_setting.py | 58 +++++ .../rest/api/webhooks/v3/list_parse_static.py | 64 ++++++ .../rest/api/webhooks/v3/models/__init__.py | 108 +++++++++ .../api/webhooks/v3/models/aggregated_by.py | 8 + .../create_event_webhook400_response.py | 27 +++ ..._event_webhook400_response_errors_inner.py | 35 +++ .../api/webhooks/v3/models/error_response.py | 30 +++ .../v3/models/error_response_errors_inner.py | 37 +++ .../v3/models/event_webhook_all_response.py | 35 +++ .../event_webhook_base_response_props.py | 89 ++++++++ .../event_webhook_date_response_props.py | 33 +++ .../models/event_webhook_no_dates_response.py | 101 +++++++++ .../event_webhook_oauth_response_props.py | 33 +++ .../v3/models/event_webhook_request.py | 93 ++++++++ .../models/event_webhook_signed_response.py | 109 +++++++++ .../event_webhook_signed_response_prop.py | 22 ++ .../v3/models/event_webhook_test_request.py | 45 ++++ .../models/event_webhook_unsigned_response.py | 105 +++++++++ .../get_signed_event_webhook200_response.py | 25 +++ .../get_signed_event_webhook404_response.py | 27 +++ ..._event_webhook404_response_errors_inner.py | 24 ++ .../models/list_parse_setting200_response.py | 23 ++ .../list_parse_static200_response_inner.py | 32 +++ ...se_static200_response_inner_stats_inner.py | 27 +++ ...c200_response_inner_stats_inner_metrics.py | 24 ++ .../api/webhooks/v3/models/parse_setting.py | 41 ++++ .../update_signed_event_webhook_request.py | 22 ++ .../api/webhooks/v3/test_event_webhook.py | 65 ++++++ .../api/webhooks/v3/update_event_webhook.py | 70 ++++++ .../api/webhooks/v3/update_parse_setting.py | 67 ++++++ .../v3/update_signed_event_webhook.py | 71 ++++++ sendgrid/version.py | 2 +- 1264 files changed, 51529 insertions(+), 1 deletion(-) create mode 100644 UPGRADE.md create mode 100644 sendgrid/rest/api/account_provisioning/v3/__init__.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/authenticate_account.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/create_account.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/delete_account.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/get_account_state.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/list_account.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/list_account_offering.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/list_offering.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/__init__.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_list.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account_id.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_catalog.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_list.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_v1.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_pagination.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_profile.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_read.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_write.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/catalog_entry.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/catalog_entry_entitlements.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/create_account_params.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/error_response.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/offerings_to_add.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/state.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/state1.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/models/type.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/update_account_offering.py create mode 100644 sendgrid/rest/api/account_provisioning/v3/update_account_state.py create mode 100644 sendgrid/rest/api/alerts/v3/__init__.py create mode 100644 sendgrid/rest/api/alerts/v3/create_alert.py create mode 100644 sendgrid/rest/api/alerts/v3/delete_alert.py create mode 100644 sendgrid/rest/api/alerts/v3/get_alert.py create mode 100644 sendgrid/rest/api/alerts/v3/list_alert.py create mode 100644 sendgrid/rest/api/alerts/v3/models/__init__.py create mode 100644 sendgrid/rest/api/alerts/v3/models/create_alert201_response.py create mode 100644 sendgrid/rest/api/alerts/v3/models/create_alert_request.py create mode 100644 sendgrid/rest/api/alerts/v3/models/error_response.py create mode 100644 sendgrid/rest/api/alerts/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/alerts/v3/models/get_alert200_response.py create mode 100644 sendgrid/rest/api/alerts/v3/models/list_alert200_response_inner.py create mode 100644 sendgrid/rest/api/alerts/v3/models/type.py create mode 100644 sendgrid/rest/api/alerts/v3/models/type1.py create mode 100644 sendgrid/rest/api/alerts/v3/models/type2.py create mode 100644 sendgrid/rest/api/alerts/v3/models/type3.py create mode 100644 sendgrid/rest/api/alerts/v3/models/update_alert200_response.py create mode 100644 sendgrid/rest/api/alerts/v3/models/update_alert_request.py create mode 100644 sendgrid/rest/api/alerts/v3/update_alert.py create mode 100644 sendgrid/rest/api/api_keys/v3/__init__.py create mode 100644 sendgrid/rest/api/api_keys/v3/create_api_key.py create mode 100644 sendgrid/rest/api/api_keys/v3/delete_api_key.py create mode 100644 sendgrid/rest/api/api_keys/v3/get_api_key.py create mode 100644 sendgrid/rest/api/api_keys/v3/list_api_key.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/__init__.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/api_key_response.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/api_key_scopes_response.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/create_api_key201_response.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/create_api_key_request.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/error_response.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/get_api_key200_response.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/list_api_key200_response.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/update_api_key_name_request.py create mode 100644 sendgrid/rest/api/api_keys/v3/models/update_api_key_request.py create mode 100644 sendgrid/rest/api/api_keys/v3/update_api_key.py create mode 100644 sendgrid/rest/api/api_keys/v3/update_api_key_name.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/__init__.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/add_ip_to_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain_multiple.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/authenticate_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/delete_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/delete_ip_from_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/disassociate_authenticated_domain_from_user.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/disassociate_subuser_from_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/email_dns_record.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/get_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/list_all_authenticated_domain_with_user.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain_with_user.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/list_default_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/__init__.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/add_ip_to_authenticated_domain_request.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/associate_subuser_with_domain_request.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticate_domain_request.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_dkim.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_domain_spf.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_mail_server.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_subdomain_spf.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response_errors.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/email_dns_record_request.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_dkim1.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_mail_cname.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/update_authenticated_domain_request.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_dkim1.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_mail_cname.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_spf.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response_errors_inner.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/update_authenticated_domain.py create mode 100644 sendgrid/rest/api/domain_authentication/v3/validate_authenticated_domain.py create mode 100644 sendgrid/rest/api/email_activity/v3/__init__.py create mode 100644 sendgrid/rest/api/email_activity/v3/download_csv.py create mode 100644 sendgrid/rest/api/email_activity/v3/get_message.py create mode 100644 sendgrid/rest/api/email_activity/v3/list_message.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/__init__.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/abbv_message.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/bounce_type.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/bounce_type1.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/download_csv200_response.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/email_activity_response_base_props.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/event.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/event_name.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/event_name1.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/get_message404_response.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/get_message404_response_errors_inner.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/list_message200_response.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/list_message400_response.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/list_message400_response_errors_inner.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/list_message429_response.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/list_message429_response_errors_inner.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/message.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/outbound_ip_type.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/outbound_ip_type1.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/request_csv202_response.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/status.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/status1.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/status2.py create mode 100644 sendgrid/rest/api/email_activity/v3/models/status3.py create mode 100644 sendgrid/rest/api/email_activity/v3/request_csv.py create mode 100644 sendgrid/rest/api/email_validation/v3/__init__.py create mode 100644 sendgrid/rest/api/email_validation/v3/get_email_job_for_verification.py create mode 100644 sendgrid/rest/api/email_validation/v3/get_validations_email_jobs.py create mode 100644 sendgrid/rest/api/email_validation/v3/list_email_job_for_verification.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/__init__.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/error_response.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/file_type.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response_result_inner.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result_errors_inner.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/list_email_job_for_verification_request.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response_upload_headers_inner.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/status.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/status1.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email200_response.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_additional.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_domain.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_local_part.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/validate_email_request.py create mode 100644 sendgrid/rest/api/email_validation/v3/models/verdict.py create mode 100644 sendgrid/rest/api/email_validation/v3/validate_email.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/__init__.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/list_enforced_tls_setting.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/models/__init__.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/models/enforced_tls_request_response.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/models/error_response.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/models/version.py create mode 100644 sendgrid/rest/api/enforced_tls/v3/update_enforced_tls_setting.py create mode 100644 sendgrid/rest/api/integrations/v3/__init__.py create mode 100644 sendgrid/rest/api/integrations/v3/add_integration.py create mode 100644 sendgrid/rest/api/integrations/v3/delete_integration.py create mode 100644 sendgrid/rest/api/integrations/v3/find_integration_by_id.py create mode 100644 sendgrid/rest/api/integrations/v3/get_integrations_by_user.py create mode 100644 sendgrid/rest/api/integrations/v3/models/__init__.py create mode 100644 sendgrid/rest/api/integrations/v3/models/add_integration400_response.py create mode 100644 sendgrid/rest/api/integrations/v3/models/delete_integration400_response.py create mode 100644 sendgrid/rest/api/integrations/v3/models/delete_integration404_response.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination1.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination2.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination3.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination_region.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination_region1.py create mode 100644 sendgrid/rest/api/integrations/v3/models/destination_region2.py create mode 100644 sendgrid/rest/api/integrations/v3/models/forbidden.py create mode 100644 sendgrid/rest/api/integrations/v3/models/get_integrations_by_user200_response.py create mode 100644 sendgrid/rest/api/integrations/v3/models/get_integrations_by_user403_response.py create mode 100644 sendgrid/rest/api/integrations/v3/models/get_integrations_by_user500_response.py create mode 100644 sendgrid/rest/api/integrations/v3/models/id.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_filters.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_input.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_input_filters.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_input_properties.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_not_found.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_patch.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_patch_filters.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_patch_properties.py create mode 100644 sendgrid/rest/api/integrations/v3/models/integration_properties.py create mode 100644 sendgrid/rest/api/integrations/v3/models/internal_error.py create mode 100644 sendgrid/rest/api/integrations/v3/models/invalid_delete_request.py create mode 100644 sendgrid/rest/api/integrations/v3/models/invalid_request.py create mode 100644 sendgrid/rest/api/integrations/v3/models/items.py create mode 100644 sendgrid/rest/api/integrations/v3/models/items1.py create mode 100644 sendgrid/rest/api/integrations/v3/models/items2.py create mode 100644 sendgrid/rest/api/integrations/v3/update_integration.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/__init__.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/add_ip_to_allow_list.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/delete_allowed_ip.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/delete_allowed_ips.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/get_allowed_ip.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/list_access_activity.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/list_allowed_ip.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/__init__.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request_ips_inner.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/delete_allowed_ips_request.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/error_response.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx_result_inner.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response.py create mode 100644 sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response_result_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/__init__.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/add_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/add_ips_to_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/add_sub_users_to_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/create_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/delete_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/delete_ips_from_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/delete_sub_users_from_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/get_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/get_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/list_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/list_ip_assigned_to_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/list_ip_pool.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/list_sub_user_assigned_to_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/__init__.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/add_ip201_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/add_ip_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool201_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/delete_ips_from_ip_pool_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/delete_sub_users_from_ip_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response_pools_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response_ip_count_by_region_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response_errors_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/items.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata_next_params.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner_pools_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata_next_params.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_result_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata_next_params.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_result_inner.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata_next_params.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region1.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region2.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region3.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region4.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region5.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region6.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/region7.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/update_ip200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool200_response.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/models/update_ip_request.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/update_ip.py create mode 100644 sendgrid/rest/api/ip_address_management/v3/update_ip_pool.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/__init__.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/get_warm_up_ip.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/list_warm_up_ip.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/__init__.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response_errors_inner.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/ip_warmup200_inner.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response_errors_inner.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response_errors_inner.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip_request.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/stop_ip_warm_up.py create mode 100644 sendgrid/rest/api/ip_warmup/v3/warm_up_ip.py create mode 100644 sendgrid/rest/api/ips/v3/__init__.py create mode 100644 sendgrid/rest/api/ips/v3/add_ip.py create mode 100644 sendgrid/rest/api/ips/v3/add_ip_to_ip_pool.py create mode 100644 sendgrid/rest/api/ips/v3/create_ip_pool.py create mode 100644 sendgrid/rest/api/ips/v3/delete_ip_from_ip_pool.py create mode 100644 sendgrid/rest/api/ips/v3/delete_ip_pool.py create mode 100644 sendgrid/rest/api/ips/v3/get_ip.py create mode 100644 sendgrid/rest/api/ips/v3/get_ip_pool.py create mode 100644 sendgrid/rest/api/ips/v3/list_assigned_ip.py create mode 100644 sendgrid/rest/api/ips/v3/list_ip.py create mode 100644 sendgrid/rest/api/ips/v3/list_ip_pool.py create mode 100644 sendgrid/rest/api/ips/v3/list_remaining_ip_count.py create mode 100644 sendgrid/rest/api/ips/v3/models/__init__.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip201_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip201_response_ips_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip_request.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool201_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response_errors_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool_request.py create mode 100644 sendgrid/rest/api/ips/v3/models/create_ip_pool_request.py create mode 100644 sendgrid/rest/api/ips/v3/models/delete_ip_from_ip_pool404_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/delete_ip_pool404_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/error_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/get_ip200_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/get_ip_pool200_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/get_ip_pool404_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/get_ip_pool404_response_errors_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/ip_pools200.py create mode 100644 sendgrid/rest/api/ips/v3/models/list_assigned_ip200_response_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/list_ip200_response_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response_results_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/sort_by_direction.py create mode 100644 sendgrid/rest/api/ips/v3/models/update_ip_pool404_response.py create mode 100644 sendgrid/rest/api/ips/v3/models/update_ip_pool404_response_errors_inner.py create mode 100644 sendgrid/rest/api/ips/v3/models/update_ip_pool_request.py create mode 100644 sendgrid/rest/api/ips/v3/update_ip_pool.py create mode 100644 sendgrid/rest/api/link_branding/v3/__init__.py create mode 100644 sendgrid/rest/api/link_branding/v3/associate_branded_link_with_subuser.py create mode 100644 sendgrid/rest/api/link_branding/v3/create_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/delete_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/disassociate_branded_link_from_subuser.py create mode 100644 sendgrid/rest/api/link_branding/v3/get_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/list_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/list_default_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/list_subuser_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/__init__.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/associate_branded_link_with_subuser_request.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/create_branded_link_request.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/default.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/default1.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/default2.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/legacy.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/link_branding200.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/link_branding200_dns.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_domain_cname.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_owner_cname.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/region.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/type.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/type1.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/update_branded_link_request.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/valid.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/valid1.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/valid2.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/valid3.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/valid4.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/valid5.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_domain_cname.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_owner_cname.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response.py create mode 100644 sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response_errors_inner.py create mode 100644 sendgrid/rest/api/link_branding/v3/update_branded_link.py create mode 100644 sendgrid/rest/api/link_branding/v3/validate_branded_link.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/__init__.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/create_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/delete_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/get_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/get_scheduled_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/list_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/__init__.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/campaigns2xx.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/editor.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/error_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/get_campaign200_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/list_campaign200_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/post_campaigns_request.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_request.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/send_a_campaign_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/send_a_test_campaign_request.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/send_test_campaign_request.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/status.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/update_a_campaign_request.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_request.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/models/view_scheduled_time_of_a_campaign_response.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/schedule_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/send_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/send_test_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/un_schedule_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/update_campaign.py create mode 100644 sendgrid/rest/api/lmc_campaigns/v3/update_scheduled_campaign.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/__init__.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/add_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/add_recipient_to_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/add_recipients_to_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/create_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/create_custom_field.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/create_segment.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_lists.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_custom_field.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_recipient_from_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_recipients.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/delete_segment.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/get_billable.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/get_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/get_custom_field.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/get_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/get_recipient_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/get_segment.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_custom_field.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_recipient_count.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_recipient_for_segment.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_recipients_from_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_reserved_field.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_search_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_segment.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/list_status.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/__init__.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/add_recipient_request_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/and_or.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id2xx.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id_value.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_list2xx.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200_recipients_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_count200.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201_errors_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_conditions.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_id200.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/create_a_list_request.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/create_custom_field_request.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/delete_contacts.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/error_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/get_recipient_list200_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_all_custom_fields_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_all_lists_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_all_segments_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_from_contact_db_list200_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_on_a_segment_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response_reserved_fields_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response_status_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/operator.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner_value.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient_request.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/type.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/update_a_list_request.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/update_contact_db_list200_response.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/update_recipient_request_inner.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/models/update_segment_request.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/search_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/update_contact_db_list.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/update_recipient.py create mode 100644 sendgrid/rest/api/lmc_contactdb/v3/update_segment.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/__init__.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/create_sender.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/delete_sender.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/get_sender.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/list_sender.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/__init__.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response_errors_inner.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/create_sender_request.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/list_sender200_response.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/sender_id.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/sender_id_request.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_from.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_reply_to.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/reset_sender_verification.py create mode 100644 sendgrid/rest/api/lmc_senders/v3/update_sender.py create mode 100644 sendgrid/rest/api/mail/v3/__init__.py create mode 100644 sendgrid/rest/api/mail/v3/create_mail_batch.py create mode 100644 sendgrid/rest/api/mail/v3/get_mail_batch.py create mode 100644 sendgrid/rest/api/mail/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mail/v3/models/content_encoding.py create mode 100644 sendgrid/rest/api/mail/v3/models/disposition.py create mode 100644 sendgrid/rest/api/mail/v3/models/error_response.py create mode 100644 sendgrid/rest/api/mail/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/mail/v3/models/mail_batch_response.py create mode 100644 sendgrid/rest/api/mail/v3/models/mail_from.py create mode 100644 sendgrid/rest/api/mail/v3/models/mail_to.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_asm.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_attachments_inner.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_content_inner.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_bounce_management.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_list_management.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_spam_management.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_unsubscribe_management.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_footer.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_sandbox_mode.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_personalizations_inner.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_click_tracking.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_ganalytics.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_open_tracking.py create mode 100644 sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_subscription_tracking.py create mode 100644 sendgrid/rest/api/mail/v3/send_mail.py create mode 100644 sendgrid/rest/api/mail_settings/v3/__init__.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_address_whitelist.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_bounce_purge.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_footer.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_forward_bounce.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_forward_spam.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_mail_setting.py create mode 100644 sendgrid/rest/api/mail_settings/v3/list_template.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response_result_inner.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/mail_settings_address_whitelabel200.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/mail_settings_bounce_purge.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/mail_settings_footer.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_bounce.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_spam.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/mail_settings_template200.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/update_address_whitelist_request.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/update_template200_response.py create mode 100644 sendgrid/rest/api/mail_settings/v3/models/update_template_request.py create mode 100644 sendgrid/rest/api/mail_settings/v3/update_address_whitelist.py create mode 100644 sendgrid/rest/api/mail_settings/v3/update_bounce_purge.py create mode 100644 sendgrid/rest/api/mail_settings/v3/update_footer.py create mode 100644 sendgrid/rest/api/mail_settings/v3/update_forward_bounce.py create mode 100644 sendgrid/rest/api/mail_settings/v3/update_forward_spam.py create mode 100644 sendgrid/rest/api/mail_settings/v3/update_template.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/delete_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/delete_contact_identifier.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/export_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/get_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/get_contact_by_identifiers.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/get_export_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/get_import_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/import_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/list_batched_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/list_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/list_contact_by_email.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/list_contact_count.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/list_export_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contact_details3.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contact_export.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contact_import.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contact_import_results.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contact_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contact_request_custom_fields.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/contacts_error.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/delete_contact202_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/delete_contact400_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier202_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/error_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/export_contact202_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/export_contact_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/export_contact_request_notifications.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/file_type.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/file_type1.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response_result_value.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/get_import_contact400_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/identifier_type.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/identifier_type1.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response_upload_headers_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/import_contact400_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/import_contact404_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/import_contact_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_contact200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_contact400_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response_billable_breakdown.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_metadata.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_metadata.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_segments_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/search_contact200_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/search_contact_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/self_metadata.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/status.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/update_contact202_response.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/models/update_contact_request.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/search_contact.py create mode 100644 sendgrid/rest/api/mc_contacts/v3/update_contact.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/create_field_definition.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/delete_field_definition.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/list_field_definition.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition200_response.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition400_response.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition_request.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/custom_field_definitions_response.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/custom_fields_error.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/field_type.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/field_type1.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/field_type2.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/list_field_definition200_response.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/reserved_field_definitions_response_inner.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/models/update_field_definition_request.py create mode 100644 sendgrid/rest/api/mc_custom_fields/v3/update_field_definition.py create mode 100644 sendgrid/rest/api/mc_designs/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_designs/v3/create_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/delete_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/duplicate_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/duplicate_pre_built_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/get_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/get_pre_built_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/list_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/list_pre_built_design.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/api_error.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/api_errors.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/design_common_properties.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/design_duplicate_input.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/design_input.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/design_output.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/design_output_summary.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/editor.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/list_design200_response.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_designs/v3/models/update_design_request.py create mode 100644 sendgrid/rest/api/mc_designs/v3/update_design.py create mode 100644 sendgrid/rest/api/mc_lists/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_lists/v3/create_marketing_list.py create mode 100644 sendgrid/rest/api/mc_lists/v3/delete_contact.py create mode 100644 sendgrid/rest/api/mc_lists/v3/delete_marketing_list.py create mode 100644 sendgrid/rest/api/mc_lists/v3/get_marketing_list.py create mode 100644 sendgrid/rest/api/mc_lists/v3/list_contact_count.py create mode 100644 sendgrid/rest/api/mc_lists/v3/list_marketing_list.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/contact_details.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/create_marketing_list400_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/create_marketing_list_request.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/delete_contact202_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list200_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list404_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/error.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/get_marketing_list200_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/list.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/list_contact_count200_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/list_marketing_list200_response.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/self_metadata.py create mode 100644 sendgrid/rest/api/mc_lists/v3/models/update_marketing_list_request.py create mode 100644 sendgrid/rest/api/mc_lists/v3/update_marketing_list.py create mode 100644 sendgrid/rest/api/mc_segments/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_segments/v3/delete_segment.py create mode 100644 sendgrid/rest/api/mc_segments/v3/get_segment.py create mode 100644 sendgrid/rest/api/mc_segments/v3/list_segment.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/contact_response.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/contact_response_custom_fields.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/error_response.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/full_segment.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/get_segment404_response.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/get_segment404_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/list_segment200_response.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/list_segment500_response.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/list_segment500_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/segment_summary.py create mode 100644 sendgrid/rest/api/mc_segments/v3/models/segment_write_v2.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/create_segment.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/delete_segment.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/get_segment.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/list_segment.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/all_segments200.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/contact_response.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/contact_response_custom_fields.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2_errors_inner.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment2xx.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment_error.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh202.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh_request.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment_status_response.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment_update.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/models/segment_write_v2.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/refresh_segment.py create mode 100644 sendgrid/rest/api/mc_segments_2/v3/update_segment.py create mode 100644 sendgrid/rest/api/mc_senders/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_senders/v3/create_sender.py create mode 100644 sendgrid/rest/api/mc_senders/v3/delete_sender.py create mode 100644 sendgrid/rest/api/mc_senders/v3/get_sender.py create mode 100644 sendgrid/rest/api/mc_senders/v3/list_sender.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/create_sender_request.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/create_sender_request_from.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/create_sender_request_reply_to.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/error_response.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/list_sender200_response.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/sender.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/sender_request.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/sender_request_from.py create mode 100644 sendgrid/rest/api/mc_senders/v3/models/sender_request_reply_to.py create mode 100644 sendgrid/rest/api/mc_senders/v3/reset_sender_verification.py create mode 100644 sendgrid/rest/api/mc_senders/v3/update_sender.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/create_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/delete_scheduled_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/delete_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/delete_single_sends.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/duplicate_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/get_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/list_category.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/list_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/ab_test_summary.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/duplicate_single_send_request.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/editor.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/editor1.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/items.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/list_category200_response.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/list_single_send200_response.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send201_response.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send_request.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/search_single_send200_response.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_email_config.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_send_to.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_email_config.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_send_to.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_short.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_warnings_inner.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_schedule.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/singlesend_search.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/status.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/status1.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/status2.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/status3.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/type.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/models/winner_criteria.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/schedule_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/search_single_send.py create mode 100644 sendgrid/rest/api/mc_singlesends/v3/update_single_send.py create mode 100644 sendgrid/rest/api/mc_stats/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_stats/v3/export_automation_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/export_single_send_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/get_automation_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/get_single_send_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/list_automation_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/list_click_tracking_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/list_single_send_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/list_single_send_tracking_stat.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/ab_phase.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/ab_phase1.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/ab_phase_id.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/aggregated_by.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response_results_inner.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/automations_response.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/automations_response_results_inner.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/error_response.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/items.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/items1.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/items2.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/link_tracking_metadata.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/metadata.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/metrics.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response_results_inner.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/singlesends_response.py create mode 100644 sendgrid/rest/api/mc_stats/v3/models/singlesends_response_results_inner.py create mode 100644 sendgrid/rest/api/mc_test/v3/__init__.py create mode 100644 sendgrid/rest/api/mc_test/v3/models/__init__.py create mode 100644 sendgrid/rest/api/mc_test/v3/models/error_response.py create mode 100644 sendgrid/rest/api/mc_test/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/mc_test/v3/models/send_test_marketing_email_request.py create mode 100644 sendgrid/rest/api/mc_test/v3/send_test_marketing_email.py create mode 100644 sendgrid/rest/api/partner/v3/__init__.py create mode 100644 sendgrid/rest/api/partner/v3/list_partner_setting.py create mode 100644 sendgrid/rest/api/partner/v3/models/__init__.py create mode 100644 sendgrid/rest/api/partner/v3/models/list_partner_setting200_response.py create mode 100644 sendgrid/rest/api/partner/v3/models/list_partner_setting200_response_result_inner.py create mode 100644 sendgrid/rest/api/recipients_data_erasure/v3/__init__.py create mode 100644 sendgrid/rest/api/recipients_data_erasure/v3/erase_recipient_email_data.py create mode 100644 sendgrid/rest/api/recipients_data_erasure/v3/models/__init__.py create mode 100644 sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_erase_recipients_request.py create mode 100644 sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_error_v1.py create mode 100644 sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_job_id.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/__init__.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/delete_reverse_dns.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/get_reverse_dns.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/list_reverse_dns.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/__init__.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/reverse_dns.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_a_record.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_users_inner.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/set_up_reverse_dns_request.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/valid.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/valid1.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results_a_record.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response_errors_inner.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response_errors_inner.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/set_up_reverse_dns.py create mode 100644 sendgrid/rest/api/reverse_dns/v3/validate_reverse_dns.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/__init__.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/create_scheduled_send.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/delete_scheduled_send.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/get_scheduled_send.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/list_scheduled_send.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/__init__.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/cancel_or_pause_a_scheduled_send_request.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/error_response.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/mail_batch_id.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/scheduled_send_status.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/status.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/status1.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/status2.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/models/update_scheduled_send_request.py create mode 100644 sendgrid/rest/api/scheduled_sends/v3/update_scheduled_send.py create mode 100644 sendgrid/rest/api/scopes/v3/__init__.py create mode 100644 sendgrid/rest/api/scopes/v3/approve_scope_request.py create mode 100644 sendgrid/rest/api/scopes/v3/deny_scope_request.py create mode 100644 sendgrid/rest/api/scopes/v3/list_scope.py create mode 100644 sendgrid/rest/api/scopes/v3/list_scope_request.py create mode 100644 sendgrid/rest/api/scopes/v3/models/__init__.py create mode 100644 sendgrid/rest/api/scopes/v3/models/approve_scope_request200_response.py create mode 100644 sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response.py create mode 100644 sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response_errors_inner.py create mode 100644 sendgrid/rest/api/scopes/v3/models/error_response.py create mode 100644 sendgrid/rest/api/scopes/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/scopes/v3/models/list_scope200_response.py create mode 100644 sendgrid/rest/api/scopes/v3/models/list_scope401_response.py create mode 100644 sendgrid/rest/api/scopes/v3/models/list_scope401_response_errors_inner.py create mode 100644 sendgrid/rest/api/scopes/v3/models/list_scope_request200_response_inner.py create mode 100644 sendgrid/rest/api/seq/v3/__init__.py create mode 100644 sendgrid/rest/api/seq/v3/list_engagement_quality_score.py create mode 100644 sendgrid/rest/api/seq/v3/list_subuser_engagement_quality_score.py create mode 100644 sendgrid/rest/api/seq/v3/models/__init__.py create mode 100644 sendgrid/rest/api/seq/v3/models/seq_error.py create mode 100644 sendgrid/rest/api/seq/v3/models/seq_metadata.py create mode 100644 sendgrid/rest/api/seq/v3/models/seq_metadata_next_params.py create mode 100644 sendgrid/rest/api/seq/v3/models/seq_metrics.py create mode 100644 sendgrid/rest/api/seq/v3/models/seq_score.py create mode 100644 sendgrid/rest/api/sso/v3/__init__.py create mode 100644 sendgrid/rest/api/sso/v3/create_sso_certificate.py create mode 100644 sendgrid/rest/api/sso/v3/create_sso_integration.py create mode 100644 sendgrid/rest/api/sso/v3/create_sso_teammate.py create mode 100644 sendgrid/rest/api/sso/v3/delete_sso_certificate.py create mode 100644 sendgrid/rest/api/sso/v3/delete_sso_integration.py create mode 100644 sendgrid/rest/api/sso/v3/get_sso_certificate.py create mode 100644 sendgrid/rest/api/sso/v3/get_sso_integration.py create mode 100644 sendgrid/rest/api/sso/v3/list_sso_integration.py create mode 100644 sendgrid/rest/api/sso/v3/list_sso_integration_certificate.py create mode 100644 sendgrid/rest/api/sso/v3/models/__init__.py create mode 100644 sendgrid/rest/api/sso/v3/models/create_sso_certificate_request.py create mode 100644 sendgrid/rest/api/sso/v3/models/patch_sso_teammates200.py create mode 100644 sendgrid/rest/api/sso/v3/models/permission_type.py create mode 100644 sendgrid/rest/api/sso/v3/models/permission_type1.py create mode 100644 sendgrid/rest/api/sso/v3/models/persona.py create mode 100644 sendgrid/rest/api/sso/v3/models/post_patch_integration_request.py create mode 100644 sendgrid/rest/api/sso/v3/models/post_sso_teammates201.py create mode 100644 sendgrid/rest/api/sso/v3/models/post_sso_teammates_request.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_certificate_body.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_error_response_inner.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_integration.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props_subuser_access_inner.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_teammates_base_response_props.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props.py create mode 100644 sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props_subuser_access_inner.py create mode 100644 sendgrid/rest/api/sso/v3/models/update_sso_certificate_request.py create mode 100644 sendgrid/rest/api/sso/v3/models/user_type.py create mode 100644 sendgrid/rest/api/sso/v3/update_sso_certificate.py create mode 100644 sendgrid/rest/api/sso/v3/update_sso_integration.py create mode 100644 sendgrid/rest/api/sso/v3/update_sso_teammate.py create mode 100644 sendgrid/rest/api/stats/v3/__init__.py create mode 100644 sendgrid/rest/api/stats/v3/get_client_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_browser_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_category.py create mode 100644 sendgrid/rest/api/stats/v3/list_category_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_category_stat_sum.py create mode 100644 sendgrid/rest/api/stats/v3/list_client_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_device_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_geo_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_mailbox_provider_stat.py create mode 100644 sendgrid/rest/api/stats/v3/list_stat.py create mode 100644 sendgrid/rest/api/stats/v3/models/__init__.py create mode 100644 sendgrid/rest/api/stats/v3/models/advanced_stats_clicks.py create mode 100644 sendgrid/rest/api/stats/v3/models/advanced_stats_clicks_opens.py create mode 100644 sendgrid/rest/api/stats/v3/models/advanced_stats_mailbox_provider.py create mode 100644 sendgrid/rest/api/stats/v3/models/advanced_stats_opens.py create mode 100644 sendgrid/rest/api/stats/v3/models/aggregated_by.py create mode 100644 sendgrid/rest/api/stats/v3/models/aggregated_by1.py create mode 100644 sendgrid/rest/api/stats/v3/models/aggregated_by2.py create mode 100644 sendgrid/rest/api/stats/v3/models/aggregated_by3.py create mode 100644 sendgrid/rest/api/stats/v3/models/category_stats.py create mode 100644 sendgrid/rest/api/stats/v3/models/category_stats_stats_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/category_stats_stats_inner_metrics.py create mode 100644 sendgrid/rest/api/stats/v3/models/client_type.py create mode 100644 sendgrid/rest/api/stats/v3/models/country.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner_stats_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_category200_response_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_category400_response.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_category400_response_errors_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner_stats_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner_stats_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner_stats_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_stat200_response_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/list_stat200_response_inner_stats_inner.py create mode 100644 sendgrid/rest/api/stats/v3/models/sort_by_direction.py create mode 100644 sendgrid/rest/api/stats/v3/models/stats_advanced_global_stats.py create mode 100644 sendgrid/rest/api/subusers/v3/__init__.py create mode 100644 sendgrid/rest/api/subusers/v3/create_subuser.py create mode 100644 sendgrid/rest/api/subusers/v3/delete_subuser.py create mode 100644 sendgrid/rest/api/subusers/v3/get_subuser_credit.py create mode 100644 sendgrid/rest/api/subusers/v3/list_monthly_stat.py create mode 100644 sendgrid/rest/api/subusers/v3/list_reputation.py create mode 100644 sendgrid/rest/api/subusers/v3/list_stat.py create mode 100644 sendgrid/rest/api/subusers/v3/list_stat_sum.py create mode 100644 sendgrid/rest/api/subusers/v3/list_subuser.py create mode 100644 sendgrid/rest/api/subusers/v3/list_subuser_monthly_stat.py create mode 100644 sendgrid/rest/api/subusers/v3/models/__init__.py create mode 100644 sendgrid/rest/api/subusers/v3/models/aggregated_by.py create mode 100644 sendgrid/rest/api/subusers/v3/models/category_stats.py create mode 100644 sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner.py create mode 100644 sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner_metrics.py create mode 100644 sendgrid/rest/api/subusers/v3/models/create_subuser_request.py create mode 100644 sendgrid/rest/api/subusers/v3/models/error_response.py create mode 100644 sendgrid/rest/api/subusers/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/subusers/v3/models/list_reputation200_response_inner.py create mode 100644 sendgrid/rest/api/subusers/v3/models/region.py create mode 100644 sendgrid/rest/api/subusers/v3/models/region1.py create mode 100644 sendgrid/rest/api/subusers/v3/models/region2.py create mode 100644 sendgrid/rest/api/subusers/v3/models/region3.py create mode 100644 sendgrid/rest/api/subusers/v3/models/reset_frequency.py create mode 100644 sendgrid/rest/api/subusers/v3/models/reset_frequency1.py create mode 100644 sendgrid/rest/api/subusers/v3/models/sort_by_direction.py create mode 100644 sendgrid/rest/api/subusers/v3/models/sort_by_direction1.py create mode 100644 sendgrid/rest/api/subusers/v3/models/sort_by_direction2.py create mode 100644 sendgrid/rest/api/subusers/v3/models/sort_by_metric.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_credits.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_credits_request.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_post.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_post_credit_allocation.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_stats.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner.py create mode 100644 sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner_metrics.py create mode 100644 sendgrid/rest/api/subusers/v3/models/type.py create mode 100644 sendgrid/rest/api/subusers/v3/models/type1.py create mode 100644 sendgrid/rest/api/subusers/v3/models/update_subuser_ip200_response.py create mode 100644 sendgrid/rest/api/subusers/v3/models/update_subuser_remaining_credit_request.py create mode 100644 sendgrid/rest/api/subusers/v3/models/update_subuser_request.py create mode 100644 sendgrid/rest/api/subusers/v3/models/update_subuser_website_access_request.py create mode 100644 sendgrid/rest/api/subusers/v3/update_subuser.py create mode 100644 sendgrid/rest/api/subusers/v3/update_subuser_credit.py create mode 100644 sendgrid/rest/api/subusers/v3/update_subuser_ip.py create mode 100644 sendgrid/rest/api/subusers/v3/update_subuser_remaining_credit.py create mode 100644 sendgrid/rest/api/subusers/v3/update_subuser_website_access.py create mode 100644 sendgrid/rest/api/suppressions/v3/__init__.py create mode 100644 sendgrid/rest/api/suppressions/v3/add_suppression_to_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/creat_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/create_global_suppression.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_global_suppression.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_invalid_email.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_invalid_emails.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_spam_report.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_spam_reports.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_suppression_block.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_suppression_blocks.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_suppression_bounce.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_suppression_bounces.py create mode 100644 sendgrid/rest/api/suppressions/v3/delete_suppression_from_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_asm_suppression.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_global_suppression.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_invalid_email.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_spam_report.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_suppression_block.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_suppression_bounces.py create mode 100644 sendgrid/rest/api/suppressions/v3/get_suppression_bounces_classifications.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_asm_suppression.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_global_suppression.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_invalid_email.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_spam_report.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_suppression_block.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_suppression_bounces.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_suppression_bounces_classifications.py create mode 100644 sendgrid/rest/api/suppressions/v3/list_suppression_from_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/__init__.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/accept.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/accept1.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/add_suppression_to_asm_group201_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/blocks_response_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/bounce_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/classification.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/classification1.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/creat_asm_group201_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/create_global_suppression201_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/delete_invalid_emails_request.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/delete_spam_reports_request.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/delete_suppression_blocks_request.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/delete_suppression_bounces_request.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/error_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/get_asm_group200_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response_suppressions_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner_stats_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/invalid_email.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/list_asm_suppression200_response_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/list_global_suppression200_response_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner_stats_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/retrieve_a_global_suppression_response.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/spam_reports_response_inner.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/suppression_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/suppression_group_request_base_props.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/suppressions_request.py create mode 100644 sendgrid/rest/api/suppressions/v3/models/update_asm_group_request.py create mode 100644 sendgrid/rest/api/suppressions/v3/search_suppression_from_asm_group.py create mode 100644 sendgrid/rest/api/suppressions/v3/update_asm_group.py create mode 100644 sendgrid/rest/api/teammates/v3/__init__.py create mode 100644 sendgrid/rest/api/teammates/v3/delete_pending_teammate.py create mode 100644 sendgrid/rest/api/teammates/v3/delete_teammate.py create mode 100644 sendgrid/rest/api/teammates/v3/get_teammate.py create mode 100644 sendgrid/rest/api/teammates/v3/invite_teammate.py create mode 100644 sendgrid/rest/api/teammates/v3/list_pending_teammate.py create mode 100644 sendgrid/rest/api/teammates/v3/list_subuser_by_template.py create mode 100644 sendgrid/rest/api/teammates/v3/list_teammate.py create mode 100644 sendgrid/rest/api/teammates/v3/models/__init__.py create mode 100644 sendgrid/rest/api/teammates/v3/models/get_teammate200_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/invite_teammate201_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/invite_teammate400_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/invite_teammate400_response_errors_inner.py create mode 100644 sendgrid/rest/api/teammates/v3/models/invite_teammate_request.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response_result_inner.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata_next_params.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_subuser_access_inner.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response_errors_inner.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_teammate200_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/list_teammate200_response_result_inner.py create mode 100644 sendgrid/rest/api/teammates/v3/models/permission_type.py create mode 100644 sendgrid/rest/api/teammates/v3/models/resend_teammate_invite200_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/update_teammate200_response.py create mode 100644 sendgrid/rest/api/teammates/v3/models/update_teammate_request.py create mode 100644 sendgrid/rest/api/teammates/v3/models/user_type.py create mode 100644 sendgrid/rest/api/teammates/v3/models/user_type1.py create mode 100644 sendgrid/rest/api/teammates/v3/models/user_type2.py create mode 100644 sendgrid/rest/api/teammates/v3/resend_teammate_invite.py create mode 100644 sendgrid/rest/api/teammates/v3/update_teammate.py create mode 100644 sendgrid/rest/api/templates/v3/__init__.py create mode 100644 sendgrid/rest/api/templates/v3/activate_template_version.py create mode 100644 sendgrid/rest/api/templates/v3/create_template.py create mode 100644 sendgrid/rest/api/templates/v3/create_template_version.py create mode 100644 sendgrid/rest/api/templates/v3/delete_template.py create mode 100644 sendgrid/rest/api/templates/v3/delete_template_version.py create mode 100644 sendgrid/rest/api/templates/v3/duplicate_template.py create mode 100644 sendgrid/rest/api/templates/v3/get_template.py create mode 100644 sendgrid/rest/api/templates/v3/get_template_version.py create mode 100644 sendgrid/rest/api/templates/v3/list_template.py create mode 100644 sendgrid/rest/api/templates/v3/models/__init__.py create mode 100644 sendgrid/rest/api/templates/v3/models/active.py create mode 100644 sendgrid/rest/api/templates/v3/models/active1.py create mode 100644 sendgrid/rest/api/templates/v3/models/create_template_request.py create mode 100644 sendgrid/rest/api/templates/v3/models/duplicate_template_request.py create mode 100644 sendgrid/rest/api/templates/v3/models/editor.py create mode 100644 sendgrid/rest/api/templates/v3/models/editor1.py create mode 100644 sendgrid/rest/api/templates/v3/models/generation.py create mode 100644 sendgrid/rest/api/templates/v3/models/generation1.py create mode 100644 sendgrid/rest/api/templates/v3/models/generations.py create mode 100644 sendgrid/rest/api/templates/v3/models/list_template200_response.py create mode 100644 sendgrid/rest/api/templates/v3/models/list_template400_response.py create mode 100644 sendgrid/rest/api/templates/v3/models/list_template400_response_errors_inner.py create mode 100644 sendgrid/rest/api/templates/v3/models/metadata.py create mode 100644 sendgrid/rest/api/templates/v3/models/transactional_template.py create mode 100644 sendgrid/rest/api/templates/v3/models/transactional_template_version_create.py create mode 100644 sendgrid/rest/api/templates/v3/models/transactional_template_version_output.py create mode 100644 sendgrid/rest/api/templates/v3/models/transactional_template_warning.py create mode 100644 sendgrid/rest/api/templates/v3/models/transactional_templates_template_lean.py create mode 100644 sendgrid/rest/api/templates/v3/models/transactional_templates_version_output_lean.py create mode 100644 sendgrid/rest/api/templates/v3/models/update_template_request.py create mode 100644 sendgrid/rest/api/templates/v3/update_template.py create mode 100644 sendgrid/rest/api/templates/v3/update_template_version.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/__init__.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/list_click_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/list_google_analytics_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/list_open_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/list_subscription_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/list_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/__init__.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/click_tracking.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/google_analytics_settings.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/list_open_tracking_setting200_response.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response_result_inner.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/subscription_tracking_settings.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/update_click_tracking_setting_request.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/models/update_open_tracking_setting_request.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/update_click_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/update_google_analytics_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/update_open_tracking_setting.py create mode 100644 sendgrid/rest/api/tracking_settings/v3/update_subscription_tracking_setting.py create mode 100644 sendgrid/rest/api/user/v3/__init__.py create mode 100644 sendgrid/rest/api/user/v3/list_account.py create mode 100644 sendgrid/rest/api/user/v3/list_credit.py create mode 100644 sendgrid/rest/api/user/v3/list_email.py create mode 100644 sendgrid/rest/api/user/v3/list_profile.py create mode 100644 sendgrid/rest/api/user/v3/list_username.py create mode 100644 sendgrid/rest/api/user/v3/models/__init__.py create mode 100644 sendgrid/rest/api/user/v3/models/error_response.py create mode 100644 sendgrid/rest/api/user/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/user/v3/models/get_user_account_response.py create mode 100644 sendgrid/rest/api/user/v3/models/get_user_profile_response.py create mode 100644 sendgrid/rest/api/user/v3/models/list_credit200_response.py create mode 100644 sendgrid/rest/api/user/v3/models/list_email200_response.py create mode 100644 sendgrid/rest/api/user/v3/models/list_username200_response.py create mode 100644 sendgrid/rest/api/user/v3/models/type.py create mode 100644 sendgrid/rest/api/user/v3/models/update_email200_response.py create mode 100644 sendgrid/rest/api/user/v3/models/update_email_request.py create mode 100644 sendgrid/rest/api/user/v3/models/update_password_request.py create mode 100644 sendgrid/rest/api/user/v3/models/update_username200_response.py create mode 100644 sendgrid/rest/api/user/v3/models/update_username_request.py create mode 100644 sendgrid/rest/api/user/v3/models/user_profile.py create mode 100644 sendgrid/rest/api/user/v3/update_email.py create mode 100644 sendgrid/rest/api/user/v3/update_password.py create mode 100644 sendgrid/rest/api/user/v3/update_profile.py create mode 100644 sendgrid/rest/api/user/v3/update_username.py create mode 100644 sendgrid/rest/api/verified_senders/v3/__init__.py create mode 100644 sendgrid/rest/api/verified_senders/v3/create_verified_sender.py create mode 100644 sendgrid/rest/api/verified_senders/v3/delete_verified_sender.py create mode 100644 sendgrid/rest/api/verified_senders/v3/list_verified_sender.py create mode 100644 sendgrid/rest/api/verified_senders/v3/list_verified_sender_domain.py create mode 100644 sendgrid/rest/api/verified_senders/v3/list_verified_sender_steps_completed.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/__init__.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response_errors_inner.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response_errors_inner.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender404_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/error_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/list_verified_sender200_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response_results.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response_results.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/verified_sender_request.py create mode 100644 sendgrid/rest/api/verified_senders/v3/models/verified_sender_response.py create mode 100644 sendgrid/rest/api/verified_senders/v3/resend_verified_sender.py create mode 100644 sendgrid/rest/api/verified_senders/v3/update_verified_sender.py create mode 100644 sendgrid/rest/api/verified_senders/v3/verify_sender_token.py create mode 100644 sendgrid/rest/api/webhooks/v3/__init__.py create mode 100644 sendgrid/rest/api/webhooks/v3/create_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/create_parse_setting.py create mode 100644 sendgrid/rest/api/webhooks/v3/delete_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/delete_parse_setting.py create mode 100644 sendgrid/rest/api/webhooks/v3/get_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/get_parse_setting.py create mode 100644 sendgrid/rest/api/webhooks/v3/get_signed_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/list_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/list_parse_setting.py create mode 100644 sendgrid/rest/api/webhooks/v3/list_parse_static.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/__init__.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/aggregated_by.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response_errors_inner.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/error_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/error_response_errors_inner.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_all_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_base_response_props.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_date_response_props.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_no_dates_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_oauth_response_props.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_request.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response_prop.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_test_request.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/event_webhook_unsigned_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook200_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response_errors_inner.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/list_parse_setting200_response.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner_metrics.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/parse_setting.py create mode 100644 sendgrid/rest/api/webhooks/v3/models/update_signed_event_webhook_request.py create mode 100644 sendgrid/rest/api/webhooks/v3/test_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/update_event_webhook.py create mode 100644 sendgrid/rest/api/webhooks/v3/update_parse_setting.py create mode 100644 sendgrid/rest/api/webhooks/v3/update_signed_event_webhook.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 4415a03f..f2e33199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ # Change Log All notable changes to this project will be documented in this file. +[2024-10-04] Version 7.0.0-rc.1 +--------------------------- +- Releasing autogenerated code for python from sendgrid open api specification. + +[2024-10-04] Version 7.0.0-rc.0 +--------------------------- +- Release Candidate preparation. + + [2023-12-01] Version 6.11.0 --------------------------- **Library - Feature** diff --git a/README.md b/README.md index 663d1e97..8a0a44f1 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,30 @@ pip install sendgrid The following is the minimum needed code to send an email with the [/mail/send Helper](sendgrid/helpers/mail) ([here](examples/helpers/mail_example.py#L9) is a full example): +### Send Email using Auto generated code +```python +from sendgrid.client import Client + +from sendgrid.rest.api.mail.v3.send_mail import SendMail +from sendgrid.rest.api.mail.v3.models import (MailTo, MailFrom, SendMailRequestPersonalizationsInner, + SendMailRequestContentInner, SendMailRequest) + + +client = Client(api_key='api_key') + +mail_to_list = [MailTo(email="to_email", name="to_name")] +personalization = [SendMailRequestPersonalizationsInner(to=mail_to_list, subject="Message")] + +send_mail_request = SendMailRequest( + personalizations=personalization, + var_from=MailFrom(email="from_email", name="from_name"), + content=[SendMailRequestContentInner(type="text/plain", value="Body")]) + +send_mail = SendMail(client) +response = send_mail.send(send_mail_request=send_mail_request) +print(response) +``` + ### With Mail Helper Class ```python diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 00000000..01b45203 --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,11 @@ +# Upgrade Guide + +_`MAJOR` version bumps will have upgrade notes posted here._ + +[2024-10-XX] 6.x.x to 7.x.x-rc.x +-------------------------------- +### Overview + +#### Sendgrid Python Helper Library’s version 7.0.0-rc.x is now available. + +Behind the scenes Python Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages. \ No newline at end of file diff --git a/sendgrid/rest/api/account_provisioning/v3/__init__.py b/sendgrid/rest/api/account_provisioning/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/account_provisioning/v3/authenticate_account.py b/sendgrid/rest/api/account_provisioning/v3/authenticate_account.py new file mode 100644 index 00000000..7e468fc0 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/authenticate_account.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class AuthenticateAccount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + account_id: str, + ): + path = "/v3/partners/accounts/{accountID}/sso" + path = path.format( + account_id=account_id, + ) + + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/create_account.py b/sendgrid/rest/api/account_provisioning/v3/create_account.py new file mode 100644 index 00000000..4b9cc570 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/create_account.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.account_provisioning.v3.models.create_account_params import ( + CreateAccountParams, +) + + +class CreateAccount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + t_test_account: Optional[str] = None, + create_account_params: Optional[CreateAccountParams] = None, + ): + path = "/v3/partners/accounts" + + headers = values.of( + { + "T-Test-Account": t_test_account, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_account_params: + data = create_account_params.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/delete_account.py b/sendgrid/rest/api/account_provisioning/v3/delete_account.py new file mode 100644 index 00000000..3ea83b49 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/delete_account.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteAccount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + account_id: str, + ): + path = "/v3/partners/accounts/{accountID}" + path = path.format( + account_id=account_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/get_account_state.py b/sendgrid/rest/api/account_provisioning/v3/get_account_state.py new file mode 100644 index 00000000..704e4d07 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/get_account_state.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetAccountState: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + account_id: str, + ): + path = "/v3/partners/accounts/{accountID}/state" + path = path.format( + account_id=account_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/list_account.py b/sendgrid/rest/api/account_provisioning/v3/list_account.py new file mode 100644 index 00000000..a7f13b01 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/list_account.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAccount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + offset: Optional[str] = None, + limit: Optional[int] = None, + ): + path = "/v3/partners/accounts" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/list_account_offering.py b/sendgrid/rest/api/account_provisioning/v3/list_account_offering.py new file mode 100644 index 00000000..2cc7e548 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/list_account_offering.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListAccountOffering: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + account_id: str, + ): + path = "/v3/partners/accounts/{accountID}/offerings" + path = path.format( + account_id=account_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/list_offering.py b/sendgrid/rest/api/account_provisioning/v3/list_offering.py new file mode 100644 index 00000000..ad6a4af3 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/list_offering.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListOffering: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/partners/offerings" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/__init__.py b/sendgrid/rest/api/account_provisioning/v3/models/__init__.py new file mode 100644 index 00000000..e19c8c27 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/__init__.py @@ -0,0 +1,80 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.account_provisioning.v3.models.account_list import AccountList +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_account import ( + AccountProvisioningAccount, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_account_id import ( + AccountProvisioningAccountId, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_catalog import ( + AccountProvisioningCatalog, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_offering_list import ( + AccountProvisioningOfferingList, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_offering_v1 import ( + AccountProvisioningOfferingV1, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_pagination import ( + AccountProvisioningPagination, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_profile import ( + AccountProvisioningProfile, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_state_read import ( + AccountProvisioningStateRead, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_state_write import ( + AccountProvisioningStateWrite, +) +from sendgrid.rest.api.account_provisioning.v3.models.catalog_entry import CatalogEntry +from sendgrid.rest.api.account_provisioning.v3.models.catalog_entry_entitlements import ( + CatalogEntryEntitlements, +) +from sendgrid.rest.api.account_provisioning.v3.models.create_account_params import ( + CreateAccountParams, +) +from sendgrid.rest.api.account_provisioning.v3.models.error_response import ( + ErrorResponse, +) +from sendgrid.rest.api.account_provisioning.v3.models.offerings_to_add import ( + OfferingsToAdd, +) +from sendgrid.rest.api.account_provisioning.v3.models.state import State +from sendgrid.rest.api.account_provisioning.v3.models.state1 import State1 +from sendgrid.rest.api.account_provisioning.v3.models.type import Type + +__all__ = [ + "AccountList", + "AccountProvisioningAccount", + "AccountProvisioningAccountId", + "AccountProvisioningCatalog", + "AccountProvisioningOfferingList", + "AccountProvisioningOfferingV1", + "AccountProvisioningPagination", + "AccountProvisioningProfile", + "AccountProvisioningStateRead", + "AccountProvisioningStateWrite", + "CatalogEntry", + "CatalogEntryEntitlements", + "CreateAccountParams", + "ErrorResponse", + "OfferingsToAdd", + "State", + "State1", + "Type", +] +# Testing code diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_list.py b/sendgrid/rest/api/account_provisioning/v3/models/account_list.py new file mode 100644 index 00000000..9ab28cb4 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_list.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_account import ( + AccountProvisioningAccount, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_pagination import ( + AccountProvisioningPagination, +) + + +class AccountList: + def __init__( + self, + accounts: Optional[List[AccountProvisioningAccount]] = None, + pages: Optional[AccountProvisioningPagination] = None, + ): + self.accounts = accounts + self.pages = pages + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"accounts": self.accounts, "pages": self.pages}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountList(accounts=payload.get("accounts"), pages=payload.get("pages")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account.py new file mode 100644 index 00000000..2710c05b --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AccountProvisioningAccount: + def __init__(self, id: Optional[str] = None, created_at: Optional[datetime] = None): + self.id = id + self.created_at = created_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"id": self.id, "created_at": self.created_at}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningAccount( + id=payload.get("id"), created_at=payload.get("created_at") + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account_id.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account_id.py new file mode 100644 index 00000000..af76163b --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_account_id.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AccountProvisioningAccountId: + def __init__(self, account_id: Optional[str] = None): + self.account_id = account_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"account_id": self.account_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningAccountId(account_id=payload.get("account_id")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_catalog.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_catalog.py new file mode 100644 index 00000000..1f818485 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_catalog.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.catalog_entry import CatalogEntry + + +class AccountProvisioningCatalog: + def __init__(self, catalog: Optional[List[CatalogEntry]] = None): + self.catalog = catalog + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"catalog": self.catalog}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningCatalog(catalog=payload.get("catalog")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_list.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_list.py new file mode 100644 index 00000000..371db5c9 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_list.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_offering_v1 import ( + AccountProvisioningOfferingV1, +) + + +class AccountProvisioningOfferingList: + def __init__(self, offerings: Optional[List[AccountProvisioningOfferingV1]] = None): + self.offerings = offerings + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"offerings": self.offerings}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningOfferingList(offerings=payload.get("offerings")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_v1.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_v1.py new file mode 100644 index 00000000..9b362d39 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_offering_v1.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.type import Type + + +class AccountProvisioningOfferingV1: + def __init__( + self, + name: Optional[str] = None, + type: Optional[Type] = None, + quantity: Optional[int] = None, + ): + self.name = name + self.type = type + self.quantity = quantity + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "type": self.type, + "quantity": self.quantity, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningOfferingV1( + name=payload.get("name"), + type=payload.get("type"), + quantity=payload.get("quantity"), + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_pagination.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_pagination.py new file mode 100644 index 00000000..378dd596 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_pagination.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AccountProvisioningPagination: + def __init__(self, last: Optional[str] = None, example: Optional[object] = None): + self.last = last + self.example = example + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"last": self.last, "example": self.example}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningPagination( + last=payload.get("last"), example=payload.get("example") + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_profile.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_profile.py new file mode 100644 index 00000000..47edf9fe --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_profile.py @@ -0,0 +1,53 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AccountProvisioningProfile: + def __init__( + self, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + company_name: Optional[str] = None, + company_website: Optional[str] = None, + email: Optional[str] = None, + phone: Optional[str] = None, + timezone: Optional[str] = None, + ): + self.first_name = first_name + self.last_name = last_name + self.company_name = company_name + self.company_website = company_website + self.email = email + self.phone = phone + self.timezone = timezone + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "first_name": self.first_name, + "last_name": self.last_name, + "company_name": self.company_name, + "company_website": self.company_website, + "email": self.email, + "phone": self.phone, + "timezone": self.timezone, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningProfile( + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + company_name=payload.get("company_name"), + company_website=payload.get("company_website"), + email=payload.get("email"), + phone=payload.get("phone"), + timezone=payload.get("timezone"), + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_read.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_read.py new file mode 100644 index 00000000..890ef894 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_read.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.state import State + + +class AccountProvisioningStateRead: + def __init__(self, state: Optional[State] = None): + self.state = state + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"state": self.state}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningStateRead(state=payload.get("state")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_write.py b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_write.py new file mode 100644 index 00000000..c026516e --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/account_provisioning_state_write.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.state1 import State1 + + +class AccountProvisioningStateWrite: + def __init__(self, state: Optional[State1] = None): + self.state = state + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"state": self.state}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AccountProvisioningStateWrite(state=payload.get("state")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/catalog_entry.py b/sendgrid/rest/api/account_provisioning/v3/models/catalog_entry.py new file mode 100644 index 00000000..d87c5666 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/catalog_entry.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_offering_v1 import ( + AccountProvisioningOfferingV1, +) +from sendgrid.rest.api.account_provisioning.v3.models.catalog_entry_entitlements import ( + CatalogEntryEntitlements, +) + + +class CatalogEntry: + def __init__( + self, + offering: Optional[AccountProvisioningOfferingV1] = None, + entitlements: Optional[CatalogEntryEntitlements] = None, + ): + self.offering = offering + self.entitlements = entitlements + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "offering": self.offering, + "entitlements": self.entitlements, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CatalogEntry( + offering=payload.get("offering"), entitlements=payload.get("entitlements") + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/catalog_entry_entitlements.py b/sendgrid/rest/api/account_provisioning/v3/models/catalog_entry_entitlements.py new file mode 100644 index 00000000..64598d22 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/catalog_entry_entitlements.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CatalogEntryEntitlements: + def __init__( + self, + email_sends_max_monthly: Optional[int] = None, + ip_count: Optional[int] = None, + teammates_max_total: Optional[int] = None, + users_max_total: Optional[int] = None, + ): + self.email_sends_max_monthly = email_sends_max_monthly + self.ip_count = ip_count + self.teammates_max_total = teammates_max_total + self.users_max_total = users_max_total + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email_sends_max_monthly": self.email_sends_max_monthly, + "ip_count": self.ip_count, + "teammates_max_total": self.teammates_max_total, + "users_max_total": self.users_max_total, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CatalogEntryEntitlements( + email_sends_max_monthly=payload.get("email_sends_max_monthly"), + ip_count=payload.get("ip_count"), + teammates_max_total=payload.get("teammates_max_total"), + users_max_total=payload.get("users_max_total"), + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/create_account_params.py b/sendgrid/rest/api/account_provisioning/v3/models/create_account_params.py new file mode 100644 index 00000000..7f220d54 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/create_account_params.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_offering_v1 import ( + AccountProvisioningOfferingV1, +) +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_profile import ( + AccountProvisioningProfile, +) + + +class CreateAccountParams: + def __init__( + self, + profile: Optional[AccountProvisioningProfile] = None, + offerings: Optional[List[AccountProvisioningOfferingV1]] = None, + ): + self.profile = profile + self.offerings = offerings + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "profile": self.profile, + "offerings": self.offerings, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateAccountParams( + profile=payload.get("profile"), offerings=payload.get("offerings") + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/error_response.py b/sendgrid/rest/api/account_provisioning/v3/models/error_response.py new file mode 100644 index 00000000..961d1df8 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/error_response.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponse: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + error_id: Optional[str] = None, + ): + self.message = message + self.field = field + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse( + message=payload.get("message"), + field=payload.get("field"), + error_id=payload.get("error_id"), + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/offerings_to_add.py b/sendgrid/rest/api/account_provisioning/v3/models/offerings_to_add.py new file mode 100644 index 00000000..30c5237d --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/offerings_to_add.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_offering_v1 import ( + AccountProvisioningOfferingV1, +) + + +class OfferingsToAdd: + def __init__(self, offerings: Optional[List[AccountProvisioningOfferingV1]] = None): + self.offerings = offerings + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"offerings": self.offerings}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return OfferingsToAdd(offerings=payload.get("offerings")) diff --git a/sendgrid/rest/api/account_provisioning/v3/models/state.py b/sendgrid/rest/api/account_provisioning/v3/models/state.py new file mode 100644 index 00000000..6e11eb0e --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/state.py @@ -0,0 +1,10 @@ +from enum import Enum +from enum import Enum + + +class State(Enum): + ACTIVATED = "activated" + DEACTIVATED = "deactivated" + SUSPENDED = "suspended" + BANNED = "banned" + INDETERMINATE = "indeterminate" diff --git a/sendgrid/rest/api/account_provisioning/v3/models/state1.py b/sendgrid/rest/api/account_provisioning/v3/models/state1.py new file mode 100644 index 00000000..718901c4 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/state1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class State1(Enum): + ACTIVATED = "activated" + DEACTIVATED = "deactivated" diff --git a/sendgrid/rest/api/account_provisioning/v3/models/type.py b/sendgrid/rest/api/account_provisioning/v3/models/type.py new file mode 100644 index 00000000..9bfff196 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/models/type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + PACKAGE = "package" + ADDON = "addon" diff --git a/sendgrid/rest/api/account_provisioning/v3/update_account_offering.py b/sendgrid/rest/api/account_provisioning/v3/update_account_offering.py new file mode 100644 index 00000000..2b4a8208 --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/update_account_offering.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.account_provisioning.v3.models.offerings_to_add import ( + OfferingsToAdd, +) + + +class UpdateAccountOffering: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + account_id: str, + offerings_to_add: Optional[OfferingsToAdd] = None, + ): + path = "/v3/partners/accounts/{accountID}/offerings" + path = path.format( + account_id=account_id, + ) + + data = None + if offerings_to_add: + data = offerings_to_add.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/account_provisioning/v3/update_account_state.py b/sendgrid/rest/api/account_provisioning/v3/update_account_state.py new file mode 100644 index 00000000..7dc9440b --- /dev/null +++ b/sendgrid/rest/api/account_provisioning/v3/update_account_state.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Account Provisioning API + The Twilio SendGrid Account Provisioning API provides a platform for Twilio SendGrid resellers to manage their customer accounts. This API is for companies that have a formal reseller partnership with Twilio SendGrid. You can access Twilio SendGrid sub-account functionality without becoming a reseller. If you require sub-account functionality, see the Twilio [SendGrid Subusers](https://docs.sendgrid.com/ui/account-and-settings/subusers) feature, which is available with [Pro and Premier plans](https://sendgrid.com/pricing/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.account_provisioning.v3.models.account_provisioning_state_write import ( + AccountProvisioningStateWrite, +) + + +class UpdateAccountState: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + account_id: str, + account_provisioning_state_write: Optional[ + AccountProvisioningStateWrite + ] = None, + ): + path = "/v3/partners/accounts/{accountID}/state" + path = path.format( + account_id=account_id, + ) + + data = None + if account_provisioning_state_write: + data = account_provisioning_state_write.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/alerts/v3/__init__.py b/sendgrid/rest/api/alerts/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/alerts/v3/create_alert.py b/sendgrid/rest/api/alerts/v3/create_alert.py new file mode 100644 index 00000000..6455cc23 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/create_alert.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Alerts API + The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.alerts.v3.models.create_alert_request import CreateAlertRequest + + +class CreateAlert: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_alert_request: Optional[CreateAlertRequest] = None, + ): + path = "/v3/alerts" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_alert_request: + data = create_alert_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/alerts/v3/delete_alert.py b/sendgrid/rest/api/alerts/v3/delete_alert.py new file mode 100644 index 00000000..f33d05bc --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/delete_alert.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Alerts API + The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteAlert: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + alert_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/alerts/{alert_id}" + path = path.format( + alert_id=alert_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/alerts/v3/get_alert.py b/sendgrid/rest/api/alerts/v3/get_alert.py new file mode 100644 index 00000000..492e599f --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/get_alert.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Alerts API + The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetAlert: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + alert_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/alerts/{alert_id}" + path = path.format( + alert_id=alert_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/alerts/v3/list_alert.py b/sendgrid/rest/api/alerts/v3/list_alert.py new file mode 100644 index 00000000..22711d49 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/list_alert.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Alerts API + The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAlert: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/alerts" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/alerts/v3/models/__init__.py b/sendgrid/rest/api/alerts/v3/models/__init__.py new file mode 100644 index 00000000..e75a6dfc --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/__init__.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Alerts API + The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.alerts.v3.models.create_alert201_response import ( + CreateAlert201Response, +) +from sendgrid.rest.api.alerts.v3.models.create_alert_request import CreateAlertRequest +from sendgrid.rest.api.alerts.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.alerts.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.alerts.v3.models.get_alert200_response import GetAlert200Response +from sendgrid.rest.api.alerts.v3.models.list_alert200_response_inner import ( + ListAlert200ResponseInner, +) +from sendgrid.rest.api.alerts.v3.models.type import Type +from sendgrid.rest.api.alerts.v3.models.type1 import Type1 +from sendgrid.rest.api.alerts.v3.models.type2 import Type2 +from sendgrid.rest.api.alerts.v3.models.type3 import Type3 +from sendgrid.rest.api.alerts.v3.models.update_alert200_response import ( + UpdateAlert200Response, +) +from sendgrid.rest.api.alerts.v3.models.update_alert_request import UpdateAlertRequest + +__all__ = [ + "CreateAlert201Response", + "CreateAlertRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "GetAlert200Response", + "ListAlert200ResponseInner", + "Type", + "Type1", + "Type2", + "Type3", + "UpdateAlert200Response", + "UpdateAlertRequest", +] +# Testing code diff --git a/sendgrid/rest/api/alerts/v3/models/create_alert201_response.py b/sendgrid/rest/api/alerts/v3/models/create_alert201_response.py new file mode 100644 index 00000000..620fc224 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/create_alert201_response.py @@ -0,0 +1,53 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateAlert201Response: + def __init__( + self, + created_at: Optional[int] = None, + email_to: Optional[str] = None, + frequency: Optional[str] = None, + id: Optional[int] = None, + type: Optional[str] = None, + updated_at: Optional[int] = None, + percentage: Optional[int] = None, + ): + self.created_at = created_at + self.email_to = email_to + self.frequency = frequency + self.id = id + self.type = type + self.updated_at = updated_at + self.percentage = percentage + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created_at": self.created_at, + "email_to": self.email_to, + "frequency": self.frequency, + "id": self.id, + "type": self.type, + "updated_at": self.updated_at, + "percentage": self.percentage, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateAlert201Response( + created_at=payload.get("created_at"), + email_to=payload.get("email_to"), + frequency=payload.get("frequency"), + id=payload.get("id"), + type=payload.get("type"), + updated_at=payload.get("updated_at"), + percentage=payload.get("percentage"), + ) diff --git a/sendgrid/rest/api/alerts/v3/models/create_alert_request.py b/sendgrid/rest/api/alerts/v3/models/create_alert_request.py new file mode 100644 index 00000000..7ff0c3d7 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/create_alert_request.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.alerts.v3.models.type import Type + + +class CreateAlertRequest: + def __init__( + self, + type: Optional[Type] = None, + email_to: Optional[str] = None, + frequency: Optional[str] = None, + percentage: Optional[int] = None, + ): + self.type = type + self.email_to = email_to + self.frequency = frequency + self.percentage = percentage + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "email_to": self.email_to, + "frequency": self.frequency, + "percentage": self.percentage, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateAlertRequest( + type=payload.get("type"), + email_to=payload.get("email_to"), + frequency=payload.get("frequency"), + percentage=payload.get("percentage"), + ) diff --git a/sendgrid/rest/api/alerts/v3/models/error_response.py b/sendgrid/rest/api/alerts/v3/models/error_response.py new file mode 100644 index 00000000..3d092049 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.alerts.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/alerts/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/alerts/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/alerts/v3/models/get_alert200_response.py b/sendgrid/rest/api/alerts/v3/models/get_alert200_response.py new file mode 100644 index 00000000..a4d85560 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/get_alert200_response.py @@ -0,0 +1,54 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.alerts.v3.models.type2 import Type2 + + +class GetAlert200Response: + def __init__( + self, + created_at: Optional[int] = None, + email_to: Optional[str] = None, + frequency: Optional[str] = None, + id: Optional[int] = None, + type: Optional[Type2] = None, + updated_at: Optional[int] = None, + percentage: Optional[int] = None, + ): + self.created_at = created_at + self.email_to = email_to + self.frequency = frequency + self.id = id + self.type = type + self.updated_at = updated_at + self.percentage = percentage + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created_at": self.created_at, + "email_to": self.email_to, + "frequency": self.frequency, + "id": self.id, + "type": self.type, + "updated_at": self.updated_at, + "percentage": self.percentage, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetAlert200Response( + created_at=payload.get("created_at"), + email_to=payload.get("email_to"), + frequency=payload.get("frequency"), + id=payload.get("id"), + type=payload.get("type"), + updated_at=payload.get("updated_at"), + percentage=payload.get("percentage"), + ) diff --git a/sendgrid/rest/api/alerts/v3/models/list_alert200_response_inner.py b/sendgrid/rest/api/alerts/v3/models/list_alert200_response_inner.py new file mode 100644 index 00000000..591d9135 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/list_alert200_response_inner.py @@ -0,0 +1,54 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.alerts.v3.models.type1 import Type1 + + +class ListAlert200ResponseInner: + def __init__( + self, + created_at: Optional[int] = None, + email_to: Optional[str] = None, + id: Optional[int] = None, + percentage: Optional[int] = None, + type: Optional[Type1] = None, + updated_at: Optional[int] = None, + frequency: Optional[str] = None, + ): + self.created_at = created_at + self.email_to = email_to + self.id = id + self.percentage = percentage + self.type = type + self.updated_at = updated_at + self.frequency = frequency + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created_at": self.created_at, + "email_to": self.email_to, + "id": self.id, + "percentage": self.percentage, + "type": self.type, + "updated_at": self.updated_at, + "frequency": self.frequency, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAlert200ResponseInner( + created_at=payload.get("created_at"), + email_to=payload.get("email_to"), + id=payload.get("id"), + percentage=payload.get("percentage"), + type=payload.get("type"), + updated_at=payload.get("updated_at"), + frequency=payload.get("frequency"), + ) diff --git a/sendgrid/rest/api/alerts/v3/models/type.py b/sendgrid/rest/api/alerts/v3/models/type.py new file mode 100644 index 00000000..8b42dd10 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + STATS_NOTIFICATION = "stats_notification" + USAGE_LIMIT = "usage_limit" diff --git a/sendgrid/rest/api/alerts/v3/models/type1.py b/sendgrid/rest/api/alerts/v3/models/type1.py new file mode 100644 index 00000000..78a241e6 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/type1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type1(Enum): + USAGE_LIMIT = "usage_limit" + STATS_NOTIFICATION = "stats_notification" diff --git a/sendgrid/rest/api/alerts/v3/models/type2.py b/sendgrid/rest/api/alerts/v3/models/type2.py new file mode 100644 index 00000000..ab8659c7 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/type2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type2(Enum): + USAGE_LIMIT = "usage_limit" + STATS_NOTIFICATION = "stats_notification" diff --git a/sendgrid/rest/api/alerts/v3/models/type3.py b/sendgrid/rest/api/alerts/v3/models/type3.py new file mode 100644 index 00000000..4ee55606 --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/type3.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type3(Enum): + USAGE_LIMIT = "usage_limit" + STATS_NOTIFICATION = "stats_notification" diff --git a/sendgrid/rest/api/alerts/v3/models/update_alert200_response.py b/sendgrid/rest/api/alerts/v3/models/update_alert200_response.py new file mode 100644 index 00000000..84b710fa --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/update_alert200_response.py @@ -0,0 +1,54 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.alerts.v3.models.type3 import Type3 + + +class UpdateAlert200Response: + def __init__( + self, + created_at: Optional[int] = None, + email_to: Optional[str] = None, + frequency: Optional[str] = None, + id: Optional[int] = None, + type: Optional[Type3] = None, + updated_at: Optional[int] = None, + percentage: Optional[int] = None, + ): + self.created_at = created_at + self.email_to = email_to + self.frequency = frequency + self.id = id + self.type = type + self.updated_at = updated_at + self.percentage = percentage + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created_at": self.created_at, + "email_to": self.email_to, + "frequency": self.frequency, + "id": self.id, + "type": self.type, + "updated_at": self.updated_at, + "percentage": self.percentage, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAlert200Response( + created_at=payload.get("created_at"), + email_to=payload.get("email_to"), + frequency=payload.get("frequency"), + id=payload.get("id"), + type=payload.get("type"), + updated_at=payload.get("updated_at"), + percentage=payload.get("percentage"), + ) diff --git a/sendgrid/rest/api/alerts/v3/models/update_alert_request.py b/sendgrid/rest/api/alerts/v3/models/update_alert_request.py new file mode 100644 index 00000000..f73f8dea --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/models/update_alert_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAlertRequest: + def __init__( + self, + email_to: Optional[str] = None, + frequency: Optional[str] = None, + percentage: Optional[int] = None, + ): + self.email_to = email_to + self.frequency = frequency + self.percentage = percentage + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email_to": self.email_to, + "frequency": self.frequency, + "percentage": self.percentage, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAlertRequest( + email_to=payload.get("email_to"), + frequency=payload.get("frequency"), + percentage=payload.get("percentage"), + ) diff --git a/sendgrid/rest/api/alerts/v3/update_alert.py b/sendgrid/rest/api/alerts/v3/update_alert.py new file mode 100644 index 00000000..65ed4a0f --- /dev/null +++ b/sendgrid/rest/api/alerts/v3/update_alert.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Alerts API + The Twilio SendGrid Alerts API allows you to specify an email address to receive notifications regarding your email usage or statistics. You can set up alerts to be sent to a specific email address on a recurring basis, whether for informational purposes or when specific account actions occur. For most alerts, you can choose to have the alert sent to you as needed, hourly, daily, weekly, or monthly. The information contained in your alert will be for the last period of the alert. For example, if you choose weekly for the statistics alert, you will receive the statistics for the last week. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.alerts.v3.models.update_alert_request import UpdateAlertRequest + + +class UpdateAlert: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + alert_id: int, + on_behalf_of: Optional[str] = None, + update_alert_request: Optional[UpdateAlertRequest] = None, + ): + path = "/v3/alerts/{alert_id}" + path = path.format( + alert_id=alert_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_alert_request: + data = update_alert_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/api_keys/v3/__init__.py b/sendgrid/rest/api/api_keys/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/api_keys/v3/create_api_key.py b/sendgrid/rest/api/api_keys/v3/create_api_key.py new file mode 100644 index 00000000..26e97a1c --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/create_api_key.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.api_keys.v3.models.create_api_key_request import ( + CreateApiKeyRequest, +) + + +class CreateApiKey: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_api_key_request: Optional[CreateApiKeyRequest] = None, + ): + path = "/v3/api_keys" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_api_key_request: + data = create_api_key_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/api_keys/v3/delete_api_key.py b/sendgrid/rest/api/api_keys/v3/delete_api_key.py new file mode 100644 index 00000000..6158b285 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/delete_api_key.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteApiKey: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + api_key_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/api_keys/{api_key_id}" + path = path.format( + api_key_id=api_key_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/api_keys/v3/get_api_key.py b/sendgrid/rest/api/api_keys/v3/get_api_key.py new file mode 100644 index 00000000..07ddd4e9 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/get_api_key.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetApiKey: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + api_key_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/api_keys/{api_key_id}" + path = path.format( + api_key_id=api_key_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/api_keys/v3/list_api_key.py b/sendgrid/rest/api/api_keys/v3/list_api_key.py new file mode 100644 index 00000000..2bfcab9d --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/list_api_key.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListApiKey: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + ): + path = "/v3/api_keys" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/api_keys/v3/models/__init__.py b/sendgrid/rest/api/api_keys/v3/models/__init__.py new file mode 100644 index 00000000..d07b9ac1 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/__init__.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.api_keys.v3.models.api_key_response import ApiKeyResponse +from sendgrid.rest.api.api_keys.v3.models.api_key_scopes_response import ( + ApiKeyScopesResponse, +) +from sendgrid.rest.api.api_keys.v3.models.create_api_key201_response import ( + CreateApiKey201Response, +) +from sendgrid.rest.api.api_keys.v3.models.create_api_key_request import ( + CreateApiKeyRequest, +) +from sendgrid.rest.api.api_keys.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.api_keys.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.api_keys.v3.models.get_api_key200_response import ( + GetApiKey200Response, +) +from sendgrid.rest.api.api_keys.v3.models.list_api_key200_response import ( + ListApiKey200Response, +) +from sendgrid.rest.api.api_keys.v3.models.update_api_key_name_request import ( + UpdateApiKeyNameRequest, +) +from sendgrid.rest.api.api_keys.v3.models.update_api_key_request import ( + UpdateApiKeyRequest, +) + +__all__ = [ + "ApiKeyResponse", + "ApiKeyScopesResponse", + "CreateApiKey201Response", + "CreateApiKeyRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "GetApiKey200Response", + "ListApiKey200Response", + "UpdateApiKeyNameRequest", + "UpdateApiKeyRequest", +] +# Testing code diff --git a/sendgrid/rest/api/api_keys/v3/models/api_key_response.py b/sendgrid/rest/api/api_keys/v3/models/api_key_response.py new file mode 100644 index 00000000..7f743812 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/api_key_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ApiKeyResponse: + def __init__(self, api_key_id: Optional[str] = None, name: Optional[str] = None): + self.api_key_id = api_key_id + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"api_key_id": self.api_key_id, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ApiKeyResponse( + api_key_id=payload.get("api_key_id"), name=payload.get("name") + ) diff --git a/sendgrid/rest/api/api_keys/v3/models/api_key_scopes_response.py b/sendgrid/rest/api/api_keys/v3/models/api_key_scopes_response.py new file mode 100644 index 00000000..c5851dbe --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/api_key_scopes_response.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ApiKeyScopesResponse: + def __init__( + self, + scopes: Optional[List[str]] = None, + api_key_id: Optional[str] = None, + name: Optional[str] = None, + ): + self.scopes = scopes + self.api_key_id = api_key_id + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "scopes": self.scopes, + "api_key_id": self.api_key_id, + "name": self.name, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ApiKeyScopesResponse( + scopes=payload.get("scopes"), + api_key_id=payload.get("api_key_id"), + name=payload.get("name"), + ) diff --git a/sendgrid/rest/api/api_keys/v3/models/create_api_key201_response.py b/sendgrid/rest/api/api_keys/v3/models/create_api_key201_response.py new file mode 100644 index 00000000..7974fc95 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/create_api_key201_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateApiKey201Response: + def __init__( + self, + api_key: Optional[str] = None, + api_key_id: Optional[str] = None, + name: Optional[str] = None, + scopes: Optional[List[str]] = None, + ): + self.api_key = api_key + self.api_key_id = api_key_id + self.name = name + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "api_key": self.api_key, + "api_key_id": self.api_key_id, + "name": self.name, + "scopes": self.scopes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateApiKey201Response( + api_key=payload.get("api_key"), + api_key_id=payload.get("api_key_id"), + name=payload.get("name"), + scopes=payload.get("scopes"), + ) diff --git a/sendgrid/rest/api/api_keys/v3/models/create_api_key_request.py b/sendgrid/rest/api/api_keys/v3/models/create_api_key_request.py new file mode 100644 index 00000000..35c17c3b --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/create_api_key_request.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateApiKeyRequest: + def __init__(self, name: Optional[str] = None, scopes: Optional[List[str]] = None): + self.name = name + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "scopes": self.scopes}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateApiKeyRequest( + name=payload.get("name"), scopes=payload.get("scopes") + ) diff --git a/sendgrid/rest/api/api_keys/v3/models/error_response.py b/sendgrid/rest/api/api_keys/v3/models/error_response.py new file mode 100644 index 00000000..bd528b72 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.api_keys.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/api_keys/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/api_keys/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/api_keys/v3/models/get_api_key200_response.py b/sendgrid/rest/api/api_keys/v3/models/get_api_key200_response.py new file mode 100644 index 00000000..5524458c --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/get_api_key200_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.api_keys.v3.models.api_key_scopes_response import ( + ApiKeyScopesResponse, +) + + +class GetApiKey200Response: + def __init__(self, result: Optional[List[ApiKeyScopesResponse]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetApiKey200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/api_keys/v3/models/list_api_key200_response.py b/sendgrid/rest/api/api_keys/v3/models/list_api_key200_response.py new file mode 100644 index 00000000..f166ba2a --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/list_api_key200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.api_keys.v3.models.api_key_response import ApiKeyResponse + + +class ListApiKey200Response: + def __init__(self, result: Optional[List[ApiKeyResponse]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListApiKey200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/api_keys/v3/models/update_api_key_name_request.py b/sendgrid/rest/api/api_keys/v3/models/update_api_key_name_request.py new file mode 100644 index 00000000..cbf12e0e --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/update_api_key_name_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateApiKeyNameRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateApiKeyNameRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/api_keys/v3/models/update_api_key_request.py b/sendgrid/rest/api/api_keys/v3/models/update_api_key_request.py new file mode 100644 index 00000000..a7c04ed4 --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/models/update_api_key_request.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateApiKeyRequest: + def __init__(self, name: Optional[str] = None, scopes: Optional[List[str]] = None): + self.name = name + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "scopes": self.scopes}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateApiKeyRequest( + name=payload.get("name"), scopes=payload.get("scopes") + ) diff --git a/sendgrid/rest/api/api_keys/v3/update_api_key.py b/sendgrid/rest/api/api_keys/v3/update_api_key.py new file mode 100644 index 00000000..a8a2faaf --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/update_api_key.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.api_keys.v3.models.update_api_key_request import ( + UpdateApiKeyRequest, +) + + +class UpdateApiKey: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + api_key_id: str, + on_behalf_of: Optional[str] = None, + update_api_key_request: Optional[UpdateApiKeyRequest] = None, + ): + path = "/v3/api_keys/{api_key_id}" + path = path.format( + api_key_id=api_key_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_api_key_request: + data = update_api_key_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/api_keys/v3/update_api_key_name.py b/sendgrid/rest/api/api_keys/v3/update_api_key_name.py new file mode 100644 index 00000000..0b0bd4fe --- /dev/null +++ b/sendgrid/rest/api/api_keys/v3/update_api_key_name.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid API Keys API + The Twilio SendGrid API Keys API allows you manage your API keys and their settings. Your application, mail client, or website can all use API keys to authenticate access to SendGrid services. To create your initial SendGrid API Key, you should use the [SendGrid application user interface](https://app.sendgrid.com/settings/api_keys). Once you have created a first key with scopes to manage additional API keys, you can use this API for all other key management. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.api_keys.v3.models.update_api_key_name_request import ( + UpdateApiKeyNameRequest, +) + + +class UpdateApiKeyName: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + api_key_id: str, + on_behalf_of: Optional[str] = None, + update_api_key_name_request: Optional[UpdateApiKeyNameRequest] = None, + ): + path = "/v3/api_keys/{api_key_id}" + path = path.format( + api_key_id=api_key_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_api_key_name_request: + data = update_api_key_name_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/__init__.py b/sendgrid/rest/api/domain_authentication/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/domain_authentication/v3/add_ip_to_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/add_ip_to_authenticated_domain.py new file mode 100644 index 00000000..338adcd4 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/add_ip_to_authenticated_domain.py @@ -0,0 +1,71 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.domain_authentication.v3.models.add_ip_to_authenticated_domain_request import ( + AddIpToAuthenticatedDomainRequest, +) + + +class AddIpToAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + add_ip_to_authenticated_domain_request: Optional[ + AddIpToAuthenticatedDomainRequest + ] = None, + ): + path = "/v3/whitelabel/domains/{id}/ips" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if add_ip_to_authenticated_domain_request: + data = add_ip_to_authenticated_domain_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain.py b/sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain.py new file mode 100644 index 00000000..8972b9b6 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.domain_authentication.v3.models.associate_subuser_with_domain_request import ( + AssociateSubuserWithDomainRequest, +) + + +class AssociateSubuserWithDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + domain_id: int, + associate_subuser_with_domain_request: Optional[ + AssociateSubuserWithDomainRequest + ] = None, + ): + path = "/v3/whitelabel/domains/{domain_id}/subuser" + path = path.format( + domain_id=domain_id, + ) + + data = None + if associate_subuser_with_domain_request: + data = associate_subuser_with_domain_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain_multiple.py b/sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain_multiple.py new file mode 100644 index 00000000..e898efd8 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/associate_subuser_with_domain_multiple.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.domain_authentication.v3.models.associate_subuser_with_domain_request import ( + AssociateSubuserWithDomainRequest, +) + + +class AssociateSubuserWithDomainMultiple: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + domain_id: int, + associate_subuser_with_domain_request: Optional[ + AssociateSubuserWithDomainRequest + ] = None, + ): + path = "/v3/whitelabel/domains/{domain_id}/subuser:add" + path = path.format( + domain_id=domain_id, + ) + + data = None + if associate_subuser_with_domain_request: + data = associate_subuser_with_domain_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/authenticate_domain.py b/sendgrid/rest/api/domain_authentication/v3/authenticate_domain.py new file mode 100644 index 00000000..b46e8e69 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/authenticate_domain.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.domain_authentication.v3.models.authenticate_domain_request import ( + AuthenticateDomainRequest, +) + + +class AuthenticateDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + authenticate_domain_request: Optional[AuthenticateDomainRequest] = None, + ): + path = "/v3/whitelabel/domains" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if authenticate_domain_request: + data = authenticate_domain_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/delete_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/delete_authenticated_domain.py new file mode 100644 index 00000000..0fdde88e --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/delete_authenticated_domain.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + domain_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/{domain_id}" + path = path.format( + domain_id=domain_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/delete_ip_from_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/delete_ip_from_authenticated_domain.py new file mode 100644 index 00000000..83cc8227 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/delete_ip_from_authenticated_domain.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteIpFromAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + ip: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/{id}/ips/{ip}" + path = path.format( + id=id, + ip=ip, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/disassociate_authenticated_domain_from_user.py b/sendgrid/rest/api/domain_authentication/v3/disassociate_authenticated_domain_from_user.py new file mode 100644 index 00000000..65c69a27 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/disassociate_authenticated_domain_from_user.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DisassociateAuthenticatedDomainFromUser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/subuser" + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/disassociate_subuser_from_domain.py b/sendgrid/rest/api/domain_authentication/v3/disassociate_subuser_from_domain.py new file mode 100644 index 00000000..ff18a693 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/disassociate_subuser_from_domain.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DisassociateSubuserFromDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + domain_id: int, + username: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/{domain_id}/subuser" + path = path.format( + domain_id=domain_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/email_dns_record.py b/sendgrid/rest/api/domain_authentication/v3/email_dns_record.py new file mode 100644 index 00000000..04bd15e4 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/email_dns_record.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.domain_authentication.v3.models.email_dns_record_request import ( + EmailDnsRecordRequest, +) + + +class EmailDnsRecord: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email_dns_record_request: Optional[EmailDnsRecordRequest] = None, + ): + path = "/v3/whitelabel/dns/email" + + data = None + if email_dns_record_request: + data = email_dns_record_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/get_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/get_authenticated_domain.py new file mode 100644 index 00000000..6f1991f3 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/get_authenticated_domain.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + domain_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/{domain_id}" + path = path.format( + domain_id=domain_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/list_all_authenticated_domain_with_user.py b/sendgrid/rest/api/domain_authentication/v3/list_all_authenticated_domain_with_user.py new file mode 100644 index 00000000..d5817219 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/list_all_authenticated_domain_with_user.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListAllAuthenticatedDomainWithUser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/subuser/all" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain.py new file mode 100644 index 00000000..02a0e9d8 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + exclude_subusers: Optional[bool] = None, + username: Optional[str] = None, + domain: Optional[str] = None, + ): + path = "/v3/whitelabel/domains" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain_with_user.py b/sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain_with_user.py new file mode 100644 index 00000000..aef419de --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/list_authenticated_domain_with_user.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListAuthenticatedDomainWithUser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/subuser" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/list_default_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/list_default_authenticated_domain.py new file mode 100644 index 00000000..45838bd5 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/list_default_authenticated_domain.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListDefaultAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + domain: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/default" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/__init__.py b/sendgrid/rest/api/domain_authentication/v3/models/__init__.py new file mode 100644 index 00000000..dd56796a --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/__init__.py @@ -0,0 +1,118 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.domain_authentication.v3.models.add_ip_to_authenticated_domain_request import ( + AddIpToAuthenticatedDomainRequest, +) +from sendgrid.rest.api.domain_authentication.v3.models.associate_subuser_with_domain_request import ( + AssociateSubuserWithDomainRequest, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticate_domain_request import ( + AuthenticateDomainRequest, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain import ( + AuthenticatedDomain, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf import ( + AuthenticatedDomainSpf, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns import ( + AuthenticatedDomainSpfDns, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_dkim import ( + AuthenticatedDomainSpfDnsDkim, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_domain_spf import ( + AuthenticatedDomainSpfDnsDomainSpf, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_mail_server import ( + AuthenticatedDomainSpfDnsMailServer, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_subdomain_spf import ( + AuthenticatedDomainSpfDnsSubdomainSpf, +) +from sendgrid.rest.api.domain_authentication.v3.models.email_dns_record400_response import ( + EmailDnsRecord400Response, +) +from sendgrid.rest.api.domain_authentication.v3.models.email_dns_record400_response_errors import ( + EmailDnsRecord400ResponseErrors, +) +from sendgrid.rest.api.domain_authentication.v3.models.email_dns_record_request import ( + EmailDnsRecordRequest, +) +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner import ( + ListAllAuthenticatedDomainWithUser200ResponseInner, +) +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDns, +) +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns_dkim1 import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1, +) +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns_mail_cname import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname, +) +from sendgrid.rest.api.domain_authentication.v3.models.update_authenticated_domain_request import ( + UpdateAuthenticatedDomainRequest, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response import ( + ValidateAuthenticatedDomain200Response, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results import ( + ValidateAuthenticatedDomain200ResponseValidationResults, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results_dkim1 import ( + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results_mail_cname import ( + ValidateAuthenticatedDomain200ResponseValidationResultsMailCname, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results_spf import ( + ValidateAuthenticatedDomain200ResponseValidationResultsSpf, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain500_response import ( + ValidateAuthenticatedDomain500Response, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain500_response_errors_inner import ( + ValidateAuthenticatedDomain500ResponseErrorsInner, +) + +__all__ = [ + "AddIpToAuthenticatedDomainRequest", + "AssociateSubuserWithDomainRequest", + "AuthenticateDomainRequest", + "AuthenticatedDomain", + "AuthenticatedDomainSpf", + "AuthenticatedDomainSpfDns", + "AuthenticatedDomainSpfDnsDkim", + "AuthenticatedDomainSpfDnsDomainSpf", + "AuthenticatedDomainSpfDnsMailServer", + "AuthenticatedDomainSpfDnsSubdomainSpf", + "EmailDnsRecord400Response", + "EmailDnsRecord400ResponseErrors", + "EmailDnsRecordRequest", + "ListAllAuthenticatedDomainWithUser200ResponseInner", + "ListAllAuthenticatedDomainWithUser200ResponseInnerDns", + "ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1", + "ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname", + "UpdateAuthenticatedDomainRequest", + "ValidateAuthenticatedDomain200Response", + "ValidateAuthenticatedDomain200ResponseValidationResults", + "ValidateAuthenticatedDomain200ResponseValidationResultsDkim1", + "ValidateAuthenticatedDomain200ResponseValidationResultsMailCname", + "ValidateAuthenticatedDomain200ResponseValidationResultsSpf", + "ValidateAuthenticatedDomain500Response", + "ValidateAuthenticatedDomain500ResponseErrorsInner", +] +# Testing code diff --git a/sendgrid/rest/api/domain_authentication/v3/models/add_ip_to_authenticated_domain_request.py b/sendgrid/rest/api/domain_authentication/v3/models/add_ip_to_authenticated_domain_request.py new file mode 100644 index 00000000..47d55699 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/add_ip_to_authenticated_domain_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpToAuthenticatedDomainRequest: + def __init__(self, ip: Optional[str] = None): + self.ip = ip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToAuthenticatedDomainRequest(ip=payload.get("ip")) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/associate_subuser_with_domain_request.py b/sendgrid/rest/api/domain_authentication/v3/models/associate_subuser_with_domain_request.py new file mode 100644 index 00000000..9b373203 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/associate_subuser_with_domain_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AssociateSubuserWithDomainRequest: + def __init__(self, username: Optional[str] = None): + self.username = username + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"username": self.username}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AssociateSubuserWithDomainRequest(username=payload.get("username")) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticate_domain_request.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticate_domain_request.py new file mode 100644 index 00000000..0eea54e5 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticate_domain_request.py @@ -0,0 +1,61 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AuthenticateDomainRequest: + def __init__( + self, + domain: Optional[str] = None, + subdomain: Optional[str] = None, + username: Optional[str] = None, + ips: Optional[List[str]] = None, + custom_spf: Optional[bool] = None, + default: Optional[bool] = None, + automatic_security: Optional[bool] = None, + custom_dkim_selector: Optional[str] = None, + region: Optional[str] = None, + ): + self.domain = domain + self.subdomain = subdomain + self.username = username + self.ips = ips + self.custom_spf = custom_spf + self.default = default + self.automatic_security = automatic_security + self.custom_dkim_selector = custom_dkim_selector + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "domain": self.domain, + "subdomain": self.subdomain, + "username": self.username, + "ips": self.ips, + "custom_spf": self.custom_spf, + "default": self.default, + "automatic_security": self.automatic_security, + "custom_dkim_selector": self.custom_dkim_selector, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticateDomainRequest( + domain=payload.get("domain"), + subdomain=payload.get("subdomain"), + username=payload.get("username"), + ips=payload.get("ips"), + custom_spf=payload.get("custom_spf"), + default=payload.get("default"), + automatic_security=payload.get("automatic_security"), + custom_dkim_selector=payload.get("custom_dkim_selector"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain.py new file mode 100644 index 00000000..b64cd0e0 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain.py @@ -0,0 +1,76 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDns, +) + + +class AuthenticatedDomain: + def __init__( + self, + id: Optional[float] = None, + user_id: Optional[float] = None, + subdomain: Optional[str] = None, + domain: Optional[str] = None, + username: Optional[str] = None, + ips: Optional[List[str]] = None, + custom_spf: Optional[bool] = None, + default: Optional[bool] = None, + legacy: Optional[bool] = None, + automatic_security: Optional[bool] = None, + valid: Optional[bool] = None, + dns: Optional[ListAllAuthenticatedDomainWithUser200ResponseInnerDns] = None, + ): + self.id = id + self.user_id = user_id + self.subdomain = subdomain + self.domain = domain + self.username = username + self.ips = ips + self.custom_spf = custom_spf + self.default = default + self.legacy = legacy + self.automatic_security = automatic_security + self.valid = valid + self.dns = dns + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "user_id": self.user_id, + "subdomain": self.subdomain, + "domain": self.domain, + "username": self.username, + "ips": self.ips, + "custom_spf": self.custom_spf, + "default": self.default, + "legacy": self.legacy, + "automatic_security": self.automatic_security, + "valid": self.valid, + "dns": self.dns, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomain( + id=payload.get("id"), + user_id=payload.get("user_id"), + subdomain=payload.get("subdomain"), + domain=payload.get("domain"), + username=payload.get("username"), + ips=payload.get("ips"), + custom_spf=payload.get("custom_spf"), + default=payload.get("default"), + legacy=payload.get("legacy"), + automatic_security=payload.get("automatic_security"), + valid=payload.get("valid"), + dns=payload.get("dns"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf.py new file mode 100644 index 00000000..f1dc2b08 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf.py @@ -0,0 +1,76 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns import ( + AuthenticatedDomainSpfDns, +) + + +class AuthenticatedDomainSpf: + def __init__( + self, + id: Optional[int] = None, + domain: Optional[str] = None, + subdomain: Optional[str] = None, + username: Optional[str] = None, + user_id: Optional[int] = None, + ips: Optional[List[object]] = None, + custom_spf: Optional[bool] = None, + default: Optional[bool] = None, + legacy: Optional[bool] = None, + automatic_security: Optional[bool] = None, + valid: Optional[bool] = None, + dns: Optional[AuthenticatedDomainSpfDns] = None, + ): + self.id = id + self.domain = domain + self.subdomain = subdomain + self.username = username + self.user_id = user_id + self.ips = ips + self.custom_spf = custom_spf + self.default = default + self.legacy = legacy + self.automatic_security = automatic_security + self.valid = valid + self.dns = dns + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "domain": self.domain, + "subdomain": self.subdomain, + "username": self.username, + "user_id": self.user_id, + "ips": self.ips, + "custom_spf": self.custom_spf, + "default": self.default, + "legacy": self.legacy, + "automatic_security": self.automatic_security, + "valid": self.valid, + "dns": self.dns, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomainSpf( + id=payload.get("id"), + domain=payload.get("domain"), + subdomain=payload.get("subdomain"), + username=payload.get("username"), + user_id=payload.get("user_id"), + ips=payload.get("ips"), + custom_spf=payload.get("custom_spf"), + default=payload.get("default"), + legacy=payload.get("legacy"), + automatic_security=payload.get("automatic_security"), + valid=payload.get("valid"), + dns=payload.get("dns"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns.py new file mode 100644 index 00000000..756e3c42 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns.py @@ -0,0 +1,53 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_dkim import ( + AuthenticatedDomainSpfDnsDkim, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_domain_spf import ( + AuthenticatedDomainSpfDnsDomainSpf, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_mail_server import ( + AuthenticatedDomainSpfDnsMailServer, +) +from sendgrid.rest.api.domain_authentication.v3.models.authenticated_domain_spf_dns_subdomain_spf import ( + AuthenticatedDomainSpfDnsSubdomainSpf, +) + + +class AuthenticatedDomainSpfDns: + def __init__( + self, + mail_server: Optional[AuthenticatedDomainSpfDnsMailServer] = None, + subdomain_spf: Optional[AuthenticatedDomainSpfDnsSubdomainSpf] = None, + domain_spf: Optional[AuthenticatedDomainSpfDnsDomainSpf] = None, + dkim: Optional[AuthenticatedDomainSpfDnsDkim] = None, + ): + self.mail_server = mail_server + self.subdomain_spf = subdomain_spf + self.domain_spf = domain_spf + self.dkim = dkim + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "mail_server": self.mail_server, + "subdomain_spf": self.subdomain_spf, + "domain_spf": self.domain_spf, + "dkim": self.dkim, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomainSpfDns( + mail_server=payload.get("mail_server"), + subdomain_spf=payload.get("subdomain_spf"), + domain_spf=payload.get("domain_spf"), + dkim=payload.get("dkim"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_dkim.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_dkim.py new file mode 100644 index 00000000..498da59f --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_dkim.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AuthenticatedDomainSpfDnsDkim: + def __init__( + self, + host: Optional[str] = None, + type: Optional[str] = None, + data: Optional[str] = None, + valid: Optional[bool] = None, + ): + self.host = host + self.type = type + self.data = data + self.valid = valid + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "host": self.host, + "type": self.type, + "data": self.data, + "valid": self.valid, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomainSpfDnsDkim( + host=payload.get("host"), + type=payload.get("type"), + data=payload.get("data"), + valid=payload.get("valid"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_domain_spf.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_domain_spf.py new file mode 100644 index 00000000..6e3c1c45 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_domain_spf.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AuthenticatedDomainSpfDnsDomainSpf: + def __init__( + self, + host: Optional[str] = None, + type: Optional[str] = None, + data: Optional[str] = None, + valid: Optional[bool] = None, + ): + self.host = host + self.type = type + self.data = data + self.valid = valid + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "host": self.host, + "type": self.type, + "data": self.data, + "valid": self.valid, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomainSpfDnsDomainSpf( + host=payload.get("host"), + type=payload.get("type"), + data=payload.get("data"), + valid=payload.get("valid"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_mail_server.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_mail_server.py new file mode 100644 index 00000000..5f843aee --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_mail_server.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AuthenticatedDomainSpfDnsMailServer: + def __init__( + self, + host: Optional[str] = None, + type: Optional[str] = None, + data: Optional[str] = None, + valid: Optional[bool] = None, + ): + self.host = host + self.type = type + self.data = data + self.valid = valid + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "host": self.host, + "type": self.type, + "data": self.data, + "valid": self.valid, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomainSpfDnsMailServer( + host=payload.get("host"), + type=payload.get("type"), + data=payload.get("data"), + valid=payload.get("valid"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_subdomain_spf.py b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_subdomain_spf.py new file mode 100644 index 00000000..24c3061d --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/authenticated_domain_spf_dns_subdomain_spf.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AuthenticatedDomainSpfDnsSubdomainSpf: + def __init__( + self, + host: Optional[str] = None, + type: Optional[str] = None, + data: Optional[str] = None, + valid: Optional[bool] = None, + ): + self.host = host + self.type = type + self.data = data + self.valid = valid + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "host": self.host, + "type": self.type, + "data": self.data, + "valid": self.valid, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AuthenticatedDomainSpfDnsSubdomainSpf( + host=payload.get("host"), + type=payload.get("type"), + data=payload.get("data"), + valid=payload.get("valid"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response.py b/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response.py new file mode 100644 index 00000000..645aff93 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.email_dns_record400_response_errors import ( + EmailDnsRecord400ResponseErrors, +) + + +class EmailDnsRecord400Response: + def __init__(self, errors: Optional[EmailDnsRecord400ResponseErrors] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EmailDnsRecord400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response_errors.py b/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response_errors.py new file mode 100644 index 00000000..d8000638 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record400_response_errors.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EmailDnsRecord400ResponseErrors: + def __init__(self, error: Optional[str] = None, field: Optional[str] = None): + self.error = error + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"error": self.error, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EmailDnsRecord400ResponseErrors( + error=payload.get("error"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record_request.py b/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record_request.py new file mode 100644 index 00000000..ac17c6c4 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/email_dns_record_request.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EmailDnsRecordRequest: + def __init__( + self, + link_id: Optional[int] = None, + domain_id: Optional[int] = None, + email: Optional[str] = None, + message: Optional[str] = None, + ): + self.link_id = link_id + self.domain_id = domain_id + self.email = email + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "link_id": self.link_id, + "domain_id": self.domain_id, + "email": self.email, + "message": self.message, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EmailDnsRecordRequest( + link_id=payload.get("link_id"), + domain_id=payload.get("domain_id"), + email=payload.get("email"), + message=payload.get("message"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner.py b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner.py new file mode 100644 index 00000000..71e3aebd --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner.py @@ -0,0 +1,76 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDns, +) + + +class ListAllAuthenticatedDomainWithUser200ResponseInner: + def __init__( + self, + id: Optional[float] = None, + user_id: Optional[float] = None, + subdomain: Optional[str] = None, + domain: Optional[str] = None, + username: Optional[str] = None, + ips: Optional[List[str]] = None, + custom_spf: Optional[bool] = None, + default: Optional[bool] = None, + legacy: Optional[bool] = None, + automatic_security: Optional[bool] = None, + valid: Optional[bool] = None, + dns: Optional[ListAllAuthenticatedDomainWithUser200ResponseInnerDns] = None, + ): + self.id = id + self.user_id = user_id + self.subdomain = subdomain + self.domain = domain + self.username = username + self.ips = ips + self.custom_spf = custom_spf + self.default = default + self.legacy = legacy + self.automatic_security = automatic_security + self.valid = valid + self.dns = dns + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "user_id": self.user_id, + "subdomain": self.subdomain, + "domain": self.domain, + "username": self.username, + "ips": self.ips, + "custom_spf": self.custom_spf, + "default": self.default, + "legacy": self.legacy, + "automatic_security": self.automatic_security, + "valid": self.valid, + "dns": self.dns, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllAuthenticatedDomainWithUser200ResponseInner( + id=payload.get("id"), + user_id=payload.get("user_id"), + subdomain=payload.get("subdomain"), + domain=payload.get("domain"), + username=payload.get("username"), + ips=payload.get("ips"), + custom_spf=payload.get("custom_spf"), + default=payload.get("default"), + legacy=payload.get("legacy"), + automatic_security=payload.get("automatic_security"), + valid=payload.get("valid"), + dns=payload.get("dns"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns.py b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns.py new file mode 100644 index 00000000..7310d31c --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns_dkim1 import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1, +) +from sendgrid.rest.api.domain_authentication.v3.models.list_all_authenticated_domain_with_user200_response_inner_dns_mail_cname import ( + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname, +) + + +class ListAllAuthenticatedDomainWithUser200ResponseInnerDns: + def __init__( + self, + mail_cname: Optional[ + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname + ] = None, + dkim1: Optional[ + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 + ] = None, + dkim2: Optional[ + ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1 + ] = None, + ): + self.mail_cname = mail_cname + self.dkim1 = dkim1 + self.dkim2 = dkim2 + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "mail_cname": self.mail_cname, + "dkim1": self.dkim1, + "dkim2": self.dkim2, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllAuthenticatedDomainWithUser200ResponseInnerDns( + mail_cname=payload.get("mail_cname"), + dkim1=payload.get("dkim1"), + dkim2=payload.get("dkim2"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_dkim1.py b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_dkim1.py new file mode 100644 index 00000000..c386dfef --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_dkim1.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1: + def __init__( + self, + valid: Optional[bool] = None, + type: Optional[str] = None, + host: Optional[str] = None, + data: Optional[str] = None, + ): + self.valid = valid + self.type = type + self.host = host + self.data = data + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "valid": self.valid, + "type": self.type, + "host": self.host, + "data": self.data, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllAuthenticatedDomainWithUser200ResponseInnerDnsDkim1( + valid=payload.get("valid"), + type=payload.get("type"), + host=payload.get("host"), + data=payload.get("data"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_mail_cname.py b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_mail_cname.py new file mode 100644 index 00000000..264e1309 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/list_all_authenticated_domain_with_user200_response_inner_dns_mail_cname.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname: + def __init__( + self, + valid: Optional[bool] = None, + type: Optional[str] = None, + host: Optional[str] = None, + data: Optional[str] = None, + ): + self.valid = valid + self.type = type + self.host = host + self.data = data + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "valid": self.valid, + "type": self.type, + "host": self.host, + "data": self.data, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllAuthenticatedDomainWithUser200ResponseInnerDnsMailCname( + valid=payload.get("valid"), + type=payload.get("type"), + host=payload.get("host"), + data=payload.get("data"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/update_authenticated_domain_request.py b/sendgrid/rest/api/domain_authentication/v3/models/update_authenticated_domain_request.py new file mode 100644 index 00000000..8e5d3479 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/update_authenticated_domain_request.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAuthenticatedDomainRequest: + def __init__( + self, default: Optional[bool] = None, custom_spf: Optional[bool] = None + ): + self.default = default + self.custom_spf = custom_spf + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "default": self.default, + "custom_spf": self.custom_spf, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAuthenticatedDomainRequest( + default=payload.get("default"), custom_spf=payload.get("custom_spf") + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response.py new file mode 100644 index 00000000..383a2bab --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results import ( + ValidateAuthenticatedDomain200ResponseValidationResults, +) + + +class ValidateAuthenticatedDomain200Response: + def __init__( + self, + id: Optional[int] = None, + valid: Optional[bool] = None, + validation_results: Optional[ + ValidateAuthenticatedDomain200ResponseValidationResults + ] = None, + ): + self.id = id + self.valid = valid + self.validation_results = validation_results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "valid": self.valid, + "validation_results": self.validation_results, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain200Response( + id=payload.get("id"), + valid=payload.get("valid"), + validation_results=payload.get("validation_results"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results.py new file mode 100644 index 00000000..8a4848f0 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results.py @@ -0,0 +1,58 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results_dkim1 import ( + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results_mail_cname import ( + ValidateAuthenticatedDomain200ResponseValidationResultsMailCname, +) +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain200_response_validation_results_spf import ( + ValidateAuthenticatedDomain200ResponseValidationResultsSpf, +) + + +class ValidateAuthenticatedDomain200ResponseValidationResults: + def __init__( + self, + mail_cname: Optional[ + ValidateAuthenticatedDomain200ResponseValidationResultsMailCname + ] = None, + dkim1: Optional[ + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 + ] = None, + dkim2: Optional[ + ValidateAuthenticatedDomain200ResponseValidationResultsDkim1 + ] = None, + spf: Optional[ + ValidateAuthenticatedDomain200ResponseValidationResultsSpf + ] = None, + ): + self.mail_cname = mail_cname + self.dkim1 = dkim1 + self.dkim2 = dkim2 + self.spf = spf + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "mail_cname": self.mail_cname, + "dkim1": self.dkim1, + "dkim2": self.dkim2, + "spf": self.spf, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain200ResponseValidationResults( + mail_cname=payload.get("mail_cname"), + dkim1=payload.get("dkim1"), + dkim2=payload.get("dkim2"), + spf=payload.get("spf"), + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_dkim1.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_dkim1.py new file mode 100644 index 00000000..f034933e --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_dkim1.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateAuthenticatedDomain200ResponseValidationResultsDkim1: + def __init__(self, valid: Optional[bool] = None, reason: Optional[str] = None): + self.valid = valid + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"valid": self.valid, "reason": self.reason}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain200ResponseValidationResultsDkim1( + valid=payload.get("valid"), reason=payload.get("reason") + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_mail_cname.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_mail_cname.py new file mode 100644 index 00000000..0e66924f --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_mail_cname.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateAuthenticatedDomain200ResponseValidationResultsMailCname: + def __init__(self, valid: Optional[bool] = None, reason: Optional[str] = None): + self.valid = valid + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"valid": self.valid, "reason": self.reason}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain200ResponseValidationResultsMailCname( + valid=payload.get("valid"), reason=payload.get("reason") + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_spf.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_spf.py new file mode 100644 index 00000000..6cb772c0 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain200_response_validation_results_spf.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateAuthenticatedDomain200ResponseValidationResultsSpf: + def __init__(self, valid: Optional[bool] = None, reason: Optional[str] = None): + self.valid = valid + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"valid": self.valid, "reason": self.reason}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain200ResponseValidationResultsSpf( + valid=payload.get("valid"), reason=payload.get("reason") + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response.py new file mode 100644 index 00000000..26e80140 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.domain_authentication.v3.models.validate_authenticated_domain500_response_errors_inner import ( + ValidateAuthenticatedDomain500ResponseErrorsInner, +) + + +class ValidateAuthenticatedDomain500Response: + def __init__( + self, + errors: Optional[ + List[ValidateAuthenticatedDomain500ResponseErrorsInner] + ] = None, + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response_errors_inner.py b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response_errors_inner.py new file mode 100644 index 00000000..8164eecd --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/models/validate_authenticated_domain500_response_errors_inner.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateAuthenticatedDomain500ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateAuthenticatedDomain500ResponseErrorsInner( + message=payload.get("message") + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/update_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/update_authenticated_domain.py new file mode 100644 index 00000000..9c897db7 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/update_authenticated_domain.py @@ -0,0 +1,71 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.domain_authentication.v3.models.update_authenticated_domain_request import ( + UpdateAuthenticatedDomainRequest, +) + + +class UpdateAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + domain_id: str, + on_behalf_of: Optional[str] = None, + update_authenticated_domain_request: Optional[ + UpdateAuthenticatedDomainRequest + ] = None, + ): + path = "/v3/whitelabel/domains/{domain_id}" + path = path.format( + domain_id=domain_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_authenticated_domain_request: + data = update_authenticated_domain_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/domain_authentication/v3/validate_authenticated_domain.py b/sendgrid/rest/api/domain_authentication/v3/validate_authenticated_domain.py new file mode 100644 index 00000000..995e82d8 --- /dev/null +++ b/sendgrid/rest/api/domain_authentication/v3/validate_authenticated_domain.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Domain Authentication API + The Twilio SendGrid Domain Authentication API allows you to manage your authenticated domains and their settings. Domain Authentication is a required step when setting up your Twilio SendGrid account because it's essential to ensuring the deliverability of your email. Domain Authentication signals trustworthiness to email inbox providers and your recipients by approving SendGrid to send email on behalf of your domain. For more information, see [**How to Set Up Domain Authentication**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-domain-authentication/). Each user may have a maximum of 3,000 authenticated domains and 3,000 link brandings. This limit is at the user level, meaning each Subuser belonging to a parent account may have its own 3,000 authenticated domains and 3,000 link brandings. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ValidateAuthenticatedDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/domains/{id}/validate" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_activity/v3/__init__.py b/sendgrid/rest/api/email_activity/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/email_activity/v3/download_csv.py b/sendgrid/rest/api/email_activity/v3/download_csv.py new file mode 100644 index 00000000..9a3498a6 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/download_csv.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Activity API + The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DownloadCsv: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + download_uuid: str, + ): + path = "/v3/messages/download/{download_uuid}" + path = path.format( + download_uuid=download_uuid, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_activity/v3/get_message.py b/sendgrid/rest/api/email_activity/v3/get_message.py new file mode 100644 index 00000000..cdd1196c --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/get_message.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Activity API + The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetMessage: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + msg_id: str, + ): + path = "/v3/messages/{msg_id}" + path = path.format( + msg_id=msg_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_activity/v3/list_message.py b/sendgrid/rest/api/email_activity/v3/list_message.py new file mode 100644 index 00000000..6b75764e --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/list_message.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Activity API + The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListMessage: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + query: Optional[str] = None, + limit: Optional[float] = None, + ): + path = "/v3/messages" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/__init__.py b/sendgrid/rest/api/email_activity/v3/models/__init__.py new file mode 100644 index 00000000..341cb7d6 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/__init__.py @@ -0,0 +1,84 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Activity API + The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.email_activity.v3.models.abbv_message import AbbvMessage +from sendgrid.rest.api.email_activity.v3.models.bounce_type import BounceType +from sendgrid.rest.api.email_activity.v3.models.bounce_type1 import BounceType1 +from sendgrid.rest.api.email_activity.v3.models.download_csv200_response import ( + DownloadCsv200Response, +) +from sendgrid.rest.api.email_activity.v3.models.email_activity_response_base_props import ( + EmailActivityResponseBaseProps, +) +from sendgrid.rest.api.email_activity.v3.models.event import Event +from sendgrid.rest.api.email_activity.v3.models.event_name import EventName +from sendgrid.rest.api.email_activity.v3.models.event_name1 import EventName1 +from sendgrid.rest.api.email_activity.v3.models.get_message404_response import ( + GetMessage404Response, +) +from sendgrid.rest.api.email_activity.v3.models.get_message404_response_errors_inner import ( + GetMessage404ResponseErrorsInner, +) +from sendgrid.rest.api.email_activity.v3.models.list_message200_response import ( + ListMessage200Response, +) +from sendgrid.rest.api.email_activity.v3.models.list_message400_response import ( + ListMessage400Response, +) +from sendgrid.rest.api.email_activity.v3.models.list_message400_response_errors_inner import ( + ListMessage400ResponseErrorsInner, +) +from sendgrid.rest.api.email_activity.v3.models.list_message429_response import ( + ListMessage429Response, +) +from sendgrid.rest.api.email_activity.v3.models.list_message429_response_errors_inner import ( + ListMessage429ResponseErrorsInner, +) +from sendgrid.rest.api.email_activity.v3.models.message import Message +from sendgrid.rest.api.email_activity.v3.models.outbound_ip_type import OutboundIpType +from sendgrid.rest.api.email_activity.v3.models.outbound_ip_type1 import OutboundIpType1 +from sendgrid.rest.api.email_activity.v3.models.request_csv202_response import ( + RequestCsv202Response, +) +from sendgrid.rest.api.email_activity.v3.models.status import Status +from sendgrid.rest.api.email_activity.v3.models.status1 import Status1 +from sendgrid.rest.api.email_activity.v3.models.status2 import Status2 +from sendgrid.rest.api.email_activity.v3.models.status3 import Status3 + +__all__ = [ + "AbbvMessage", + "BounceType", + "BounceType1", + "DownloadCsv200Response", + "EmailActivityResponseBaseProps", + "Event", + "EventName", + "EventName1", + "GetMessage404Response", + "GetMessage404ResponseErrorsInner", + "ListMessage200Response", + "ListMessage400Response", + "ListMessage400ResponseErrorsInner", + "ListMessage429Response", + "ListMessage429ResponseErrorsInner", + "Message", + "OutboundIpType", + "OutboundIpType1", + "RequestCsv202Response", + "Status", + "Status1", + "Status2", + "Status3", +] +# Testing code diff --git a/sendgrid/rest/api/email_activity/v3/models/abbv_message.py b/sendgrid/rest/api/email_activity/v3/models/abbv_message.py new file mode 100644 index 00000000..2a4a3e9f --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/abbv_message.py @@ -0,0 +1,58 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.status import Status + + +class AbbvMessage: + def __init__( + self, + from_email: Optional[str] = None, + msg_id: Optional[str] = None, + subject: Optional[str] = None, + to_email: Optional[str] = None, + status: Optional[Status] = None, + opens_count: Optional[int] = None, + clicks_count: Optional[int] = None, + last_event_time: Optional[str] = None, + ): + self.from_email = from_email + self.msg_id = msg_id + self.subject = subject + self.to_email = to_email + self.status = status + self.opens_count = opens_count + self.clicks_count = clicks_count + self.last_event_time = last_event_time + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "from_email": self.from_email, + "msg_id": self.msg_id, + "subject": self.subject, + "to_email": self.to_email, + "status": self.status, + "opens_count": self.opens_count, + "clicks_count": self.clicks_count, + "last_event_time": self.last_event_time, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AbbvMessage( + from_email=payload.get("from_email"), + msg_id=payload.get("msg_id"), + subject=payload.get("subject"), + to_email=payload.get("to_email"), + status=payload.get("status"), + opens_count=payload.get("opens_count"), + clicks_count=payload.get("clicks_count"), + last_event_time=payload.get("last_event_time"), + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/bounce_type.py b/sendgrid/rest/api/email_activity/v3/models/bounce_type.py new file mode 100644 index 00000000..bdce8d77 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/bounce_type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class BounceType(Enum): + SOFT = "soft" + HARD = "hard" diff --git a/sendgrid/rest/api/email_activity/v3/models/bounce_type1.py b/sendgrid/rest/api/email_activity/v3/models/bounce_type1.py new file mode 100644 index 00000000..3c2483c4 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/bounce_type1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class BounceType1(Enum): + SOFT = "soft" + HARD = "hard" diff --git a/sendgrid/rest/api/email_activity/v3/models/download_csv200_response.py b/sendgrid/rest/api/email_activity/v3/models/download_csv200_response.py new file mode 100644 index 00000000..b7603d16 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/download_csv200_response.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DownloadCsv200Response: + def __init__(self, presigned_url: Optional[str] = None, csv: Optional[str] = None): + self.presigned_url = presigned_url + self.csv = csv + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "presigned_url": self.presigned_url, + "csv": self.csv, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DownloadCsv200Response( + presigned_url=payload.get("presigned_url"), csv=payload.get("csv") + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/email_activity_response_base_props.py b/sendgrid/rest/api/email_activity/v3/models/email_activity_response_base_props.py new file mode 100644 index 00000000..f2e3b5b1 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/email_activity_response_base_props.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.status3 import Status3 + + +class EmailActivityResponseBaseProps: + def __init__( + self, + from_email: Optional[str] = None, + msg_id: Optional[str] = None, + subject: Optional[str] = None, + to_email: Optional[str] = None, + status: Optional[Status3] = None, + ): + self.from_email = from_email + self.msg_id = msg_id + self.subject = subject + self.to_email = to_email + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "from_email": self.from_email, + "msg_id": self.msg_id, + "subject": self.subject, + "to_email": self.to_email, + "status": self.status, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EmailActivityResponseBaseProps( + from_email=payload.get("from_email"), + msg_id=payload.get("msg_id"), + subject=payload.get("subject"), + to_email=payload.get("to_email"), + status=payload.get("status"), + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/event.py b/sendgrid/rest/api/email_activity/v3/models/event.py new file mode 100644 index 00000000..6a28f23c --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/event.py @@ -0,0 +1,59 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.bounce_type import BounceType +from sendgrid.rest.api.email_activity.v3.models.event_name import EventName + + +class Event: + def __init__( + self, + event_name: Optional[EventName] = None, + processed: Optional[str] = None, + reason: Optional[str] = None, + attempt_num: Optional[int] = None, + url: Optional[str] = None, + bounce_type: Optional[BounceType] = None, + http_user_agent: Optional[str] = None, + mx_server: Optional[str] = None, + ): + self.event_name = event_name + self.processed = processed + self.reason = reason + self.attempt_num = attempt_num + self.url = url + self.bounce_type = bounce_type + self.http_user_agent = http_user_agent + self.mx_server = mx_server + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "event_name": self.event_name, + "processed": self.processed, + "reason": self.reason, + "attempt_num": self.attempt_num, + "url": self.url, + "bounce_type": self.bounce_type, + "http_user_agent": self.http_user_agent, + "mx_server": self.mx_server, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Event( + event_name=payload.get("event_name"), + processed=payload.get("processed"), + reason=payload.get("reason"), + attempt_num=payload.get("attempt_num"), + url=payload.get("url"), + bounce_type=payload.get("bounce_type"), + http_user_agent=payload.get("http_user_agent"), + mx_server=payload.get("mx_server"), + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/event_name.py b/sendgrid/rest/api/email_activity/v3/models/event_name.py new file mode 100644 index 00000000..50ee84b9 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/event_name.py @@ -0,0 +1,16 @@ +from enum import Enum +from enum import Enum + + +class EventName(Enum): + BOUNCED = "bounced" + OPENED = "opened" + CLICKED = "clicked" + PROCESSED = "processed" + DROPPED = "dropped" + DELIVERED = "delivered" + DEFERRED = "deferred" + SPAM_REPORT = "spam_report" + UNSUBSCRIBE = "unsubscribe" + GROUP_UNSUBSCRIBE = "group_unsubscribe" + GROUP_RESUBSCRIBE = "group_resubscribe" diff --git a/sendgrid/rest/api/email_activity/v3/models/event_name1.py b/sendgrid/rest/api/email_activity/v3/models/event_name1.py new file mode 100644 index 00000000..e20bb5dc --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/event_name1.py @@ -0,0 +1,16 @@ +from enum import Enum +from enum import Enum + + +class EventName1(Enum): + BOUNCED = "bounced" + OPENED = "opened" + CLICKED = "clicked" + PROCESSED = "processed" + DROPPED = "dropped" + DELIVERED = "delivered" + DEFERRED = "deferred" + SPAM_REPORT = "spam_report" + UNSUBSCRIBE = "unsubscribe" + GROUP_UNSUBSCRIBE = "group_unsubscribe" + GROUP_RESUBSCRIBE = "group_resubscribe" diff --git a/sendgrid/rest/api/email_activity/v3/models/get_message404_response.py b/sendgrid/rest/api/email_activity/v3/models/get_message404_response.py new file mode 100644 index 00000000..fcd14f7b --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/get_message404_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.get_message404_response_errors_inner import ( + GetMessage404ResponseErrorsInner, +) + + +class GetMessage404Response: + def __init__(self, errors: Optional[List[GetMessage404ResponseErrorsInner]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetMessage404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/email_activity/v3/models/get_message404_response_errors_inner.py b/sendgrid/rest/api/email_activity/v3/models/get_message404_response_errors_inner.py new file mode 100644 index 00000000..51564da8 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/get_message404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetMessage404ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetMessage404ResponseErrorsInner( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/list_message200_response.py b/sendgrid/rest/api/email_activity/v3/models/list_message200_response.py new file mode 100644 index 00000000..ae9d3751 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/list_message200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.abbv_message import AbbvMessage + + +class ListMessage200Response: + def __init__(self, messages: Optional[List[AbbvMessage]] = None): + self.messages = messages + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"messages": self.messages}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMessage200Response(messages=payload.get("messages")) diff --git a/sendgrid/rest/api/email_activity/v3/models/list_message400_response.py b/sendgrid/rest/api/email_activity/v3/models/list_message400_response.py new file mode 100644 index 00000000..db425523 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/list_message400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.list_message400_response_errors_inner import ( + ListMessage400ResponseErrorsInner, +) + + +class ListMessage400Response: + def __init__( + self, errors: Optional[List[ListMessage400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMessage400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/email_activity/v3/models/list_message400_response_errors_inner.py b/sendgrid/rest/api/email_activity/v3/models/list_message400_response_errors_inner.py new file mode 100644 index 00000000..95273db2 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/list_message400_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListMessage400ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMessage400ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/email_activity/v3/models/list_message429_response.py b/sendgrid/rest/api/email_activity/v3/models/list_message429_response.py new file mode 100644 index 00000000..62cabc97 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/list_message429_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.list_message429_response_errors_inner import ( + ListMessage429ResponseErrorsInner, +) + + +class ListMessage429Response: + def __init__( + self, errors: Optional[List[ListMessage429ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMessage429Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/email_activity/v3/models/list_message429_response_errors_inner.py b/sendgrid/rest/api/email_activity/v3/models/list_message429_response_errors_inner.py new file mode 100644 index 00000000..c01d1b04 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/list_message429_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListMessage429ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMessage429ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/email_activity/v3/models/message.py b/sendgrid/rest/api/email_activity/v3/models/message.py new file mode 100644 index 00000000..13029610 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/message.py @@ -0,0 +1,88 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.event import Event +from sendgrid.rest.api.email_activity.v3.models.outbound_ip_type import OutboundIpType +from sendgrid.rest.api.email_activity.v3.models.status3 import Status3 + + +class Message: + def __init__( + self, + from_email: Optional[str] = None, + msg_id: Optional[str] = None, + subject: Optional[str] = None, + to_email: Optional[str] = None, + status: Optional[Status3] = None, + template_id: Optional[str] = None, + asm_group_id: Optional[int] = None, + teammate: Optional[str] = None, + api_key_id: Optional[str] = None, + events: Optional[List[Event]] = None, + originating_ip: Optional[str] = None, + categories: Optional[List[str]] = None, + unique_args: Optional[str] = None, + outbound_ip: Optional[str] = None, + outbound_ip_type: Optional[OutboundIpType] = None, + ): + self.from_email = from_email + self.msg_id = msg_id + self.subject = subject + self.to_email = to_email + self.status = status + self.template_id = template_id + self.asm_group_id = asm_group_id + self.teammate = teammate + self.api_key_id = api_key_id + self.events = events + self.originating_ip = originating_ip + self.categories = categories + self.unique_args = unique_args + self.outbound_ip = outbound_ip + self.outbound_ip_type = outbound_ip_type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "from_email": self.from_email, + "msg_id": self.msg_id, + "subject": self.subject, + "to_email": self.to_email, + "status": self.status, + "template_id": self.template_id, + "asm_group_id": self.asm_group_id, + "teammate": self.teammate, + "api_key_id": self.api_key_id, + "events": self.events, + "originating_ip": self.originating_ip, + "categories": self.categories, + "unique_args": self.unique_args, + "outbound_ip": self.outbound_ip, + "outbound_ip_type": self.outbound_ip_type, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Message( + from_email=payload.get("from_email"), + msg_id=payload.get("msg_id"), + subject=payload.get("subject"), + to_email=payload.get("to_email"), + status=payload.get("status"), + template_id=payload.get("template_id"), + asm_group_id=payload.get("asm_group_id"), + teammate=payload.get("teammate"), + api_key_id=payload.get("api_key_id"), + events=payload.get("events"), + originating_ip=payload.get("originating_ip"), + categories=payload.get("categories"), + unique_args=payload.get("unique_args"), + outbound_ip=payload.get("outbound_ip"), + outbound_ip_type=payload.get("outbound_ip_type"), + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/outbound_ip_type.py b/sendgrid/rest/api/email_activity/v3/models/outbound_ip_type.py new file mode 100644 index 00000000..b655556d --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/outbound_ip_type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class OutboundIpType(Enum): + DEDICATED = "dedicated" + SHARED = "shared" diff --git a/sendgrid/rest/api/email_activity/v3/models/outbound_ip_type1.py b/sendgrid/rest/api/email_activity/v3/models/outbound_ip_type1.py new file mode 100644 index 00000000..cfb75cfb --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/outbound_ip_type1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class OutboundIpType1(Enum): + DEDICATED = "dedicated" + SHARED = "shared" diff --git a/sendgrid/rest/api/email_activity/v3/models/request_csv202_response.py b/sendgrid/rest/api/email_activity/v3/models/request_csv202_response.py new file mode 100644 index 00000000..bef128d9 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/request_csv202_response.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_activity.v3.models.status2 import Status2 + + +class RequestCsv202Response: + def __init__(self, status: Optional[Status2] = None, message: Optional[str] = None): + self.status = status + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"status": self.status, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return RequestCsv202Response( + status=payload.get("status"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/email_activity/v3/models/status.py b/sendgrid/rest/api/email_activity/v3/models/status.py new file mode 100644 index 00000000..4d4c31c8 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/status.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status(Enum): + PROCESSED = "processed" + DELIVERED = "delivered" + NOT_DELIVERED = "not_delivered" diff --git a/sendgrid/rest/api/email_activity/v3/models/status1.py b/sendgrid/rest/api/email_activity/v3/models/status1.py new file mode 100644 index 00000000..1bf58363 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/status1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status1(Enum): + PROCESSED = "processed" + NOT_DELIVERED = "not_delivered" + DELIVERED = "delivered" diff --git a/sendgrid/rest/api/email_activity/v3/models/status2.py b/sendgrid/rest/api/email_activity/v3/models/status2.py new file mode 100644 index 00000000..52d9ceba --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/status2.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Status2(Enum): + PENDING = "pending" diff --git a/sendgrid/rest/api/email_activity/v3/models/status3.py b/sendgrid/rest/api/email_activity/v3/models/status3.py new file mode 100644 index 00000000..505b7fe8 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/models/status3.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status3(Enum): + PROCESSED = "processed" + DELIVERED = "delivered" + NOT_DELIVERED = "not_delivered" diff --git a/sendgrid/rest/api/email_activity/v3/request_csv.py b/sendgrid/rest/api/email_activity/v3/request_csv.py new file mode 100644 index 00000000..40223cc8 --- /dev/null +++ b/sendgrid/rest/api/email_activity/v3/request_csv.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Activity API + The Twilio SendGrid Email Activity API allows you to query all of your stored messages, query individual messages, and download a CSV with data about the stored messages. Once retrieved, you can inspect the data associated with your messages to better understand your mail send. For example, you may retrieve all bounced messages or all messages with the same subject line and search for commonalities among them. You must [purchase additional email activity history](https://app.sendgrid.com/settings/billing/addons/email_activity) to gain access to the Email Activity Feed API. See **Getting Started with the Email Activity Feed API** for help building queries and working with this API. You can also work with email activity in the **Activity** section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/email_activity). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class RequestCsv: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + query: Optional[str] = None, + ): + path = "/v3/messages/download" + + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_validation/v3/__init__.py b/sendgrid/rest/api/email_validation/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/email_validation/v3/get_email_job_for_verification.py b/sendgrid/rest/api/email_validation/v3/get_email_job_for_verification.py new file mode 100644 index 00000000..9a825758 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/get_email_job_for_verification.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Address Validation API + The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetEmailJobForVerification: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + job_id: str, + ): + path = "/v3/validations/email/jobs/{job_id}" + path = path.format( + job_id=job_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_validation/v3/get_validations_email_jobs.py b/sendgrid/rest/api/email_validation/v3/get_validations_email_jobs.py new file mode 100644 index 00000000..05761432 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/get_validations_email_jobs.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Address Validation API + The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetValidationsEmailJobs: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/validations/email/jobs" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_validation/v3/list_email_job_for_verification.py b/sendgrid/rest/api/email_validation/v3/list_email_job_for_verification.py new file mode 100644 index 00000000..2b5e257f --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/list_email_job_for_verification.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Address Validation API + The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.email_validation.v3.models.list_email_job_for_verification_request import ( + ListEmailJobForVerificationRequest, +) + + +class ListEmailJobForVerification: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_email_job_for_verification_request: Optional[ + ListEmailJobForVerificationRequest + ] = None, + ): + path = "/v3/validations/email/jobs" + + data = None + if list_email_job_for_verification_request: + data = list_email_job_for_verification_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/__init__.py b/sendgrid/rest/api/email_validation/v3/models/__init__.py new file mode 100644 index 00000000..9c8657b9 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/__init__.py @@ -0,0 +1,92 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Address Validation API + The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.email_validation.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.email_validation.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.email_validation.v3.models.file_type import FileType +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs200_response import ( + GetValidationsEmailJobs200Response, +) +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs200_response_result_inner import ( + GetValidationsEmailJobs200ResponseResultInner, +) +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs_job_id200_response import ( + GetValidationsEmailJobsJobId200Response, +) +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs_job_id200_response_result import ( + GetValidationsEmailJobsJobId200ResponseResult, +) +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs_job_id200_response_result_errors_inner import ( + GetValidationsEmailJobsJobId200ResponseResultErrorsInner, +) +from sendgrid.rest.api.email_validation.v3.models.list_email_job_for_verification_request import ( + ListEmailJobForVerificationRequest, +) +from sendgrid.rest.api.email_validation.v3.models.put_validations_email_jobs200_response import ( + PutValidationsEmailJobs200Response, +) +from sendgrid.rest.api.email_validation.v3.models.put_validations_email_jobs200_response_upload_headers_inner import ( + PutValidationsEmailJobs200ResponseUploadHeadersInner, +) +from sendgrid.rest.api.email_validation.v3.models.status import Status +from sendgrid.rest.api.email_validation.v3.models.status1 import Status1 +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response import ( + ValidateEmail200Response, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result import ( + ValidateEmail200ResponseResult, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks import ( + ValidateEmail200ResponseResultChecks, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks_additional import ( + ValidateEmail200ResponseResultChecksAdditional, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks_domain import ( + ValidateEmail200ResponseResultChecksDomain, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks_local_part import ( + ValidateEmail200ResponseResultChecksLocalPart, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email_request import ( + ValidateEmailRequest, +) +from sendgrid.rest.api.email_validation.v3.models.verdict import Verdict + +__all__ = [ + "ErrorResponse", + "ErrorResponseErrorsInner", + "FileType", + "GetValidationsEmailJobs200Response", + "GetValidationsEmailJobs200ResponseResultInner", + "GetValidationsEmailJobsJobId200Response", + "GetValidationsEmailJobsJobId200ResponseResult", + "GetValidationsEmailJobsJobId200ResponseResultErrorsInner", + "ListEmailJobForVerificationRequest", + "PutValidationsEmailJobs200Response", + "PutValidationsEmailJobs200ResponseUploadHeadersInner", + "Status", + "Status1", + "ValidateEmail200Response", + "ValidateEmail200ResponseResult", + "ValidateEmail200ResponseResultChecks", + "ValidateEmail200ResponseResultChecksAdditional", + "ValidateEmail200ResponseResultChecksDomain", + "ValidateEmail200ResponseResultChecksLocalPart", + "ValidateEmailRequest", + "Verdict", +] +# Testing code diff --git a/sendgrid/rest/api/email_validation/v3/models/error_response.py b/sendgrid/rest/api/email_validation/v3/models/error_response.py new file mode 100644 index 00000000..c18d08ba --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/email_validation/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/email_validation/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/file_type.py b/sendgrid/rest/api/email_validation/v3/models/file_type.py new file mode 100644 index 00000000..3a18dabb --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/file_type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class FileType(Enum): + CSV = "csv" + ZIP = "zip" diff --git a/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response.py b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response.py new file mode 100644 index 00000000..7ad211e1 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs200_response_result_inner import ( + GetValidationsEmailJobs200ResponseResultInner, +) + + +class GetValidationsEmailJobs200Response: + def __init__( + self, + result: Optional[List[GetValidationsEmailJobs200ResponseResultInner]] = None, + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetValidationsEmailJobs200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response_result_inner.py b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response_result_inner.py new file mode 100644 index 00000000..ca80c838 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs200_response_result_inner.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.status import Status + + +class GetValidationsEmailJobs200ResponseResultInner: + def __init__( + self, + id: Optional[str] = None, + status: Optional[Status] = None, + started_at: Optional[float] = None, + finished_at: Optional[float] = None, + ): + self.id = id + self.status = status + self.started_at = started_at + self.finished_at = finished_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "status": self.status, + "started_at": self.started_at, + "finished_at": self.finished_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetValidationsEmailJobs200ResponseResultInner( + id=payload.get("id"), + status=payload.get("status"), + started_at=payload.get("started_at"), + finished_at=payload.get("finished_at"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response.py b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response.py new file mode 100644 index 00000000..5b3b8a79 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs_job_id200_response_result import ( + GetValidationsEmailJobsJobId200ResponseResult, +) + + +class GetValidationsEmailJobsJobId200Response: + def __init__( + self, result: Optional[GetValidationsEmailJobsJobId200ResponseResult] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetValidationsEmailJobsJobId200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result.py b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result.py new file mode 100644 index 00000000..86524246 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result.py @@ -0,0 +1,63 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.get_validations_email_jobs_job_id200_response_result_errors_inner import ( + GetValidationsEmailJobsJobId200ResponseResultErrorsInner, +) +from sendgrid.rest.api.email_validation.v3.models.status1 import Status1 + + +class GetValidationsEmailJobsJobId200ResponseResult: + def __init__( + self, + id: Optional[str] = None, + status: Optional[Status1] = None, + segments: Optional[float] = None, + segments_processed: Optional[float] = None, + is_download_available: Optional[bool] = None, + started_at: Optional[float] = None, + finished_at: Optional[float] = None, + errors: Optional[ + List[GetValidationsEmailJobsJobId200ResponseResultErrorsInner] + ] = None, + ): + self.id = id + self.status = status + self.segments = segments + self.segments_processed = segments_processed + self.is_download_available = is_download_available + self.started_at = started_at + self.finished_at = finished_at + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "status": self.status, + "segments": self.segments, + "segments_processed": self.segments_processed, + "is_download_available": self.is_download_available, + "started_at": self.started_at, + "finished_at": self.finished_at, + "errors": self.errors, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetValidationsEmailJobsJobId200ResponseResult( + id=payload.get("id"), + status=payload.get("status"), + segments=payload.get("segments"), + segments_processed=payload.get("segments_processed"), + is_download_available=payload.get("is_download_available"), + started_at=payload.get("started_at"), + finished_at=payload.get("finished_at"), + errors=payload.get("errors"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result_errors_inner.py b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result_errors_inner.py new file mode 100644 index 00000000..9294889e --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/get_validations_email_jobs_job_id200_response_result_errors_inner.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetValidationsEmailJobsJobId200ResponseResultErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetValidationsEmailJobsJobId200ResponseResultErrorsInner( + message=payload.get("message") + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/list_email_job_for_verification_request.py b/sendgrid/rest/api/email_validation/v3/models/list_email_job_for_verification_request.py new file mode 100644 index 00000000..0e607bfb --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/list_email_job_for_verification_request.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.file_type import FileType + + +class ListEmailJobForVerificationRequest: + def __init__(self, file_type: Optional[FileType] = None): + self.file_type = file_type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"file_type": self.file_type}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListEmailJobForVerificationRequest(file_type=payload.get("file_type")) diff --git a/sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response.py b/sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response.py new file mode 100644 index 00000000..bb3997db --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.put_validations_email_jobs200_response_upload_headers_inner import ( + PutValidationsEmailJobs200ResponseUploadHeadersInner, +) + + +class PutValidationsEmailJobs200Response: + def __init__( + self, + job_id: Optional[str] = None, + upload_uri: Optional[str] = None, + upload_headers: Optional[ + List[PutValidationsEmailJobs200ResponseUploadHeadersInner] + ] = None, + ): + self.job_id = job_id + self.upload_uri = upload_uri + self.upload_headers = upload_headers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "job_id": self.job_id, + "upload_uri": self.upload_uri, + "upload_headers": self.upload_headers, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PutValidationsEmailJobs200Response( + job_id=payload.get("job_id"), + upload_uri=payload.get("upload_uri"), + upload_headers=payload.get("upload_headers"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response_upload_headers_inner.py b/sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response_upload_headers_inner.py new file mode 100644 index 00000000..090c143a --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/put_validations_email_jobs200_response_upload_headers_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class PutValidationsEmailJobs200ResponseUploadHeadersInner: + def __init__(self, header: Optional[str] = None, value: Optional[str] = None): + self.header = header + self.value = value + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"header": self.header, "value": self.value}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PutValidationsEmailJobs200ResponseUploadHeadersInner( + header=payload.get("header"), value=payload.get("value") + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/status.py b/sendgrid/rest/api/email_validation/v3/models/status.py new file mode 100644 index 00000000..8c2f08b9 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/status.py @@ -0,0 +1,11 @@ +from enum import Enum +from enum import Enum + + +class Status(Enum): + INITIATED = "Initiated" + QUEUED = "Queued" + READY = "Ready" + PROCESSING = "Processing" + DONE = "Done" + ERROR = "Error" diff --git a/sendgrid/rest/api/email_validation/v3/models/status1.py b/sendgrid/rest/api/email_validation/v3/models/status1.py new file mode 100644 index 00000000..832b9980 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/status1.py @@ -0,0 +1,11 @@ +from enum import Enum +from enum import Enum + + +class Status1(Enum): + INITIATED = "Initiated" + QUEUED = "Queued" + READY = "Ready" + PROCESSING = "Processing" + DONE = "Done" + ERROR = "Error" diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email200_response.py b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response.py new file mode 100644 index 00000000..e79d63b8 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result import ( + ValidateEmail200ResponseResult, +) + + +class ValidateEmail200Response: + def __init__(self, result: Optional[ValidateEmail200ResponseResult] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmail200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result.py b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result.py new file mode 100644 index 00000000..0bb5e39b --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result.py @@ -0,0 +1,65 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks import ( + ValidateEmail200ResponseResultChecks, +) +from sendgrid.rest.api.email_validation.v3.models.verdict import Verdict + + +class ValidateEmail200ResponseResult: + def __init__( + self, + email: Optional[str] = None, + verdict: Optional[Verdict] = None, + score: Optional[float] = None, + local: Optional[str] = None, + host: Optional[str] = None, + suggestion: Optional[str] = None, + checks: Optional[ValidateEmail200ResponseResultChecks] = None, + source: Optional[str] = None, + ip_address: Optional[str] = None, + ): + self.email = email + self.verdict = verdict + self.score = score + self.local = local + self.host = host + self.suggestion = suggestion + self.checks = checks + self.source = source + self.ip_address = ip_address + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "verdict": self.verdict, + "score": self.score, + "local": self.local, + "host": self.host, + "suggestion": self.suggestion, + "checks": self.checks, + "source": self.source, + "ip_address": self.ip_address, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmail200ResponseResult( + email=payload.get("email"), + verdict=payload.get("verdict"), + score=payload.get("score"), + local=payload.get("local"), + host=payload.get("host"), + suggestion=payload.get("suggestion"), + checks=payload.get("checks"), + source=payload.get("source"), + ip_address=payload.get("ip_address"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks.py b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks.py new file mode 100644 index 00000000..b6163bbd --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks_additional import ( + ValidateEmail200ResponseResultChecksAdditional, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks_domain import ( + ValidateEmail200ResponseResultChecksDomain, +) +from sendgrid.rest.api.email_validation.v3.models.validate_email200_response_result_checks_local_part import ( + ValidateEmail200ResponseResultChecksLocalPart, +) + + +class ValidateEmail200ResponseResultChecks: + def __init__( + self, + domain: Optional[ValidateEmail200ResponseResultChecksDomain] = None, + local_part: Optional[ValidateEmail200ResponseResultChecksLocalPart] = None, + additional: Optional[ValidateEmail200ResponseResultChecksAdditional] = None, + ): + self.domain = domain + self.local_part = local_part + self.additional = additional + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "domain": self.domain, + "local_part": self.local_part, + "additional": self.additional, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmail200ResponseResultChecks( + domain=payload.get("domain"), + local_part=payload.get("local_part"), + additional=payload.get("additional"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_additional.py b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_additional.py new file mode 100644 index 00000000..1780941b --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_additional.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateEmail200ResponseResultChecksAdditional: + def __init__( + self, + has_known_bounces: Optional[bool] = None, + has_suspected_bounces: Optional[bool] = None, + ): + self.has_known_bounces = has_known_bounces + self.has_suspected_bounces = has_suspected_bounces + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "has_known_bounces": self.has_known_bounces, + "has_suspected_bounces": self.has_suspected_bounces, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmail200ResponseResultChecksAdditional( + has_known_bounces=payload.get("has_known_bounces"), + has_suspected_bounces=payload.get("has_suspected_bounces"), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_domain.py b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_domain.py new file mode 100644 index 00000000..fb7a3286 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_domain.py @@ -0,0 +1,39 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateEmail200ResponseResultChecksDomain: + def __init__( + self, + has_valid_address_syntax: Optional[bool] = None, + has_mx_or_a_record: Optional[bool] = None, + is_suspected_disposable_address: Optional[bool] = None, + ): + self.has_valid_address_syntax = has_valid_address_syntax + self.has_mx_or_a_record = has_mx_or_a_record + self.is_suspected_disposable_address = is_suspected_disposable_address + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "has_valid_address_syntax": self.has_valid_address_syntax, + "has_mx_or_a_record": self.has_mx_or_a_record, + "is_suspected_disposable_address": self.is_suspected_disposable_address, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmail200ResponseResultChecksDomain( + has_valid_address_syntax=payload.get("has_valid_address_syntax"), + has_mx_or_a_record=payload.get("has_mx_or_a_record"), + is_suspected_disposable_address=payload.get( + "is_suspected_disposable_address" + ), + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_local_part.py b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_local_part.py new file mode 100644 index 00000000..3ad81ce1 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email200_response_result_checks_local_part.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateEmail200ResponseResultChecksLocalPart: + def __init__(self, is_suspected_role_address: Optional[bool] = None): + self.is_suspected_role_address = is_suspected_role_address + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "is_suspected_role_address": self.is_suspected_role_address + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmail200ResponseResultChecksLocalPart( + is_suspected_role_address=payload.get("is_suspected_role_address") + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/validate_email_request.py b/sendgrid/rest/api/email_validation/v3/models/validate_email_request.py new file mode 100644 index 00000000..2a28f268 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/validate_email_request.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateEmailRequest: + def __init__(self, email: Optional[str] = None, source: Optional[str] = None): + self.email = email + self.source = source + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "source": self.source}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateEmailRequest( + email=payload.get("email"), source=payload.get("source") + ) diff --git a/sendgrid/rest/api/email_validation/v3/models/verdict.py b/sendgrid/rest/api/email_validation/v3/models/verdict.py new file mode 100644 index 00000000..4ef9941b --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/models/verdict.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Verdict(Enum): + VALID = "Valid" + RISKY = "Risky" + INVALID = "Invalid" diff --git a/sendgrid/rest/api/email_validation/v3/validate_email.py b/sendgrid/rest/api/email_validation/v3/validate_email.py new file mode 100644 index 00000000..e9478ad9 --- /dev/null +++ b/sendgrid/rest/api/email_validation/v3/validate_email.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Email Address Validation API + The Twilio SendGrid Email Address Validation API provides real-time detailed information on the validity of email addresses. You can integrate this validation process into your platform's signup form and customize the best use of email address validation for your use case. Email Address Validation is available to [Email API Pro and Premier level accounts](https://sendgrid.com/pricing) only. Prior to upgrading your account to Pro or Premier, you will not see the option to create an Email Validation API key. An Email Validation API key is separate from and in addition to your other keys, including Full Access API keys. You can use this API to: - Indicate to users that the address they have entered into a form is invalid. - Drop invalid email addresses from your database. - Suppress invalid email addresses from your sending to decrease your bounce rate. See [**Email Address Validation**](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation) for more information. You can also view your Email Validation results and metrics in the Validation section of the [Twilio SendGrid application user interface](https://docs.sendgrid.com/ui/managing-contacts/email-address-validation). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.email_validation.v3.models.validate_email_request import ( + ValidateEmailRequest, +) + + +class ValidateEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + validate_email_request: Optional[ValidateEmailRequest] = None, + ): + path = "/v3/validations/email" + + data = None + if validate_email_request: + data = validate_email_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/enforced_tls/v3/__init__.py b/sendgrid/rest/api/enforced_tls/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/enforced_tls/v3/list_enforced_tls_setting.py b/sendgrid/rest/api/enforced_tls/v3/list_enforced_tls_setting.py new file mode 100644 index 00000000..e8a09c8b --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/list_enforced_tls_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Enforced TLS API + The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListEnforcedTlsSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/settings/enforced_tls" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/enforced_tls/v3/models/__init__.py b/sendgrid/rest/api/enforced_tls/v3/models/__init__.py new file mode 100644 index 00000000..7be2a73e --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/models/__init__.py @@ -0,0 +1,30 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Enforced TLS API + The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.enforced_tls.v3.models.enforced_tls_request_response import ( + EnforcedTlsRequestResponse, +) +from sendgrid.rest.api.enforced_tls.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.enforced_tls.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.enforced_tls.v3.models.version import Version + +__all__ = [ + "EnforcedTlsRequestResponse", + "ErrorResponse", + "ErrorResponseErrorsInner", + "Version", +] +# Testing code diff --git a/sendgrid/rest/api/enforced_tls/v3/models/enforced_tls_request_response.py b/sendgrid/rest/api/enforced_tls/v3/models/enforced_tls_request_response.py new file mode 100644 index 00000000..7e51e61d --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/models/enforced_tls_request_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.enforced_tls.v3.models.version import Version + + +class EnforcedTlsRequestResponse: + def __init__( + self, + require_tls: Optional[bool] = None, + require_valid_cert: Optional[bool] = None, + version: Optional[Version] = None, + ): + self.require_tls = require_tls + self.require_valid_cert = require_valid_cert + self.version = version + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "require_tls": self.require_tls, + "require_valid_cert": self.require_valid_cert, + "version": self.version, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EnforcedTlsRequestResponse( + require_tls=payload.get("require_tls"), + require_valid_cert=payload.get("require_valid_cert"), + version=payload.get("version"), + ) diff --git a/sendgrid/rest/api/enforced_tls/v3/models/error_response.py b/sendgrid/rest/api/enforced_tls/v3/models/error_response.py new file mode 100644 index 00000000..b7b92c1b --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.enforced_tls.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/enforced_tls/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/enforced_tls/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/enforced_tls/v3/models/version.py b/sendgrid/rest/api/enforced_tls/v3/models/version.py new file mode 100644 index 00000000..a2c3e2f4 --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/models/version.py @@ -0,0 +1,12 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Version(Enum): + NUMBER_1.1=1.1 + NUMBER_1.2=1.2 + NUMBER_1.3=1.3 + diff --git a/sendgrid/rest/api/enforced_tls/v3/update_enforced_tls_setting.py b/sendgrid/rest/api/enforced_tls/v3/update_enforced_tls_setting.py new file mode 100644 index 00000000..0f38db15 --- /dev/null +++ b/sendgrid/rest/api/enforced_tls/v3/update_enforced_tls_setting.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Enforced TLS API + The Twilio SendGrid Enforced TLS API allows you to specify whether or not the recipient of your mail send is required to support TLS or have a valid certificate. Twilio SendGrid sends all emails with [Opportunistic TLS](https://sendgrid.com/blog/myth-opportunistic-tls-email-privacy/) by default, meaning email is sent with TLS, and if the recipient's inbox provider does not accept the TLS encryption, we then send the message unencrypted. You can optionally choose to enforce TLS encryption, meaning that if the recipient's inbox provider does not accept the TLS encryption, Twilio SendGrid drops the message and sends a block event with the message, “TLS required but not supported” as the description. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.enforced_tls.v3.models.enforced_tls_request_response import ( + EnforcedTlsRequestResponse, +) + + +class UpdateEnforcedTlsSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + enforced_tls_request_response: Optional[EnforcedTlsRequestResponse] = None, + ): + path = "/v3/user/settings/enforced_tls" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if enforced_tls_request_response: + data = enforced_tls_request_response.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/integrations/v3/__init__.py b/sendgrid/rest/api/integrations/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/integrations/v3/add_integration.py b/sendgrid/rest/api/integrations/v3/add_integration.py new file mode 100644 index 00000000..c5471c33 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/add_integration.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Integrations API + Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.integrations.v3.models.integration_input import IntegrationInput + + +class AddIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + integration_input: Optional[IntegrationInput] = None, + ): + path = "/v3/marketing/integrations" + + data = None + if integration_input: + data = integration_input.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/integrations/v3/delete_integration.py b/sendgrid/rest/api/integrations/v3/delete_integration.py new file mode 100644 index 00000000..7fa999e0 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/delete_integration.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Integrations API + Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List +from sendgrid.rest.api.integrations.v3.models.id import Id + + +class DeleteIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ids: Optional[List[Id]] = None, + ): + path = "/v3/marketing/integrations" + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/integrations/v3/find_integration_by_id.py b/sendgrid/rest/api/integrations/v3/find_integration_by_id.py new file mode 100644 index 00000000..b9d247b9 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/find_integration_by_id.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Integrations API + Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class FindIntegrationById: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/integrations/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/integrations/v3/get_integrations_by_user.py b/sendgrid/rest/api/integrations/v3/get_integrations_by_user.py new file mode 100644 index 00000000..0a9c331f --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/get_integrations_by_user.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Integrations API + Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetIntegrationsByUser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/marketing/integrations" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/integrations/v3/models/__init__.py b/sendgrid/rest/api/integrations/v3/models/__init__.py new file mode 100644 index 00000000..84f8ddfe --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/__init__.py @@ -0,0 +1,114 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Integrations API + Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.integrations.v3.models.add_integration400_response import ( + AddIntegration400Response, +) +from sendgrid.rest.api.integrations.v3.models.delete_integration400_response import ( + DeleteIntegration400Response, +) +from sendgrid.rest.api.integrations.v3.models.delete_integration404_response import ( + DeleteIntegration404Response, +) +from sendgrid.rest.api.integrations.v3.models.destination import Destination +from sendgrid.rest.api.integrations.v3.models.destination1 import Destination1 +from sendgrid.rest.api.integrations.v3.models.destination2 import Destination2 +from sendgrid.rest.api.integrations.v3.models.destination3 import Destination3 +from sendgrid.rest.api.integrations.v3.models.destination_region import ( + DestinationRegion, +) +from sendgrid.rest.api.integrations.v3.models.destination_region1 import ( + DestinationRegion1, +) +from sendgrid.rest.api.integrations.v3.models.destination_region2 import ( + DestinationRegion2, +) +from sendgrid.rest.api.integrations.v3.models.forbidden import Forbidden +from sendgrid.rest.api.integrations.v3.models.get_integrations_by_user200_response import ( + GetIntegrationsByUser200Response, +) +from sendgrid.rest.api.integrations.v3.models.get_integrations_by_user403_response import ( + GetIntegrationsByUser403Response, +) +from sendgrid.rest.api.integrations.v3.models.get_integrations_by_user500_response import ( + GetIntegrationsByUser500Response, +) +from sendgrid.rest.api.integrations.v3.models.id import Id +from sendgrid.rest.api.integrations.v3.models.integration import Integration +from sendgrid.rest.api.integrations.v3.models.integration_filters import ( + IntegrationFilters, +) +from sendgrid.rest.api.integrations.v3.models.integration_input import IntegrationInput +from sendgrid.rest.api.integrations.v3.models.integration_input_filters import ( + IntegrationInputFilters, +) +from sendgrid.rest.api.integrations.v3.models.integration_input_properties import ( + IntegrationInputProperties, +) +from sendgrid.rest.api.integrations.v3.models.integration_not_found import ( + IntegrationNotFound, +) +from sendgrid.rest.api.integrations.v3.models.integration_patch import IntegrationPatch +from sendgrid.rest.api.integrations.v3.models.integration_patch_filters import ( + IntegrationPatchFilters, +) +from sendgrid.rest.api.integrations.v3.models.integration_patch_properties import ( + IntegrationPatchProperties, +) +from sendgrid.rest.api.integrations.v3.models.integration_properties import ( + IntegrationProperties, +) +from sendgrid.rest.api.integrations.v3.models.internal_error import InternalError +from sendgrid.rest.api.integrations.v3.models.invalid_delete_request import ( + InvalidDeleteRequest, +) +from sendgrid.rest.api.integrations.v3.models.invalid_request import InvalidRequest +from sendgrid.rest.api.integrations.v3.models.items import Items +from sendgrid.rest.api.integrations.v3.models.items1 import Items1 +from sendgrid.rest.api.integrations.v3.models.items2 import Items2 + +__all__ = [ + "AddIntegration400Response", + "DeleteIntegration400Response", + "DeleteIntegration404Response", + "Destination", + "Destination1", + "Destination2", + "Destination3", + "DestinationRegion", + "DestinationRegion1", + "DestinationRegion2", + "Forbidden", + "GetIntegrationsByUser200Response", + "GetIntegrationsByUser403Response", + "GetIntegrationsByUser500Response", + "Id", + "Integration", + "IntegrationFilters", + "IntegrationInput", + "IntegrationInputFilters", + "IntegrationInputProperties", + "IntegrationNotFound", + "IntegrationPatch", + "IntegrationPatchFilters", + "IntegrationPatchProperties", + "IntegrationProperties", + "InternalError", + "InvalidDeleteRequest", + "InvalidRequest", + "Items", + "Items1", + "Items2", +] +# Testing code diff --git a/sendgrid/rest/api/integrations/v3/models/add_integration400_response.py b/sendgrid/rest/api/integrations/v3/models/add_integration400_response.py new file mode 100644 index 00000000..fce225b4 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/add_integration400_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.invalid_request import InvalidRequest + + +class AddIntegration400Response: + def __init__(self, errors: Optional[List[InvalidRequest]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIntegration400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/integrations/v3/models/delete_integration400_response.py b/sendgrid/rest/api/integrations/v3/models/delete_integration400_response.py new file mode 100644 index 00000000..e4d68f5a --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/delete_integration400_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.invalid_delete_request import ( + InvalidDeleteRequest, +) + + +class DeleteIntegration400Response: + def __init__(self, errors: Optional[List[InvalidDeleteRequest]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteIntegration400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/integrations/v3/models/delete_integration404_response.py b/sendgrid/rest/api/integrations/v3/models/delete_integration404_response.py new file mode 100644 index 00000000..947cb9f1 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/delete_integration404_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.integration_not_found import ( + IntegrationNotFound, +) + + +class DeleteIntegration404Response: + def __init__(self, errors: Optional[List[IntegrationNotFound]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteIntegration404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/integrations/v3/models/destination.py b/sendgrid/rest/api/integrations/v3/models/destination.py new file mode 100644 index 00000000..b20076aa --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Destination(Enum): + SEGMENT = "Segment" diff --git a/sendgrid/rest/api/integrations/v3/models/destination1.py b/sendgrid/rest/api/integrations/v3/models/destination1.py new file mode 100644 index 00000000..910adf3b --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination1.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Destination1(Enum): + SEGMENT = "Segment" diff --git a/sendgrid/rest/api/integrations/v3/models/destination2.py b/sendgrid/rest/api/integrations/v3/models/destination2.py new file mode 100644 index 00000000..0652cb82 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination2.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Destination2(Enum): + SEGMENT = "Segment" diff --git a/sendgrid/rest/api/integrations/v3/models/destination3.py b/sendgrid/rest/api/integrations/v3/models/destination3.py new file mode 100644 index 00000000..faf62600 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination3.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Destination3(Enum): + SEGMENT = "Segment" diff --git a/sendgrid/rest/api/integrations/v3/models/destination_region.py b/sendgrid/rest/api/integrations/v3/models/destination_region.py new file mode 100644 index 00000000..66337614 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination_region.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class DestinationRegion(Enum): + EU = "EU" + US = "US" diff --git a/sendgrid/rest/api/integrations/v3/models/destination_region1.py b/sendgrid/rest/api/integrations/v3/models/destination_region1.py new file mode 100644 index 00000000..6cea4e2a --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination_region1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class DestinationRegion1(Enum): + EU = "EU" + US = "US" diff --git a/sendgrid/rest/api/integrations/v3/models/destination_region2.py b/sendgrid/rest/api/integrations/v3/models/destination_region2.py new file mode 100644 index 00000000..5fa64740 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/destination_region2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class DestinationRegion2(Enum): + EU = "EU" + US = "US" diff --git a/sendgrid/rest/api/integrations/v3/models/forbidden.py b/sendgrid/rest/api/integrations/v3/models/forbidden.py new file mode 100644 index 00000000..1ec4602e --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/forbidden.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Forbidden: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Forbidden(message=payload.get("message")) diff --git a/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user200_response.py b/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user200_response.py new file mode 100644 index 00000000..681d061a --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.integration import Integration + + +class GetIntegrationsByUser200Response: + def __init__(self, result: Optional[List[Integration]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIntegrationsByUser200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user403_response.py b/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user403_response.py new file mode 100644 index 00000000..1b1fab18 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user403_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.forbidden import Forbidden + + +class GetIntegrationsByUser403Response: + def __init__(self, errors: Optional[List[Forbidden]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIntegrationsByUser403Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user500_response.py b/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user500_response.py new file mode 100644 index 00000000..8a60898b --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/get_integrations_by_user500_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.internal_error import InternalError + + +class GetIntegrationsByUser500Response: + def __init__(self, errors: Optional[List[InternalError]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIntegrationsByUser500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/integrations/v3/models/id.py b/sendgrid/rest/api/integrations/v3/models/id.py new file mode 100644 index 00000000..fcd5b588 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/id.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Id: + def __init__(self, integration_id: Optional[str] = None): + self.integration_id = integration_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"integration_id": self.integration_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Id(integration_id=payload.get("integration_id")) diff --git a/sendgrid/rest/api/integrations/v3/models/integration.py b/sendgrid/rest/api/integrations/v3/models/integration.py new file mode 100644 index 00000000..dd75b3d9 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration.py @@ -0,0 +1,56 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.destination3 import Destination3 +from sendgrid.rest.api.integrations.v3.models.integration_filters import ( + IntegrationFilters, +) +from sendgrid.rest.api.integrations.v3.models.integration_properties import ( + IntegrationProperties, +) + + +class Integration: + def __init__( + self, + integration_id: Optional[str] = None, + user_id: Optional[str] = None, + filters: Optional[IntegrationFilters] = None, + properties: Optional[IntegrationProperties] = None, + label: Optional[str] = None, + destination: Optional[Destination3] = None, + ): + self.integration_id = integration_id + self.user_id = user_id + self.filters = filters + self.properties = properties + self.label = label + self.destination = destination + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "integration_id": self.integration_id, + "user_id": self.user_id, + "filters": self.filters, + "properties": self.properties, + "label": self.label, + "destination": self.destination, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Integration( + integration_id=payload.get("integration_id"), + user_id=payload.get("user_id"), + filters=payload.get("filters"), + properties=payload.get("properties"), + label=payload.get("label"), + destination=payload.get("destination"), + ) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_filters.py b/sendgrid/rest/api/integrations/v3/models/integration_filters.py new file mode 100644 index 00000000..958a68d0 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_filters.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.items2 import Items2 + + +class IntegrationFilters: + def __init__(self, email_events: Optional[List[Items2]] = None): + self.email_events = email_events + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email_events": self.email_events}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationFilters(email_events=payload.get("email_events")) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_input.py b/sendgrid/rest/api/integrations/v3/models/integration_input.py new file mode 100644 index 00000000..037110ae --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_input.py @@ -0,0 +1,48 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.destination2 import Destination2 +from sendgrid.rest.api.integrations.v3.models.integration_input_filters import ( + IntegrationInputFilters, +) +from sendgrid.rest.api.integrations.v3.models.integration_input_properties import ( + IntegrationInputProperties, +) + + +class IntegrationInput: + def __init__( + self, + destination: Optional[Destination2] = None, + filters: Optional[IntegrationInputFilters] = None, + properties: Optional[IntegrationInputProperties] = None, + label: Optional[str] = None, + ): + self.destination = destination + self.filters = filters + self.properties = properties + self.label = label + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "destination": self.destination, + "filters": self.filters, + "properties": self.properties, + "label": self.label, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationInput( + destination=payload.get("destination"), + filters=payload.get("filters"), + properties=payload.get("properties"), + label=payload.get("label"), + ) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_input_filters.py b/sendgrid/rest/api/integrations/v3/models/integration_input_filters.py new file mode 100644 index 00000000..6122e107 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_input_filters.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.items1 import Items1 + + +class IntegrationInputFilters: + def __init__(self, email_events: Optional[List[Items1]] = None): + self.email_events = email_events + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email_events": self.email_events}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationInputFilters(email_events=payload.get("email_events")) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_input_properties.py b/sendgrid/rest/api/integrations/v3/models/integration_input_properties.py new file mode 100644 index 00000000..dc31cf5b --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_input_properties.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.destination_region1 import ( + DestinationRegion1, +) + + +class IntegrationInputProperties: + def __init__( + self, + write_key: Optional[str] = None, + destination_region: Optional[DestinationRegion1] = None, + ): + self.write_key = write_key + self.destination_region = destination_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "write_key": self.write_key, + "destination_region": self.destination_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationInputProperties( + write_key=payload.get("write_key"), + destination_region=payload.get("destination_region"), + ) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_not_found.py b/sendgrid/rest/api/integrations/v3/models/integration_not_found.py new file mode 100644 index 00000000..2b9e0e80 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_not_found.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class IntegrationNotFound: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationNotFound(message=payload.get("message")) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_patch.py b/sendgrid/rest/api/integrations/v3/models/integration_patch.py new file mode 100644 index 00000000..8aafc750 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_patch.py @@ -0,0 +1,48 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.destination1 import Destination1 +from sendgrid.rest.api.integrations.v3.models.integration_patch_filters import ( + IntegrationPatchFilters, +) +from sendgrid.rest.api.integrations.v3.models.integration_patch_properties import ( + IntegrationPatchProperties, +) + + +class IntegrationPatch: + def __init__( + self, + destination: Optional[Destination1] = None, + filters: Optional[IntegrationPatchFilters] = None, + properties: Optional[IntegrationPatchProperties] = None, + label: Optional[str] = None, + ): + self.destination = destination + self.filters = filters + self.properties = properties + self.label = label + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "destination": self.destination, + "filters": self.filters, + "properties": self.properties, + "label": self.label, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationPatch( + destination=payload.get("destination"), + filters=payload.get("filters"), + properties=payload.get("properties"), + label=payload.get("label"), + ) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_patch_filters.py b/sendgrid/rest/api/integrations/v3/models/integration_patch_filters.py new file mode 100644 index 00000000..e37790fd --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_patch_filters.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.items import Items + + +class IntegrationPatchFilters: + def __init__(self, email_events: Optional[List[Items]] = None): + self.email_events = email_events + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email_events": self.email_events}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationPatchFilters(email_events=payload.get("email_events")) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_patch_properties.py b/sendgrid/rest/api/integrations/v3/models/integration_patch_properties.py new file mode 100644 index 00000000..34377747 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_patch_properties.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.destination_region import ( + DestinationRegion, +) + + +class IntegrationPatchProperties: + def __init__( + self, + write_key: Optional[str] = None, + destination_region: Optional[DestinationRegion] = None, + ): + self.write_key = write_key + self.destination_region = destination_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "write_key": self.write_key, + "destination_region": self.destination_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationPatchProperties( + write_key=payload.get("write_key"), + destination_region=payload.get("destination_region"), + ) diff --git a/sendgrid/rest/api/integrations/v3/models/integration_properties.py b/sendgrid/rest/api/integrations/v3/models/integration_properties.py new file mode 100644 index 00000000..e45e6ea7 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/integration_properties.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.integrations.v3.models.destination_region2 import ( + DestinationRegion2, +) + + +class IntegrationProperties: + def __init__( + self, + write_key: Optional[str] = None, + destination_region: Optional[DestinationRegion2] = None, + ): + self.write_key = write_key + self.destination_region = destination_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "write_key": self.write_key, + "destination_region": self.destination_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IntegrationProperties( + write_key=payload.get("write_key"), + destination_region=payload.get("destination_region"), + ) diff --git a/sendgrid/rest/api/integrations/v3/models/internal_error.py b/sendgrid/rest/api/integrations/v3/models/internal_error.py new file mode 100644 index 00000000..1848607f --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/internal_error.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InternalError: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InternalError(message=payload.get("message")) diff --git a/sendgrid/rest/api/integrations/v3/models/invalid_delete_request.py b/sendgrid/rest/api/integrations/v3/models/invalid_delete_request.py new file mode 100644 index 00000000..47ffe01c --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/invalid_delete_request.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InvalidDeleteRequest: + def __init__(self, message: Optional[str] = None, parameter: Optional[str] = None): + self.message = message + self.parameter = parameter + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "parameter": self.parameter, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InvalidDeleteRequest( + message=payload.get("message"), parameter=payload.get("parameter") + ) diff --git a/sendgrid/rest/api/integrations/v3/models/invalid_request.py b/sendgrid/rest/api/integrations/v3/models/invalid_request.py new file mode 100644 index 00000000..a0d127c1 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/invalid_request.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InvalidRequest: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InvalidRequest( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/integrations/v3/models/items.py b/sendgrid/rest/api/integrations/v3/models/items.py new file mode 100644 index 00000000..f754e3bd --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/items.py @@ -0,0 +1,17 @@ +from enum import Enum +from enum import Enum + + +class Items(Enum): + DROP = "drop" + PROCESSED = "processed" + DEFERRED = "deferred" + GROUP_UNSUBSCRIBE = "group_unsubscribe" + BOUNCE = "bounce" + DELIVERED = "delivered" + CLICK = "click" + UNSUBSCRIBE = "unsubscribe" + OPEN = "open" + GROUP_RESUBSCRIBE = "group_resubscribe" + SPAMREPORT = "spamreport" + MACHINE_OPENED = "machine_opened" diff --git a/sendgrid/rest/api/integrations/v3/models/items1.py b/sendgrid/rest/api/integrations/v3/models/items1.py new file mode 100644 index 00000000..3ddd6a4d --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/items1.py @@ -0,0 +1,17 @@ +from enum import Enum +from enum import Enum + + +class Items1(Enum): + DROP = "drop" + PROCESSED = "processed" + DEFERRED = "deferred" + GROUP_UNSUBSCRIBE = "group_unsubscribe" + BOUNCE = "bounce" + DELIVERED = "delivered" + CLICK = "click" + UNSUBSCRIBE = "unsubscribe" + OPEN = "open" + GROUP_RESUBSCRIBE = "group_resubscribe" + SPAMREPORT = "spamreport" + MACHINE_OPENED = "machine_opened" diff --git a/sendgrid/rest/api/integrations/v3/models/items2.py b/sendgrid/rest/api/integrations/v3/models/items2.py new file mode 100644 index 00000000..546315ce --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/models/items2.py @@ -0,0 +1,17 @@ +from enum import Enum +from enum import Enum + + +class Items2(Enum): + DROP = "drop" + PROCESSED = "processed" + DEFERRED = "deferred" + GROUP_UNSUBSCRIBE = "group_unsubscribe" + BOUNCE = "bounce" + DELIVERED = "delivered" + CLICK = "click" + UNSUBSCRIBE = "unsubscribe" + OPEN = "open" + GROUP_RESUBSCRIBE = "group_resubscribe" + SPAMREPORT = "spamreport" + MACHINE_OPENED = "machine_opened" diff --git a/sendgrid/rest/api/integrations/v3/update_integration.py b/sendgrid/rest/api/integrations/v3/update_integration.py new file mode 100644 index 00000000..918986f1 --- /dev/null +++ b/sendgrid/rest/api/integrations/v3/update_integration.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Integrations API + Integrations allows you to connect your SendGrid applications with third-party services and forward SendGrid email events to those external applications. Currently, Integrations supports event forwarding to [Segment](https://segment.com/docs). You can use this API to create, delete, view, and update your Integrations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.integrations.v3.models.integration_patch import IntegrationPatch + + +class UpdateIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + integration_patch: Optional[IntegrationPatch] = None, + ): + path = "/v3/marketing/integrations/{id}" + path = path.format( + id=id, + ) + + data = None + if integration_patch: + data = integration_patch.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/__init__.py b/sendgrid/rest/api/ip_access_management/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/ip_access_management/v3/add_ip_to_allow_list.py b/sendgrid/rest/api/ip_access_management/v3/add_ip_to_allow_list.py new file mode 100644 index 00000000..37aa1f8c --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/add_ip_to_allow_list.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_access_management.v3.models.add_ip_to_allow_list_request import ( + AddIpToAllowListRequest, +) + + +class AddIpToAllowList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + add_ip_to_allow_list_request: Optional[AddIpToAllowListRequest] = None, + ): + path = "/v3/access_settings/whitelist" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if add_ip_to_allow_list_request: + data = add_ip_to_allow_list_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/delete_allowed_ip.py b/sendgrid/rest/api/ip_access_management/v3/delete_allowed_ip.py new file mode 100644 index 00000000..04c4f5a5 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/delete_allowed_ip.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteAllowedIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + rule_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/access_settings/whitelist/{rule_id}" + path = path.format( + rule_id=rule_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/delete_allowed_ips.py b/sendgrid/rest/api/ip_access_management/v3/delete_allowed_ips.py new file mode 100644 index 00000000..19a8619a --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/delete_allowed_ips.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_access_management.v3.models.delete_allowed_ips_request import ( + DeleteAllowedIpsRequest, +) + + +class DeleteAllowedIps: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + delete_allowed_ips_request: Optional[DeleteAllowedIpsRequest] = None, + ): + path = "/v3/access_settings/whitelist" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if delete_allowed_ips_request: + data = delete_allowed_ips_request.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/get_allowed_ip.py b/sendgrid/rest/api/ip_access_management/v3/get_allowed_ip.py new file mode 100644 index 00000000..03096953 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/get_allowed_ip.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetAllowedIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + rule_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/access_settings/whitelist/{rule_id}" + path = path.format( + rule_id=rule_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/list_access_activity.py b/sendgrid/rest/api/ip_access_management/v3/list_access_activity.py new file mode 100644 index 00000000..8df9ecd5 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/list_access_activity.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAccessActivity: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + ): + path = "/v3/access_settings/activity" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/list_allowed_ip.py b/sendgrid/rest/api/ip_access_management/v3/list_allowed_ip.py new file mode 100644 index 00000000..613dfbaa --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/list_allowed_ip.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAllowedIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/access_settings/whitelist" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/__init__.py b/sendgrid/rest/api/ip_access_management/v3/models/__init__.py new file mode 100644 index 00000000..af5b9584 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/__init__.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Access Management API + IP Twilio SendGrid IP Access Management API allows you to control which IP addresses can be used to access your account, either through the SendGrid application user interface or the API. There is no limit to the number of IP addresses that you can allow. It is possible to remove your own IP address from your list of allowed addresses, thus blocking your own access to your account. While we are able to restore your access, we do require thorough proof of your identify and ownership of your account. We take the security of your account very seriously and wish to prevent any 'bad actors' from maliciously gaining access to your account. Your current IP is clearly displayed to help prevent you from accidentally removing it from the allowed addresses. See [**IP Access Management**](https://docs.sendgrid.com/ui/account-and-settings/ip-access-management) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.ip_access_management.v3.models.add_ip_to_allow_list_request import ( + AddIpToAllowListRequest, +) +from sendgrid.rest.api.ip_access_management.v3.models.add_ip_to_allow_list_request_ips_inner import ( + AddIpToAllowListRequestIpsInner, +) +from sendgrid.rest.api.ip_access_management.v3.models.delete_allowed_ips_request import ( + DeleteAllowedIpsRequest, +) +from sendgrid.rest.api.ip_access_management.v3.models.error_response import ( + ErrorResponse, +) +from sendgrid.rest.api.ip_access_management.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.ip_access_management.v3.models.ip_access_management2xx import ( + IpAccessManagement2xx, +) +from sendgrid.rest.api.ip_access_management.v3.models.ip_access_management2xx_result_inner import ( + IpAccessManagement2xxResultInner, +) +from sendgrid.rest.api.ip_access_management.v3.models.list_access_activity200_response import ( + ListAccessActivity200Response, +) +from sendgrid.rest.api.ip_access_management.v3.models.list_access_activity200_response_result_inner import ( + ListAccessActivity200ResponseResultInner, +) + +__all__ = [ + "AddIpToAllowListRequest", + "AddIpToAllowListRequestIpsInner", + "DeleteAllowedIpsRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "IpAccessManagement2xx", + "IpAccessManagement2xxResultInner", + "ListAccessActivity200Response", + "ListAccessActivity200ResponseResultInner", +] +# Testing code diff --git a/sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request.py b/sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request.py new file mode 100644 index 00000000..2d5c6dcd --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_access_management.v3.models.add_ip_to_allow_list_request_ips_inner import ( + AddIpToAllowListRequestIpsInner, +) + + +class AddIpToAllowListRequest: + def __init__(self, ips: Optional[List[AddIpToAllowListRequestIpsInner]] = None): + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ips": self.ips}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToAllowListRequest(ips=payload.get("ips")) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request_ips_inner.py b/sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request_ips_inner.py new file mode 100644 index 00000000..764667e4 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/add_ip_to_allow_list_request_ips_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpToAllowListRequestIpsInner: + def __init__(self, ip: Optional[str] = None): + self.ip = ip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToAllowListRequestIpsInner(ip=payload.get("ip")) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/delete_allowed_ips_request.py b/sendgrid/rest/api/ip_access_management/v3/models/delete_allowed_ips_request.py new file mode 100644 index 00000000..8beb99b4 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/delete_allowed_ips_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteAllowedIpsRequest: + def __init__(self, ids: Optional[List[int]] = None): + self.ids = ids + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ids": self.ids}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteAllowedIpsRequest(ids=payload.get("ids")) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/error_response.py b/sendgrid/rest/api/ip_access_management/v3/models/error_response.py new file mode 100644 index 00000000..b8cf4c49 --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_access_management.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/ip_access_management/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx.py b/sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx.py new file mode 100644 index 00000000..748f3c3e --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_access_management.v3.models.ip_access_management2xx_result_inner import ( + IpAccessManagement2xxResultInner, +) + + +class IpAccessManagement2xx: + def __init__(self, result: Optional[List[IpAccessManagement2xxResultInner]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IpAccessManagement2xx(result=payload.get("result")) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx_result_inner.py b/sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx_result_inner.py new file mode 100644 index 00000000..c9a2c14f --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/ip_access_management2xx_result_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class IpAccessManagement2xxResultInner: + def __init__( + self, + id: Optional[int] = None, + ip: Optional[str] = None, + created_at: Optional[int] = None, + updated_at: Optional[int] = None, + ): + self.id = id + self.ip = ip + self.created_at = created_at + self.updated_at = updated_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "ip": self.ip, + "created_at": self.created_at, + "updated_at": self.updated_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IpAccessManagement2xxResultInner( + id=payload.get("id"), + ip=payload.get("ip"), + created_at=payload.get("created_at"), + updated_at=payload.get("updated_at"), + ) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response.py b/sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response.py new file mode 100644 index 00000000..92d186bd --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_access_management.v3.models.list_access_activity200_response_result_inner import ( + ListAccessActivity200ResponseResultInner, +) + + +class ListAccessActivity200Response: + def __init__( + self, result: Optional[List[ListAccessActivity200ResponseResultInner]] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAccessActivity200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response_result_inner.py b/sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response_result_inner.py new file mode 100644 index 00000000..0a262dcc --- /dev/null +++ b/sendgrid/rest/api/ip_access_management/v3/models/list_access_activity200_response_result_inner.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListAccessActivity200ResponseResultInner: + def __init__( + self, + allowed: Optional[bool] = None, + auth_method: Optional[str] = None, + first_at: Optional[int] = None, + ip: Optional[str] = None, + last_at: Optional[int] = None, + location: Optional[str] = None, + ): + self.allowed = allowed + self.auth_method = auth_method + self.first_at = first_at + self.ip = ip + self.last_at = last_at + self.location = location + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "allowed": self.allowed, + "auth_method": self.auth_method, + "first_at": self.first_at, + "ip": self.ip, + "last_at": self.last_at, + "location": self.location, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAccessActivity200ResponseResultInner( + allowed=payload.get("allowed"), + auth_method=payload.get("auth_method"), + first_at=payload.get("first_at"), + ip=payload.get("ip"), + last_at=payload.get("last_at"), + location=payload.get("location"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/__init__.py b/sendgrid/rest/api/ip_address_management/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/ip_address_management/v3/add_ip.py b/sendgrid/rest/api/ip_address_management/v3/add_ip.py new file mode 100644 index 00000000..95deb4b7 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/add_ip.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.add_ip_request import ( + AddIpRequest, +) + + +class AddIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + add_ip_request: Optional[AddIpRequest] = None, + ): + path = "/v3/send_ips/ips" + + data = None + if add_ip_request: + data = add_ip_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/add_ips_to_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/add_ips_to_ip_pool.py new file mode 100644 index 00000000..389efacd --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/add_ips_to_ip_pool.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.add_ips_to_ip_pool_request import ( + AddIpsToIpPoolRequest, +) + + +class AddIpsToIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + poolid: str, + add_ips_to_ip_pool_request: Optional[AddIpsToIpPoolRequest] = None, + ): + path = "/v3/send_ips/pools/{poolid}/ips:batchAdd" + path = path.format( + poolid=poolid, + ) + + data = None + if add_ips_to_ip_pool_request: + data = add_ips_to_ip_pool_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/add_sub_users_to_ip.py b/sendgrid/rest/api/ip_address_management/v3/add_sub_users_to_ip.py new file mode 100644 index 00000000..4daaf183 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/add_sub_users_to_ip.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.add_sub_users_to_ip_request import ( + AddSubUsersToIpRequest, +) + + +class AddSubUsersToIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip: str, + add_sub_users_to_ip_request: Optional[AddSubUsersToIpRequest] = None, + ): + path = "/v3/send_ips/ips/{ip}/subusers:batchAdd" + path = path.format( + ip=ip, + ) + + data = None + if add_sub_users_to_ip_request: + data = add_sub_users_to_ip_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/create_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/create_ip_pool.py new file mode 100644 index 00000000..0816b342 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/create_ip_pool.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.create_ip_pool_request import ( + CreateIpPoolRequest, +) + + +class CreateIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + create_ip_pool_request: Optional[CreateIpPoolRequest] = None, + ): + path = "/v3/send_ips/pools" + + data = None + if create_ip_pool_request: + data = create_ip_pool_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/delete_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/delete_ip_pool.py new file mode 100644 index 00000000..ce07627e --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/delete_ip_pool.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + poolid: str, + ): + path = "/v3/send_ips/pools/{poolid}" + path = path.format( + poolid=poolid, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/delete_ips_from_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/delete_ips_from_ip_pool.py new file mode 100644 index 00000000..4a9ee3c8 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/delete_ips_from_ip_pool.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.delete_ips_from_ip_pool_request import ( + DeleteIpsFromIpPoolRequest, +) + + +class DeleteIpsFromIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + poolid: str, + delete_ips_from_ip_pool_request: Optional[DeleteIpsFromIpPoolRequest] = None, + ): + path = "/v3/send_ips/pools/{poolid}/ips:batchDelete" + path = path.format( + poolid=poolid, + ) + + data = None + if delete_ips_from_ip_pool_request: + data = delete_ips_from_ip_pool_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/delete_sub_users_from_ip.py b/sendgrid/rest/api/ip_address_management/v3/delete_sub_users_from_ip.py new file mode 100644 index 00000000..c6859db4 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/delete_sub_users_from_ip.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.delete_sub_users_from_ip_request import ( + DeleteSubUsersFromIpRequest, +) + + +class DeleteSubUsersFromIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip: str, + delete_sub_users_from_ip_request: Optional[DeleteSubUsersFromIpRequest] = None, + ): + path = "/v3/send_ips/ips/{ip}/subusers:batchDelete" + path = path.format( + ip=ip, + ) + + data = None + if delete_sub_users_from_ip_request: + data = delete_sub_users_from_ip_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/get_ip.py b/sendgrid/rest/api/ip_address_management/v3/get_ip.py new file mode 100644 index 00000000..57dbabd4 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/get_ip.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + include_region: Optional[bool] = None, + ): + path = "/v3/send_ips/ips/{ip}" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/get_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/get_ip_pool.py new file mode 100644 index 00000000..81d60ce8 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/get_ip_pool.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + include_region: Optional[bool] = None, + ): + path = "/v3/send_ips/pools/{poolid}" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/list_ip.py b/sendgrid/rest/api/ip_address_management/v3/list_ip.py new file mode 100644 index 00000000..f8e0a667 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/list_ip.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.region7 import Region7 + + +class ListIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip: Optional[str] = None, + limit: Optional[int] = None, + after_key: Optional[int] = None, + before_key: Optional[str] = None, + is_leased: Optional[bool] = None, + is_enabled: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + pool: Optional[str] = None, + start_added_at: Optional[int] = None, + end_added_at: Optional[int] = None, + region: Optional[Region7] = None, + include_region: Optional[bool] = None, + ): + path = "/v3/send_ips/ips" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/list_ip_assigned_to_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/list_ip_assigned_to_ip_pool.py new file mode 100644 index 00000000..c75ce744 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/list_ip_assigned_to_ip_pool.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListIpAssignedToIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + limit: Optional[int] = None, + after_key: Optional[int] = None, + include_region: Optional[bool] = None, + ): + path = "/v3/send_ips/pools/{poolid}/ips" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/list_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/list_ip_pool.py new file mode 100644 index 00000000..ea463968 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/list_ip_pool.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.region7 import Region7 + + +class ListIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + limit: Optional[int] = None, + after_key: Optional[int] = None, + ip: Optional[str] = None, + region: Optional[Region7] = None, + include_region: Optional[bool] = None, + ): + path = "/v3/send_ips/pools" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/list_sub_user_assigned_to_ip.py b/sendgrid/rest/api/ip_address_management/v3/list_sub_user_assigned_to_ip.py new file mode 100644 index 00000000..6f2dff3f --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/list_sub_user_assigned_to_ip.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSubUserAssignedToIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + after_key: Optional[int] = None, + limit: Optional[int] = None, + ): + path = "/v3/send_ips/ips/{ip}/subusers" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/__init__.py b/sendgrid/rest/api/ip_address_management/v3/models/__init__.py new file mode 100644 index 00000000..b06eec3b --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/__init__.py @@ -0,0 +1,180 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.ip_address_management.v3.models.add_ip201_response import ( + AddIp201Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.add_ip_request import ( + AddIpRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.add_ips_to_ip_pool200_response import ( + AddIpsToIpPool200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.add_ips_to_ip_pool_request import ( + AddIpsToIpPoolRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.add_sub_users_to_ip200_response import ( + AddSubUsersToIp200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.add_sub_users_to_ip_request import ( + AddSubUsersToIpRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.create_ip_pool201_response import ( + CreateIpPool201Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.create_ip_pool_request import ( + CreateIpPoolRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.delete_ips_from_ip_pool_request import ( + DeleteIpsFromIpPoolRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.delete_sub_users_from_ip_request import ( + DeleteSubUsersFromIpRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.get_ip200_response import ( + GetIp200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.get_ip200_response_pools_inner import ( + GetIp200ResponsePoolsInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.get_ip_pool200_response import ( + GetIpPool200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.get_ip_pool200_response_ip_count_by_region_inner import ( + GetIpPool200ResponseIpCountByRegionInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.ip_address_management_error_response import ( + IpAddressManagementErrorResponse, +) +from sendgrid.rest.api.ip_address_management.v3.models.ip_address_management_error_response_errors_inner import ( + IpAddressManagementErrorResponseErrorsInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.items import Items +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response import ( + ListIp200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_metadata import ( + ListIp200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_metadata_next_params import ( + ListIp200ResponseMetadataNextParams, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_result_inner import ( + ListIp200ResponseResultInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_result_inner_pools_inner import ( + ListIp200ResponseResultInnerPoolsInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response import ( + ListIpAssignedToIpPool200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response_metadata import ( + ListIpAssignedToIpPool200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response_metadata_next_params import ( + ListIpAssignedToIpPool200ResponseMetadataNextParams, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response_result_inner import ( + ListIpAssignedToIpPool200ResponseResultInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response import ( + ListIpPool200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response_metadata import ( + ListIpPool200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response_metadata_next_params import ( + ListIpPool200ResponseMetadataNextParams, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response_result_inner import ( + ListIpPool200ResponseResultInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_sub_user_assigned_to_ip200_response import ( + ListSubUserAssignedToIp200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_sub_user_assigned_to_ip200_response_metadata import ( + ListSubUserAssignedToIp200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_sub_user_assigned_to_ip200_response_metadata_next_params import ( + ListSubUserAssignedToIp200ResponseMetadataNextParams, +) +from sendgrid.rest.api.ip_address_management.v3.models.region import Region +from sendgrid.rest.api.ip_address_management.v3.models.region1 import Region1 +from sendgrid.rest.api.ip_address_management.v3.models.region2 import Region2 +from sendgrid.rest.api.ip_address_management.v3.models.region3 import Region3 +from sendgrid.rest.api.ip_address_management.v3.models.region4 import Region4 +from sendgrid.rest.api.ip_address_management.v3.models.region5 import Region5 +from sendgrid.rest.api.ip_address_management.v3.models.region6 import Region6 +from sendgrid.rest.api.ip_address_management.v3.models.region7 import Region7 +from sendgrid.rest.api.ip_address_management.v3.models.update_ip200_response import ( + UpdateIp200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.update_ip_pool200_response import ( + UpdateIpPool200Response, +) +from sendgrid.rest.api.ip_address_management.v3.models.update_ip_pool_request import ( + UpdateIpPoolRequest, +) +from sendgrid.rest.api.ip_address_management.v3.models.update_ip_request import ( + UpdateIpRequest, +) + +__all__ = [ + "AddIp201Response", + "AddIpRequest", + "AddIpsToIpPool200Response", + "AddIpsToIpPoolRequest", + "AddSubUsersToIp200Response", + "AddSubUsersToIpRequest", + "CreateIpPool201Response", + "CreateIpPoolRequest", + "DeleteIpsFromIpPoolRequest", + "DeleteSubUsersFromIpRequest", + "GetIp200Response", + "GetIp200ResponsePoolsInner", + "GetIpPool200Response", + "GetIpPool200ResponseIpCountByRegionInner", + "IpAddressManagementErrorResponse", + "IpAddressManagementErrorResponseErrorsInner", + "Items", + "ListIp200Response", + "ListIp200ResponseMetadata", + "ListIp200ResponseMetadataNextParams", + "ListIp200ResponseResultInner", + "ListIp200ResponseResultInnerPoolsInner", + "ListIpAssignedToIpPool200Response", + "ListIpAssignedToIpPool200ResponseMetadata", + "ListIpAssignedToIpPool200ResponseMetadataNextParams", + "ListIpAssignedToIpPool200ResponseResultInner", + "ListIpPool200Response", + "ListIpPool200ResponseMetadata", + "ListIpPool200ResponseMetadataNextParams", + "ListIpPool200ResponseResultInner", + "ListSubUserAssignedToIp200Response", + "ListSubUserAssignedToIp200ResponseMetadata", + "ListSubUserAssignedToIp200ResponseMetadataNextParams", + "Region", + "Region1", + "Region2", + "Region3", + "Region4", + "Region5", + "Region6", + "Region7", + "UpdateIp200Response", + "UpdateIpPool200Response", + "UpdateIpPoolRequest", + "UpdateIpRequest", +] +# Testing code diff --git a/sendgrid/rest/api/ip_address_management/v3/models/add_ip201_response.py b/sendgrid/rest/api/ip_address_management/v3/models/add_ip201_response.py new file mode 100644 index 00000000..4099ba74 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/add_ip201_response.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.region2 import Region2 + + +class AddIp201Response: + def __init__( + self, + ip: Optional[str] = None, + is_auto_warmup: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + subusers: Optional[List[str]] = None, + region: Optional[Region2] = None, + ): + self.ip = ip + self.is_auto_warmup = is_auto_warmup + self.is_parent_assigned = is_parent_assigned + self.subusers = subusers + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "is_auto_warmup": self.is_auto_warmup, + "is_parent_assigned": self.is_parent_assigned, + "subusers": self.subusers, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIp201Response( + ip=payload.get("ip"), + is_auto_warmup=payload.get("is_auto_warmup"), + is_parent_assigned=payload.get("is_parent_assigned"), + subusers=payload.get("subusers"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/add_ip_request.py b/sendgrid/rest/api/ip_address_management/v3/models/add_ip_request.py new file mode 100644 index 00000000..c73d4a76 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/add_ip_request.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.region3 import Region3 + + +class AddIpRequest: + def __init__( + self, + is_auto_warmup: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + subusers: Optional[List[str]] = None, + region: Optional[Region3] = None, + include_region: Optional[bool] = None, + ): + self.is_auto_warmup = is_auto_warmup + self.is_parent_assigned = is_parent_assigned + self.subusers = subusers + self.region = region + self.include_region = include_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "is_auto_warmup": self.is_auto_warmup, + "is_parent_assigned": self.is_parent_assigned, + "subusers": self.subusers, + "region": self.region, + "include_region": self.include_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpRequest( + is_auto_warmup=payload.get("is_auto_warmup"), + is_parent_assigned=payload.get("is_parent_assigned"), + subusers=payload.get("subusers"), + region=payload.get("region"), + include_region=payload.get("include_region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool200_response.py new file mode 100644 index 00000000..7f5acc14 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool200_response.py @@ -0,0 +1,35 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpsToIpPool200Response: + def __init__( + self, + name: Optional[str] = None, + id: Optional[str] = None, + ips: Optional[List[str]] = None, + ): + self.name = name + self.id = id + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "id": self.id, + "ips": self.ips, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpsToIpPool200Response( + name=payload.get("name"), id=payload.get("id"), ips=payload.get("ips") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool_request.py b/sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool_request.py new file mode 100644 index 00000000..883da07e --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/add_ips_to_ip_pool_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpsToIpPoolRequest: + def __init__(self, ips: Optional[List[str]] = None): + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ips": self.ips}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpsToIpPoolRequest(ips=payload.get("ips")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip200_response.py new file mode 100644 index 00000000..345e3455 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip200_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddSubUsersToIp200Response: + def __init__(self, ip: Optional[str] = None, subusers: Optional[List[str]] = None): + self.ip = ip + self.subusers = subusers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip, "subusers": self.subusers}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddSubUsersToIp200Response( + ip=payload.get("ip"), subusers=payload.get("subusers") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip_request.py b/sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip_request.py new file mode 100644 index 00000000..516553d7 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/add_sub_users_to_ip_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddSubUsersToIpRequest: + def __init__(self, subusers: Optional[List[str]] = None): + self.subusers = subusers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"subusers": self.subusers}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddSubUsersToIpRequest(subusers=payload.get("subusers")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool201_response.py b/sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool201_response.py new file mode 100644 index 00000000..463654b3 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool201_response.py @@ -0,0 +1,35 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateIpPool201Response: + def __init__( + self, + name: Optional[str] = None, + id: Optional[str] = None, + ips: Optional[List[str]] = None, + ): + self.name = name + self.id = id + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "id": self.id, + "ips": self.ips, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateIpPool201Response( + name=payload.get("name"), id=payload.get("id"), ips=payload.get("ips") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool_request.py b/sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool_request.py new file mode 100644 index 00000000..610c6d16 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/create_ip_pool_request.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateIpPoolRequest: + def __init__(self, name: Optional[str] = None, ips: Optional[List[str]] = None): + self.name = name + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "ips": self.ips}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateIpPoolRequest(name=payload.get("name"), ips=payload.get("ips")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/delete_ips_from_ip_pool_request.py b/sendgrid/rest/api/ip_address_management/v3/models/delete_ips_from_ip_pool_request.py new file mode 100644 index 00000000..bc118875 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/delete_ips_from_ip_pool_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteIpsFromIpPoolRequest: + def __init__(self, ips: Optional[List[str]] = None): + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ips": self.ips}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteIpsFromIpPoolRequest(ips=payload.get("ips")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/delete_sub_users_from_ip_request.py b/sendgrid/rest/api/ip_address_management/v3/models/delete_sub_users_from_ip_request.py new file mode 100644 index 00000000..fae948ff --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/delete_sub_users_from_ip_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteSubUsersFromIpRequest: + def __init__(self, subusers: Optional[List[str]] = None): + self.subusers = subusers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"subusers": self.subusers}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteSubUsersFromIpRequest(subusers=payload.get("subusers")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response.py new file mode 100644 index 00000000..b336f09c --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response.py @@ -0,0 +1,64 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.get_ip200_response_pools_inner import ( + GetIp200ResponsePoolsInner, +) + + +class GetIp200Response: + def __init__( + self, + ip: Optional[str] = None, + is_parent_assigned: Optional[bool] = None, + is_auto_warmup: Optional[bool] = None, + pools: Optional[List[GetIp200ResponsePoolsInner]] = None, + added_at: Optional[int] = None, + updated_at: Optional[int] = None, + is_enabled: Optional[bool] = None, + is_leased: Optional[bool] = None, + region: Optional[str] = None, + ): + self.ip = ip + self.is_parent_assigned = is_parent_assigned + self.is_auto_warmup = is_auto_warmup + self.pools = pools + self.added_at = added_at + self.updated_at = updated_at + self.is_enabled = is_enabled + self.is_leased = is_leased + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "is_parent_assigned": self.is_parent_assigned, + "is_auto_warmup": self.is_auto_warmup, + "pools": self.pools, + "added_at": self.added_at, + "updated_at": self.updated_at, + "is_enabled": self.is_enabled, + "is_leased": self.is_leased, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIp200Response( + ip=payload.get("ip"), + is_parent_assigned=payload.get("is_parent_assigned"), + is_auto_warmup=payload.get("is_auto_warmup"), + pools=payload.get("pools"), + added_at=payload.get("added_at"), + updated_at=payload.get("updated_at"), + is_enabled=payload.get("is_enabled"), + is_leased=payload.get("is_leased"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response_pools_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response_pools_inner.py new file mode 100644 index 00000000..806d1c28 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/get_ip200_response_pools_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetIp200ResponsePoolsInner: + def __init__(self, id: Optional[str] = None, name: Optional[str] = None): + self.id = id + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"id": self.id, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIp200ResponsePoolsInner( + id=payload.get("id"), name=payload.get("name") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response.py new file mode 100644 index 00000000..85b15648 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response.py @@ -0,0 +1,50 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.get_ip_pool200_response_ip_count_by_region_inner import ( + GetIpPool200ResponseIpCountByRegionInner, +) + + +class GetIpPool200Response: + def __init__( + self, + name: Optional[str] = None, + id: Optional[str] = None, + ips_preview: Optional[List[str]] = None, + total_ip_count: Optional[int] = None, + ip_count_by_region: Optional[ + List[GetIpPool200ResponseIpCountByRegionInner] + ] = None, + ): + self.name = name + self.id = id + self.ips_preview = ips_preview + self.total_ip_count = total_ip_count + self.ip_count_by_region = ip_count_by_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "id": self.id, + "ips_preview": self.ips_preview, + "total_ip_count": self.total_ip_count, + "ip_count_by_region": self.ip_count_by_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIpPool200Response( + name=payload.get("name"), + id=payload.get("id"), + ips_preview=payload.get("ips_preview"), + total_ip_count=payload.get("total_ip_count"), + ip_count_by_region=payload.get("ip_count_by_region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response_ip_count_by_region_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response_ip_count_by_region_inner.py new file mode 100644 index 00000000..93296cb5 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/get_ip_pool200_response_ip_count_by_region_inner.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.region5 import Region5 + + +class GetIpPool200ResponseIpCountByRegionInner: + def __init__(self, region: Optional[Region5] = None, count: Optional[int] = None): + self.region = region + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"region": self.region, "count": self.count}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIpPool200ResponseIpCountByRegionInner( + region=payload.get("region"), count=payload.get("count") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response.py b/sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response.py new file mode 100644 index 00000000..1e926a61 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.ip_address_management_error_response_errors_inner import ( + IpAddressManagementErrorResponseErrorsInner, +) + + +class IpAddressManagementErrorResponse: + def __init__( + self, errors: Optional[List[IpAddressManagementErrorResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IpAddressManagementErrorResponse(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response_errors_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response_errors_inner.py new file mode 100644 index 00000000..0e281b63 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/ip_address_management_error_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class IpAddressManagementErrorResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IpAddressManagementErrorResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/items.py b/sendgrid/rest/api/ip_address_management/v3/models/items.py new file mode 100644 index 00000000..84d4a533 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/items.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Items(Enum): + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response.py new file mode 100644 index 00000000..4fd4e8ae --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_metadata import ( + ListIp200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_result_inner import ( + ListIp200ResponseResultInner, +) + + +class ListIp200Response: + def __init__( + self, + result: Optional[List[ListIp200ResponseResultInner]] = None, + metadata: Optional[ListIp200ResponseMetadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIp200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata.py new file mode 100644 index 00000000..d59988aa --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_metadata_next_params import ( + ListIp200ResponseMetadataNextParams, +) + + +class ListIp200ResponseMetadata: + def __init__( + self, next_params: Optional[ListIp200ResponseMetadataNextParams] = None + ): + self.next_params = next_params + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"next_params": self.next_params}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIp200ResponseMetadata(next_params=payload.get("next_params")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata_next_params.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata_next_params.py new file mode 100644 index 00000000..41a93394 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_metadata_next_params.py @@ -0,0 +1,74 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.region1 import Region1 + + +class ListIp200ResponseMetadataNextParams: + def __init__( + self, + after_key: Optional[str] = None, + before_key: Optional[str] = None, + ip: Optional[str] = None, + is_leased: Optional[bool] = None, + is_enabled: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + pool: Optional[str] = None, + start_added_at: Optional[str] = None, + end_added_at: Optional[str] = None, + limit: Optional[str] = None, + region: Optional[Region1] = None, + include_region: Optional[str] = None, + ): + self.after_key = after_key + self.before_key = before_key + self.ip = ip + self.is_leased = is_leased + self.is_enabled = is_enabled + self.is_parent_assigned = is_parent_assigned + self.pool = pool + self.start_added_at = start_added_at + self.end_added_at = end_added_at + self.limit = limit + self.region = region + self.include_region = include_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "after_key": self.after_key, + "before_key": self.before_key, + "ip": self.ip, + "is_leased": self.is_leased, + "is_enabled": self.is_enabled, + "is_parent_assigned": self.is_parent_assigned, + "pool": self.pool, + "start_added_at": self.start_added_at, + "end_added_at": self.end_added_at, + "limit": self.limit, + "region": self.region, + "include_region": self.include_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIp200ResponseMetadataNextParams( + after_key=payload.get("after_key"), + before_key=payload.get("before_key"), + ip=payload.get("ip"), + is_leased=payload.get("is_leased"), + is_enabled=payload.get("is_enabled"), + is_parent_assigned=payload.get("is_parent_assigned"), + pool=payload.get("pool"), + start_added_at=payload.get("start_added_at"), + end_added_at=payload.get("end_added_at"), + limit=payload.get("limit"), + region=payload.get("region"), + include_region=payload.get("include_region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner.py new file mode 100644 index 00000000..a68da0a6 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner.py @@ -0,0 +1,65 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_result_inner_pools_inner import ( + ListIp200ResponseResultInnerPoolsInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.region import Region + + +class ListIp200ResponseResultInner: + def __init__( + self, + ip: Optional[str] = None, + pools: Optional[List[ListIp200ResponseResultInnerPoolsInner]] = None, + is_auto_warmup: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + updated_at: Optional[int] = None, + is_enabled: Optional[bool] = None, + is_leased: Optional[bool] = None, + added_at: Optional[int] = None, + region: Optional[Region] = None, + ): + self.ip = ip + self.pools = pools + self.is_auto_warmup = is_auto_warmup + self.is_parent_assigned = is_parent_assigned + self.updated_at = updated_at + self.is_enabled = is_enabled + self.is_leased = is_leased + self.added_at = added_at + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "pools": self.pools, + "is_auto_warmup": self.is_auto_warmup, + "is_parent_assigned": self.is_parent_assigned, + "updated_at": self.updated_at, + "is_enabled": self.is_enabled, + "is_leased": self.is_leased, + "added_at": self.added_at, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIp200ResponseResultInner( + ip=payload.get("ip"), + pools=payload.get("pools"), + is_auto_warmup=payload.get("is_auto_warmup"), + is_parent_assigned=payload.get("is_parent_assigned"), + updated_at=payload.get("updated_at"), + is_enabled=payload.get("is_enabled"), + is_leased=payload.get("is_leased"), + added_at=payload.get("added_at"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner_pools_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner_pools_inner.py new file mode 100644 index 00000000..232f4d16 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip200_response_result_inner_pools_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListIp200ResponseResultInnerPoolsInner: + def __init__(self, name: Optional[str] = None, id: Optional[str] = None): + self.name = name + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIp200ResponseResultInnerPoolsInner( + name=payload.get("name"), id=payload.get("id") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response.py new file mode 100644 index 00000000..425fcf1b --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response_metadata import ( + ListIpAssignedToIpPool200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response_result_inner import ( + ListIpAssignedToIpPool200ResponseResultInner, +) + + +class ListIpAssignedToIpPool200Response: + def __init__( + self, + result: Optional[List[ListIpAssignedToIpPool200ResponseResultInner]] = None, + metadata: Optional[ListIpAssignedToIpPool200ResponseMetadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpAssignedToIpPool200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata.py new file mode 100644 index 00000000..c61eedb7 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_assigned_to_ip_pool200_response_metadata_next_params import ( + ListIpAssignedToIpPool200ResponseMetadataNextParams, +) + + +class ListIpAssignedToIpPool200ResponseMetadata: + def __init__( + self, + next_params: Optional[ + ListIpAssignedToIpPool200ResponseMetadataNextParams + ] = None, + ): + self.next_params = next_params + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"next_params": self.next_params}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpAssignedToIpPool200ResponseMetadata( + next_params=payload.get("next_params") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata_next_params.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata_next_params.py new file mode 100644 index 00000000..69ae4854 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_metadata_next_params.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListIpAssignedToIpPool200ResponseMetadataNextParams: + def __init__( + self, + after_key: Optional[str] = None, + limit: Optional[str] = None, + include_region: Optional[str] = None, + ): + self.after_key = after_key + self.limit = limit + self.include_region = include_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "after_key": self.after_key, + "limit": self.limit, + "include_region": self.include_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpAssignedToIpPool200ResponseMetadataNextParams( + after_key=payload.get("after_key"), + limit=payload.get("limit"), + include_region=payload.get("include_region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_result_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_result_inner.py new file mode 100644 index 00000000..2ecd4386 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_assigned_to_ip_pool200_response_result_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip200_response_result_inner_pools_inner import ( + ListIp200ResponseResultInnerPoolsInner, +) +from sendgrid.rest.api.ip_address_management.v3.models.region6 import Region6 + + +class ListIpAssignedToIpPool200ResponseResultInner: + def __init__( + self, + ip: Optional[str] = None, + region: Optional[Region6] = None, + pools: Optional[List[ListIp200ResponseResultInnerPoolsInner]] = None, + ): + self.ip = ip + self.region = region + self.pools = pools + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "region": self.region, + "pools": self.pools, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpAssignedToIpPool200ResponseResultInner( + ip=payload.get("ip"), + region=payload.get("region"), + pools=payload.get("pools"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response.py new file mode 100644 index 00000000..8a419491 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response_metadata import ( + ListIpPool200ResponseMetadata, +) +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response_result_inner import ( + ListIpPool200ResponseResultInner, +) + + +class ListIpPool200Response: + def __init__( + self, + result: Optional[List[ListIpPool200ResponseResultInner]] = None, + metadata: Optional[ListIpPool200ResponseMetadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpPool200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata.py new file mode 100644 index 00000000..1aed9c06 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_ip_pool200_response_metadata_next_params import ( + ListIpPool200ResponseMetadataNextParams, +) + + +class ListIpPool200ResponseMetadata: + def __init__( + self, next_params: Optional[ListIpPool200ResponseMetadataNextParams] = None + ): + self.next_params = next_params + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"next_params": self.next_params}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpPool200ResponseMetadata(next_params=payload.get("next_params")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata_next_params.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata_next_params.py new file mode 100644 index 00000000..615ede9b --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_metadata_next_params.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.region4 import Region4 + + +class ListIpPool200ResponseMetadataNextParams: + def __init__( + self, + after_key: Optional[str] = None, + ip: Optional[str] = None, + limit: Optional[str] = None, + region: Optional[Region4] = None, + include_region: Optional[str] = None, + ): + self.after_key = after_key + self.ip = ip + self.limit = limit + self.region = region + self.include_region = include_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "after_key": self.after_key, + "ip": self.ip, + "limit": self.limit, + "region": self.region, + "include_region": self.include_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpPool200ResponseMetadataNextParams( + after_key=payload.get("after_key"), + ip=payload.get("ip"), + limit=payload.get("limit"), + region=payload.get("region"), + include_region=payload.get("include_region"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_result_inner.py b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_result_inner.py new file mode 100644 index 00000000..2af37b47 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_ip_pool200_response_result_inner.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.items import Items + + +class ListIpPool200ResponseResultInner: + def __init__( + self, + name: Optional[str] = None, + id: Optional[str] = None, + regions: Optional[List[Items]] = None, + ips_preview: Optional[List[str]] = None, + total_ip_count: Optional[int] = None, + ): + self.name = name + self.id = id + self.regions = regions + self.ips_preview = ips_preview + self.total_ip_count = total_ip_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "id": self.id, + "regions": self.regions, + "ips_preview": self.ips_preview, + "total_ip_count": self.total_ip_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIpPool200ResponseResultInner( + name=payload.get("name"), + id=payload.get("id"), + regions=payload.get("regions"), + ips_preview=payload.get("ips_preview"), + total_ip_count=payload.get("total_ip_count"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response.py new file mode 100644 index 00000000..40a00274 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response.py @@ -0,0 +1,35 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_sub_user_assigned_to_ip200_response_metadata import ( + ListSubUserAssignedToIp200ResponseMetadata, +) + + +class ListSubUserAssignedToIp200Response: + def __init__( + self, + result: Optional[List[str]] = None, + metadata: Optional[ListSubUserAssignedToIp200ResponseMetadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubUserAssignedToIp200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata.py b/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata.py new file mode 100644 index 00000000..6b7877cc --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_address_management.v3.models.list_sub_user_assigned_to_ip200_response_metadata_next_params import ( + ListSubUserAssignedToIp200ResponseMetadataNextParams, +) + + +class ListSubUserAssignedToIp200ResponseMetadata: + def __init__( + self, + next_params: Optional[ + ListSubUserAssignedToIp200ResponseMetadataNextParams + ] = None, + ): + self.next_params = next_params + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"next_params": self.next_params}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubUserAssignedToIp200ResponseMetadata( + next_params=payload.get("next_params") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata_next_params.py b/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata_next_params.py new file mode 100644 index 00000000..3c001113 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/list_sub_user_assigned_to_ip200_response_metadata_next_params.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListSubUserAssignedToIp200ResponseMetadataNextParams: + def __init__(self, after_key: Optional[str] = None, limit: Optional[str] = None): + self.after_key = after_key + self.limit = limit + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"after_key": self.after_key, "limit": self.limit}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubUserAssignedToIp200ResponseMetadataNextParams( + after_key=payload.get("after_key"), limit=payload.get("limit") + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region.py b/sendgrid/rest/api/ip_address_management/v3/models/region.py new file mode 100644 index 00000000..7a3adff7 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region(Enum): + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region1.py b/sendgrid/rest/api/ip_address_management/v3/models/region1.py new file mode 100644 index 00000000..43d4ad59 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Region1(Enum): + ALL = "all" + US = "us" + EU = "eu" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region2.py b/sendgrid/rest/api/ip_address_management/v3/models/region2.py new file mode 100644 index 00000000..d5081641 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region2(Enum): + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region3.py b/sendgrid/rest/api/ip_address_management/v3/models/region3.py new file mode 100644 index 00000000..bf7747b8 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region3.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region3(Enum): + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region4.py b/sendgrid/rest/api/ip_address_management/v3/models/region4.py new file mode 100644 index 00000000..17425eb3 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region4.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Region4(Enum): + ALL = "all" + US = "us" + EU = "eu" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region5.py b/sendgrid/rest/api/ip_address_management/v3/models/region5.py new file mode 100644 index 00000000..9475fe1c --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region5.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region5(Enum): + US = "us" + EU = "eu" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region6.py b/sendgrid/rest/api/ip_address_management/v3/models/region6.py new file mode 100644 index 00000000..c6e01531 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region6.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region6(Enum): + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/region7.py b/sendgrid/rest/api/ip_address_management/v3/models/region7.py new file mode 100644 index 00000000..a14c6584 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/region7.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Region7(Enum): + ALL = "all" + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/ip_address_management/v3/models/update_ip200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/update_ip200_response.py new file mode 100644 index 00000000..fc09fac4 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/update_ip200_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateIp200Response: + def __init__( + self, + ip: Optional[str] = None, + is_auto_warmup: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + is_enabled: Optional[bool] = None, + ): + self.ip = ip + self.is_auto_warmup = is_auto_warmup + self.is_parent_assigned = is_parent_assigned + self.is_enabled = is_enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "is_auto_warmup": self.is_auto_warmup, + "is_parent_assigned": self.is_parent_assigned, + "is_enabled": self.is_enabled, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIp200Response( + ip=payload.get("ip"), + is_auto_warmup=payload.get("is_auto_warmup"), + is_parent_assigned=payload.get("is_parent_assigned"), + is_enabled=payload.get("is_enabled"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool200_response.py b/sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool200_response.py new file mode 100644 index 00000000..6f66b9ab --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateIpPool200Response: + def __init__(self, name: Optional[str] = None, id: Optional[str] = None): + self.name = name + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIpPool200Response(name=payload.get("name"), id=payload.get("id")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool_request.py b/sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool_request.py new file mode 100644 index 00000000..494b4915 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/update_ip_pool_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateIpPoolRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIpPoolRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/ip_address_management/v3/models/update_ip_request.py b/sendgrid/rest/api/ip_address_management/v3/models/update_ip_request.py new file mode 100644 index 00000000..d0ee0293 --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/models/update_ip_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateIpRequest: + def __init__( + self, + is_auto_warmup: Optional[bool] = None, + is_parent_assigned: Optional[bool] = None, + is_enabled: Optional[bool] = None, + ): + self.is_auto_warmup = is_auto_warmup + self.is_parent_assigned = is_parent_assigned + self.is_enabled = is_enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "is_auto_warmup": self.is_auto_warmup, + "is_parent_assigned": self.is_parent_assigned, + "is_enabled": self.is_enabled, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIpRequest( + is_auto_warmup=payload.get("is_auto_warmup"), + is_parent_assigned=payload.get("is_parent_assigned"), + is_enabled=payload.get("is_enabled"), + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/update_ip.py b/sendgrid/rest/api/ip_address_management/v3/update_ip.py new file mode 100644 index 00000000..1442115f --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/update_ip.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.update_ip_request import ( + UpdateIpRequest, +) + + +class UpdateIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip: str, + update_ip_request: Optional[UpdateIpRequest] = None, + ): + path = "/v3/send_ips/ips/{ip}" + path = path.format( + ip=ip, + ) + + data = None + if update_ip_request: + data = update_ip_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_address_management/v3/update_ip_pool.py b/sendgrid/rest/api/ip_address_management/v3/update_ip_pool.py new file mode 100644 index 00000000..78807dae --- /dev/null +++ b/sendgrid/rest/api/ip_address_management/v3/update_ip_pool.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address Management API + The Twilio SendGrid IP Address Management API combines functionality that was previously split between the Twilio SendGrid [IP Address API](https://docs.sendgrid.com/api-reference/ip-address) and [IP Pools API](https://docs.sendgrid.com/api-reference/ip-pools). This functionality includes adding IP addresses to your account, assigning IP addresses to IP Pools and Subusers, among other tasks. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_address_management.v3.models.update_ip_pool_request import ( + UpdateIpPoolRequest, +) + + +class UpdateIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + poolid: str, + update_ip_pool_request: Optional[UpdateIpPoolRequest] = None, + ): + path = "/v3/send_ips/pools/{poolid}" + path = path.format( + poolid=poolid, + ) + + data = None + if update_ip_pool_request: + data = update_ip_pool_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/__init__.py b/sendgrid/rest/api/ip_warmup/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/ip_warmup/v3/get_warm_up_ip.py b/sendgrid/rest/api/ip_warmup/v3/get_warm_up_ip.py new file mode 100644 index 00000000..64a79f8a --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/get_warm_up_ip.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Warmup API + The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetWarmUpIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip_address: str, + ): + path = "/v3/ips/warmup/{ip_address}" + path = path.format( + ip_address=ip_address, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/list_warm_up_ip.py b/sendgrid/rest/api/ip_warmup/v3/list_warm_up_ip.py new file mode 100644 index 00000000..fe896f9c --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/list_warm_up_ip.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Warmup API + The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListWarmUpIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/ips/warmup" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/__init__.py b/sendgrid/rest/api/ip_warmup/v3/models/__init__.py new file mode 100644 index 00000000..34e4b910 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/__init__.py @@ -0,0 +1,46 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Warmup API + The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.ip_warmup.v3.models.get_warm_up_ip404_response import ( + GetWarmUpIp404Response, +) +from sendgrid.rest.api.ip_warmup.v3.models.get_warm_up_ip404_response_errors_inner import ( + GetWarmUpIp404ResponseErrorsInner, +) +from sendgrid.rest.api.ip_warmup.v3.models.ip_warmup200_inner import IpWarmup200Inner +from sendgrid.rest.api.ip_warmup.v3.models.stop_ip_warm_up404_response import ( + StopIpWarmUp404Response, +) +from sendgrid.rest.api.ip_warmup.v3.models.stop_ip_warm_up404_response_errors_inner import ( + StopIpWarmUp404ResponseErrorsInner, +) +from sendgrid.rest.api.ip_warmup.v3.models.warm_up_ip404_response import ( + WarmUpIp404Response, +) +from sendgrid.rest.api.ip_warmup.v3.models.warm_up_ip404_response_errors_inner import ( + WarmUpIp404ResponseErrorsInner, +) +from sendgrid.rest.api.ip_warmup.v3.models.warm_up_ip_request import WarmUpIpRequest + +__all__ = [ + "GetWarmUpIp404Response", + "GetWarmUpIp404ResponseErrorsInner", + "IpWarmup200Inner", + "StopIpWarmUp404Response", + "StopIpWarmUp404ResponseErrorsInner", + "WarmUpIp404Response", + "WarmUpIp404ResponseErrorsInner", + "WarmUpIpRequest", +] +# Testing code diff --git a/sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response.py b/sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response.py new file mode 100644 index 00000000..8825fb59 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_warmup.v3.models.get_warm_up_ip404_response_errors_inner import ( + GetWarmUpIp404ResponseErrorsInner, +) + + +class GetWarmUpIp404Response: + def __init__( + self, errors: Optional[List[GetWarmUpIp404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetWarmUpIp404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response_errors_inner.py b/sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response_errors_inner.py new file mode 100644 index 00000000..11c0bfd6 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/get_warm_up_ip404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetWarmUpIp404ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetWarmUpIp404ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/ip_warmup200_inner.py b/sendgrid/rest/api/ip_warmup/v3/models/ip_warmup200_inner.py new file mode 100644 index 00000000..a5e75359 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/ip_warmup200_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class IpWarmup200Inner: + def __init__(self, ip: Optional[str] = None, start_date: Optional[int] = None): + self.ip = ip + self.start_date = start_date + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip, "start_date": self.start_date}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IpWarmup200Inner( + ip=payload.get("ip"), start_date=payload.get("start_date") + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response.py b/sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response.py new file mode 100644 index 00000000..3a913e3f --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_warmup.v3.models.stop_ip_warm_up404_response_errors_inner import ( + StopIpWarmUp404ResponseErrorsInner, +) + + +class StopIpWarmUp404Response: + def __init__( + self, errors: Optional[List[StopIpWarmUp404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return StopIpWarmUp404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response_errors_inner.py b/sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response_errors_inner.py new file mode 100644 index 00000000..7bbc0831 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/stop_ip_warm_up404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class StopIpWarmUp404ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return StopIpWarmUp404ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response.py b/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response.py new file mode 100644 index 00000000..a7e79ac8 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ip_warmup.v3.models.warm_up_ip404_response_errors_inner import ( + WarmUpIp404ResponseErrorsInner, +) + + +class WarmUpIp404Response: + def __init__(self, errors: Optional[List[WarmUpIp404ResponseErrorsInner]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return WarmUpIp404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response_errors_inner.py b/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response_errors_inner.py new file mode 100644 index 00000000..2bc5e883 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class WarmUpIp404ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return WarmUpIp404ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip_request.py b/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip_request.py new file mode 100644 index 00000000..2f2fa469 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/models/warm_up_ip_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class WarmUpIpRequest: + def __init__(self, ip: Optional[str] = None): + self.ip = ip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return WarmUpIpRequest(ip=payload.get("ip")) diff --git a/sendgrid/rest/api/ip_warmup/v3/stop_ip_warm_up.py b/sendgrid/rest/api/ip_warmup/v3/stop_ip_warm_up.py new file mode 100644 index 00000000..ff17ebf1 --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/stop_ip_warm_up.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Warmup API + The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class StopIpWarmUp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip_address: str, + ): + path = "/v3/ips/warmup/{ip_address}" + path = path.format( + ip_address=ip_address, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ip_warmup/v3/warm_up_ip.py b/sendgrid/rest/api/ip_warmup/v3/warm_up_ip.py new file mode 100644 index 00000000..a82618ab --- /dev/null +++ b/sendgrid/rest/api/ip_warmup/v3/warm_up_ip.py @@ -0,0 +1,55 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Warmup API + The Twilio SendGrid IP Warm Up API allows you to gradually increasing the volume of mail sent with a dedicated IP address according to a predetermined schedule. This gradual process helps to establish a reputation with ISPs (Internet Service Providers) as a legitimate email sender. SendGrid can automatically warm up dedicated IP addresses by limiting the amount of mail that can be sent through them per hour. The limit is determined by how long the IP address has been warming up. See the [warmup schedule](https://sendgrid.com/docs/ui/sending-email/warming-up-an-ip-address/#automated-ip-warmup-hourly-send-schedule) to learn how SendGrid limits your email traffic for IPs in warmup. You can also choose to use Twilio SendGrid's automated IP warmup for any of your IPs from the **IP Addresses** settings menu in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/ip_addresses). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ip_warmup.v3.models.warm_up_ip_request import WarmUpIpRequest + + +class WarmUpIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + warm_up_ip_request: Optional[WarmUpIpRequest] = None, + ): + path = "/v3/ips/warmup" + + data = None + if warm_up_ip_request: + data = warm_up_ip_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/__init__.py b/sendgrid/rest/api/ips/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/ips/v3/add_ip.py b/sendgrid/rest/api/ips/v3/add_ip.py new file mode 100644 index 00000000..de206dde --- /dev/null +++ b/sendgrid/rest/api/ips/v3/add_ip.py @@ -0,0 +1,55 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ips.v3.models.add_ip_request import AddIpRequest + + +class AddIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + add_ip_request: Optional[AddIpRequest] = None, + ): + path = "/v3/ips" + + data = None + if add_ip_request: + data = add_ip_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/add_ip_to_ip_pool.py b/sendgrid/rest/api/ips/v3/add_ip_to_ip_pool.py new file mode 100644 index 00000000..6b80836b --- /dev/null +++ b/sendgrid/rest/api/ips/v3/add_ip_to_ip_pool.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ips.v3.models.add_ip_to_ip_pool_request import ( + AddIpToIpPoolRequest, +) + + +class AddIpToIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + pool_name: str, + add_ip_to_ip_pool_request: Optional[AddIpToIpPoolRequest] = None, + ): + path = "/v3/ips/pools/{pool_name}/ips" + path = path.format( + pool_name=pool_name, + ) + + data = None + if add_ip_to_ip_pool_request: + data = add_ip_to_ip_pool_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/create_ip_pool.py b/sendgrid/rest/api/ips/v3/create_ip_pool.py new file mode 100644 index 00000000..9f6b1e1b --- /dev/null +++ b/sendgrid/rest/api/ips/v3/create_ip_pool.py @@ -0,0 +1,55 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ips.v3.models.create_ip_pool_request import CreateIpPoolRequest + + +class CreateIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + create_ip_pool_request: Optional[CreateIpPoolRequest] = None, + ): + path = "/v3/ips/pools" + + data = None + if create_ip_pool_request: + data = create_ip_pool_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/delete_ip_from_ip_pool.py b/sendgrid/rest/api/ips/v3/delete_ip_from_ip_pool.py new file mode 100644 index 00000000..cfa7e2c5 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/delete_ip_from_ip_pool.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteIpFromIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + pool_name: str, + ip: str, + ): + path = "/v3/ips/pools/{pool_name}/ips/{ip}" + path = path.format( + pool_name=pool_name, + ip=ip, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/delete_ip_pool.py b/sendgrid/rest/api/ips/v3/delete_ip_pool.py new file mode 100644 index 00000000..8030d50b --- /dev/null +++ b/sendgrid/rest/api/ips/v3/delete_ip_pool.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + pool_name: str, + ): + path = "/v3/ips/pools/{pool_name}" + path = path.format( + pool_name=pool_name, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/get_ip.py b/sendgrid/rest/api/ips/v3/get_ip.py new file mode 100644 index 00000000..badac813 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/get_ip.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip_address: str, + ): + path = "/v3/ips/{ip_address}" + path = path.format( + ip_address=ip_address, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/get_ip_pool.py b/sendgrid/rest/api/ips/v3/get_ip_pool.py new file mode 100644 index 00000000..8836a41d --- /dev/null +++ b/sendgrid/rest/api/ips/v3/get_ip_pool.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + pool_name: str, + ): + path = "/v3/ips/pools/{pool_name}" + path = path.format( + pool_name=pool_name, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/list_assigned_ip.py b/sendgrid/rest/api/ips/v3/list_assigned_ip.py new file mode 100644 index 00000000..69db51a6 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/list_assigned_ip.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListAssignedIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/ips/assigned" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/list_ip.py b/sendgrid/rest/api/ips/v3/list_ip.py new file mode 100644 index 00000000..b567c3cf --- /dev/null +++ b/sendgrid/rest/api/ips/v3/list_ip.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ips.v3.models.sort_by_direction import SortByDirection + + +class ListIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ip: Optional[str] = None, + exclude_whitelabels: Optional[bool] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + subuser: Optional[str] = None, + sort_by_direction: Optional[SortByDirection] = None, + ): + path = "/v3/ips" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/list_ip_pool.py b/sendgrid/rest/api/ips/v3/list_ip_pool.py new file mode 100644 index 00000000..ba389356 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/list_ip_pool.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/ips/pools" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/list_remaining_ip_count.py b/sendgrid/rest/api/ips/v3/list_remaining_ip_count.py new file mode 100644 index 00000000..01f1376c --- /dev/null +++ b/sendgrid/rest/api/ips/v3/list_remaining_ip_count.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListRemainingIpCount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/ips/remaining" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/ips/v3/models/__init__.py b/sendgrid/rest/api/ips/v3/models/__init__.py new file mode 100644 index 00000000..cfd0af27 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/__init__.py @@ -0,0 +1,98 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.ips.v3.models.add_ip201_response import AddIp201Response +from sendgrid.rest.api.ips.v3.models.add_ip201_response_ips_inner import ( + AddIp201ResponseIpsInner, +) +from sendgrid.rest.api.ips.v3.models.add_ip_request import AddIpRequest +from sendgrid.rest.api.ips.v3.models.add_ip_to_ip_pool201_response import ( + AddIpToIpPool201Response, +) +from sendgrid.rest.api.ips.v3.models.add_ip_to_ip_pool404_response import ( + AddIpToIpPool404Response, +) +from sendgrid.rest.api.ips.v3.models.add_ip_to_ip_pool404_response_errors_inner import ( + AddIpToIpPool404ResponseErrorsInner, +) +from sendgrid.rest.api.ips.v3.models.add_ip_to_ip_pool_request import ( + AddIpToIpPoolRequest, +) +from sendgrid.rest.api.ips.v3.models.create_ip_pool_request import CreateIpPoolRequest +from sendgrid.rest.api.ips.v3.models.delete_ip_from_ip_pool404_response import ( + DeleteIpFromIpPool404Response, +) +from sendgrid.rest.api.ips.v3.models.delete_ip_pool404_response import ( + DeleteIpPool404Response, +) +from sendgrid.rest.api.ips.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.ips.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.ips.v3.models.get_ip200_response import GetIp200Response +from sendgrid.rest.api.ips.v3.models.get_ip_pool200_response import GetIpPool200Response +from sendgrid.rest.api.ips.v3.models.get_ip_pool404_response import GetIpPool404Response +from sendgrid.rest.api.ips.v3.models.get_ip_pool404_response_errors_inner import ( + GetIpPool404ResponseErrorsInner, +) +from sendgrid.rest.api.ips.v3.models.ip_pools200 import IpPools200 +from sendgrid.rest.api.ips.v3.models.list_assigned_ip200_response_inner import ( + ListAssignedIp200ResponseInner, +) +from sendgrid.rest.api.ips.v3.models.list_ip200_response_inner import ( + ListIp200ResponseInner, +) +from sendgrid.rest.api.ips.v3.models.list_remaining_ip_count200_response import ( + ListRemainingIpCount200Response, +) +from sendgrid.rest.api.ips.v3.models.list_remaining_ip_count200_response_results_inner import ( + ListRemainingIpCount200ResponseResultsInner, +) +from sendgrid.rest.api.ips.v3.models.sort_by_direction import SortByDirection +from sendgrid.rest.api.ips.v3.models.update_ip_pool404_response import ( + UpdateIpPool404Response, +) +from sendgrid.rest.api.ips.v3.models.update_ip_pool404_response_errors_inner import ( + UpdateIpPool404ResponseErrorsInner, +) +from sendgrid.rest.api.ips.v3.models.update_ip_pool_request import UpdateIpPoolRequest + +__all__ = [ + "AddIp201Response", + "AddIp201ResponseIpsInner", + "AddIpRequest", + "AddIpToIpPool201Response", + "AddIpToIpPool404Response", + "AddIpToIpPool404ResponseErrorsInner", + "AddIpToIpPoolRequest", + "CreateIpPoolRequest", + "DeleteIpFromIpPool404Response", + "DeleteIpPool404Response", + "ErrorResponse", + "ErrorResponseErrorsInner", + "GetIp200Response", + "GetIpPool200Response", + "GetIpPool404Response", + "GetIpPool404ResponseErrorsInner", + "IpPools200", + "ListAssignedIp200ResponseInner", + "ListIp200ResponseInner", + "ListRemainingIpCount200Response", + "ListRemainingIpCount200ResponseResultsInner", + "SortByDirection", + "UpdateIpPool404Response", + "UpdateIpPool404ResponseErrorsInner", + "UpdateIpPoolRequest", +] +# Testing code diff --git a/sendgrid/rest/api/ips/v3/models/add_ip201_response.py b/sendgrid/rest/api/ips/v3/models/add_ip201_response.py new file mode 100644 index 00000000..db59d7cf --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip201_response.py @@ -0,0 +1,40 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ips.v3.models.add_ip201_response_ips_inner import ( + AddIp201ResponseIpsInner, +) + + +class AddIp201Response: + def __init__( + self, + ips: Optional[List[AddIp201ResponseIpsInner]] = None, + remaining_ips: Optional[int] = None, + warmup: Optional[bool] = None, + ): + self.ips = ips + self.remaining_ips = remaining_ips + self.warmup = warmup + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ips": self.ips, + "remaining_ips": self.remaining_ips, + "warmup": self.warmup, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIp201Response( + ips=payload.get("ips"), + remaining_ips=payload.get("remaining_ips"), + warmup=payload.get("warmup"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/add_ip201_response_ips_inner.py b/sendgrid/rest/api/ips/v3/models/add_ip201_response_ips_inner.py new file mode 100644 index 00000000..091271db --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip201_response_ips_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIp201ResponseIpsInner: + def __init__(self, ip: Optional[str] = None, subusers: Optional[List[str]] = None): + self.ip = ip + self.subusers = subusers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip, "subusers": self.subusers}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIp201ResponseIpsInner( + ip=payload.get("ip"), subusers=payload.get("subusers") + ) diff --git a/sendgrid/rest/api/ips/v3/models/add_ip_request.py b/sendgrid/rest/api/ips/v3/models/add_ip_request.py new file mode 100644 index 00000000..c5ce182a --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpRequest: + def __init__( + self, + count: Optional[int] = None, + subusers: Optional[List[str]] = None, + warmup: Optional[bool] = None, + ): + self.count = count + self.subusers = subusers + self.warmup = warmup + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "count": self.count, + "subusers": self.subusers, + "warmup": self.warmup, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpRequest( + count=payload.get("count"), + subusers=payload.get("subusers"), + warmup=payload.get("warmup"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool201_response.py b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool201_response.py new file mode 100644 index 00000000..bb2c22d6 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool201_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpToIpPool201Response: + def __init__( + self, + ip: Optional[str] = None, + pools: Optional[List[str]] = None, + start_date: Optional[int] = None, + warmup: Optional[bool] = None, + ): + self.ip = ip + self.pools = pools + self.start_date = start_date + self.warmup = warmup + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "pools": self.pools, + "start_date": self.start_date, + "warmup": self.warmup, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToIpPool201Response( + ip=payload.get("ip"), + pools=payload.get("pools"), + start_date=payload.get("start_date"), + warmup=payload.get("warmup"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response.py b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response.py new file mode 100644 index 00000000..9e2ac4ea --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ips.v3.models.add_ip_to_ip_pool404_response_errors_inner import ( + AddIpToIpPool404ResponseErrorsInner, +) + + +class AddIpToIpPool404Response: + def __init__( + self, errors: Optional[List[AddIpToIpPool404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToIpPool404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response_errors_inner.py b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response_errors_inner.py new file mode 100644 index 00000000..a04387fa --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpToIpPool404ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToIpPool404ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool_request.py b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool_request.py new file mode 100644 index 00000000..4c3df613 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/add_ip_to_ip_pool_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddIpToIpPoolRequest: + def __init__(self, ip: Optional[str] = None): + self.ip = ip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ip": self.ip}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddIpToIpPoolRequest(ip=payload.get("ip")) diff --git a/sendgrid/rest/api/ips/v3/models/create_ip_pool_request.py b/sendgrid/rest/api/ips/v3/models/create_ip_pool_request.py new file mode 100644 index 00000000..6981d339 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/create_ip_pool_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateIpPoolRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateIpPoolRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/ips/v3/models/delete_ip_from_ip_pool404_response.py b/sendgrid/rest/api/ips/v3/models/delete_ip_from_ip_pool404_response.py new file mode 100644 index 00000000..1a6f0935 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/delete_ip_from_ip_pool404_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteIpFromIpPool404Response: + def __init__(self, error: Optional[str] = None): + self.error = error + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"error": self.error}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteIpFromIpPool404Response(error=payload.get("error")) diff --git a/sendgrid/rest/api/ips/v3/models/delete_ip_pool404_response.py b/sendgrid/rest/api/ips/v3/models/delete_ip_pool404_response.py new file mode 100644 index 00000000..32bb5061 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/delete_ip_pool404_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteIpPool404Response: + def __init__(self, error: Optional[str] = None): + self.error = error + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"error": self.error}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteIpPool404Response(error=payload.get("error")) diff --git a/sendgrid/rest/api/ips/v3/models/error_response.py b/sendgrid/rest/api/ips/v3/models/error_response.py new file mode 100644 index 00000000..bf2fe14f --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ips.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/ips/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/ips/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/get_ip200_response.py b/sendgrid/rest/api/ips/v3/models/get_ip200_response.py new file mode 100644 index 00000000..3a0e0fe7 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/get_ip200_response.py @@ -0,0 +1,53 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetIp200Response: + def __init__( + self, + ip: Optional[str] = None, + subusers: Optional[List[str]] = None, + rdns: Optional[str] = None, + pools: Optional[List[str]] = None, + warmup: Optional[bool] = None, + start_date: Optional[int] = None, + whitelabeled: Optional[bool] = None, + ): + self.ip = ip + self.subusers = subusers + self.rdns = rdns + self.pools = pools + self.warmup = warmup + self.start_date = start_date + self.whitelabeled = whitelabeled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "subusers": self.subusers, + "rdns": self.rdns, + "pools": self.pools, + "warmup": self.warmup, + "start_date": self.start_date, + "whitelabeled": self.whitelabeled, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIp200Response( + ip=payload.get("ip"), + subusers=payload.get("subusers"), + rdns=payload.get("rdns"), + pools=payload.get("pools"), + warmup=payload.get("warmup"), + start_date=payload.get("start_date"), + whitelabeled=payload.get("whitelabeled"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/get_ip_pool200_response.py b/sendgrid/rest/api/ips/v3/models/get_ip_pool200_response.py new file mode 100644 index 00000000..09b18636 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/get_ip_pool200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetIpPool200Response: + def __init__( + self, pool_name: Optional[str] = None, ips: Optional[List[str]] = None + ): + self.pool_name = pool_name + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"pool_name": self.pool_name, "ips": self.ips}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIpPool200Response( + pool_name=payload.get("pool_name"), ips=payload.get("ips") + ) diff --git a/sendgrid/rest/api/ips/v3/models/get_ip_pool404_response.py b/sendgrid/rest/api/ips/v3/models/get_ip_pool404_response.py new file mode 100644 index 00000000..7ddfc079 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/get_ip_pool404_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ips.v3.models.get_ip_pool404_response_errors_inner import ( + GetIpPool404ResponseErrorsInner, +) + + +class GetIpPool404Response: + def __init__(self, errors: Optional[List[GetIpPool404ResponseErrorsInner]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIpPool404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ips/v3/models/get_ip_pool404_response_errors_inner.py b/sendgrid/rest/api/ips/v3/models/get_ip_pool404_response_errors_inner.py new file mode 100644 index 00000000..f18e5766 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/get_ip_pool404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetIpPool404ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetIpPool404ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ips/v3/models/ip_pools200.py b/sendgrid/rest/api/ips/v3/models/ip_pools200.py new file mode 100644 index 00000000..ab42680d --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/ip_pools200.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class IpPools200: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return IpPools200(name=payload.get("name")) diff --git a/sendgrid/rest/api/ips/v3/models/list_assigned_ip200_response_inner.py b/sendgrid/rest/api/ips/v3/models/list_assigned_ip200_response_inner.py new file mode 100644 index 00000000..adb287af --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/list_assigned_ip200_response_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListAssignedIp200ResponseInner: + def __init__( + self, + ip: Optional[str] = None, + pools: Optional[List[str]] = None, + warmup: Optional[bool] = None, + start_date: Optional[int] = None, + ): + self.ip = ip + self.pools = pools + self.warmup = warmup + self.start_date = start_date + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "pools": self.pools, + "warmup": self.warmup, + "start_date": self.start_date, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAssignedIp200ResponseInner( + ip=payload.get("ip"), + pools=payload.get("pools"), + warmup=payload.get("warmup"), + start_date=payload.get("start_date"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/list_ip200_response_inner.py b/sendgrid/rest/api/ips/v3/models/list_ip200_response_inner.py new file mode 100644 index 00000000..aa7559d4 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/list_ip200_response_inner.py @@ -0,0 +1,57 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListIp200ResponseInner: + def __init__( + self, + ip: Optional[str] = None, + subusers: Optional[List[str]] = None, + rdns: Optional[str] = None, + pools: Optional[List[str]] = None, + warmup: Optional[bool] = None, + start_date: Optional[float] = None, + whitelabeled: Optional[bool] = None, + assigned_at: Optional[int] = None, + ): + self.ip = ip + self.subusers = subusers + self.rdns = rdns + self.pools = pools + self.warmup = warmup + self.start_date = start_date + self.whitelabeled = whitelabeled + self.assigned_at = assigned_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "subusers": self.subusers, + "rdns": self.rdns, + "pools": self.pools, + "warmup": self.warmup, + "start_date": self.start_date, + "whitelabeled": self.whitelabeled, + "assigned_at": self.assigned_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListIp200ResponseInner( + ip=payload.get("ip"), + subusers=payload.get("subusers"), + rdns=payload.get("rdns"), + pools=payload.get("pools"), + warmup=payload.get("warmup"), + start_date=payload.get("start_date"), + whitelabeled=payload.get("whitelabeled"), + assigned_at=payload.get("assigned_at"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response.py b/sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response.py new file mode 100644 index 00000000..b89f146f --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ips.v3.models.list_remaining_ip_count200_response_results_inner import ( + ListRemainingIpCount200ResponseResultsInner, +) + + +class ListRemainingIpCount200Response: + def __init__( + self, + results: Optional[List[ListRemainingIpCount200ResponseResultsInner]] = None, + ): + self.results = results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"results": self.results}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListRemainingIpCount200Response(results=payload.get("results")) diff --git a/sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response_results_inner.py b/sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response_results_inner.py new file mode 100644 index 00000000..826b2148 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/list_remaining_ip_count200_response_results_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListRemainingIpCount200ResponseResultsInner: + def __init__( + self, + remaining: Optional[int] = None, + period: Optional[str] = None, + price_per_ip: Optional[float] = None, + ): + self.remaining = remaining + self.period = period + self.price_per_ip = price_per_ip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "remaining": self.remaining, + "period": self.period, + "price_per_ip": self.price_per_ip, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListRemainingIpCount200ResponseResultsInner( + remaining=payload.get("remaining"), + period=payload.get("period"), + price_per_ip=payload.get("price_per_ip"), + ) diff --git a/sendgrid/rest/api/ips/v3/models/sort_by_direction.py b/sendgrid/rest/api/ips/v3/models/sort_by_direction.py new file mode 100644 index 00000000..b544b184 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/sort_by_direction.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class SortByDirection(Enum): + DESC = "desc" + ASC = "asc" diff --git a/sendgrid/rest/api/ips/v3/models/update_ip_pool404_response.py b/sendgrid/rest/api/ips/v3/models/update_ip_pool404_response.py new file mode 100644 index 00000000..91aecbad --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/update_ip_pool404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.ips.v3.models.update_ip_pool404_response_errors_inner import ( + UpdateIpPool404ResponseErrorsInner, +) + + +class UpdateIpPool404Response: + def __init__( + self, errors: Optional[List[UpdateIpPool404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIpPool404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/ips/v3/models/update_ip_pool404_response_errors_inner.py b/sendgrid/rest/api/ips/v3/models/update_ip_pool404_response_errors_inner.py new file mode 100644 index 00000000..bfe9dd3c --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/update_ip_pool404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateIpPool404ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIpPool404ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/ips/v3/models/update_ip_pool_request.py b/sendgrid/rest/api/ips/v3/models/update_ip_pool_request.py new file mode 100644 index 00000000..494b4915 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/models/update_ip_pool_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateIpPoolRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateIpPoolRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/ips/v3/update_ip_pool.py b/sendgrid/rest/api/ips/v3/update_ip_pool.py new file mode 100644 index 00000000..54b3bd30 --- /dev/null +++ b/sendgrid/rest/api/ips/v3/update_ip_pool.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid IP Address API + The Twilio SendGrid IP Address API allows you to add and manage dedicated IP addresses and IP Pools for your SendGrid account and Subusers. If you are sending any significant amount of email, SendGrid typically suggests sending from dedicated IPs. It's also best to send marketing and transactional emails from separate IP addresses. In order to do this, you'll need to set up IP Pools, which are groups of dedicated IP addresses you define to send particular types of messages. See the [**Dedicated IP Addresses**](https://docs.sendgrid.com/ui/account-and-settings/dedicated-ip-addresses) for more information about obtaining and allocating IPs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.ips.v3.models.update_ip_pool_request import UpdateIpPoolRequest + + +class UpdateIpPool: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + pool_name: str, + update_ip_pool_request: Optional[UpdateIpPoolRequest] = None, + ): + path = "/v3/ips/pools/{pool_name}" + path = path.format( + pool_name=pool_name, + ) + + data = None + if update_ip_pool_request: + data = update_ip_pool_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/__init__.py b/sendgrid/rest/api/link_branding/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/link_branding/v3/associate_branded_link_with_subuser.py b/sendgrid/rest/api/link_branding/v3/associate_branded_link_with_subuser.py new file mode 100644 index 00000000..b27ee927 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/associate_branded_link_with_subuser.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.link_branding.v3.models.associate_branded_link_with_subuser_request import ( + AssociateBrandedLinkWithSubuserRequest, +) + + +class AssociateBrandedLinkWithSubuser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + link_id: int, + associate_branded_link_with_subuser_request: Optional[ + AssociateBrandedLinkWithSubuserRequest + ] = None, + ): + path = "/v3/whitelabel/links/{link_id}/subuser" + path = path.format( + link_id=link_id, + ) + + data = None + if associate_branded_link_with_subuser_request: + data = associate_branded_link_with_subuser_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/create_branded_link.py b/sendgrid/rest/api/link_branding/v3/create_branded_link.py new file mode 100644 index 00000000..9e1e16a1 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/create_branded_link.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.link_branding.v3.models.create_branded_link_request import ( + CreateBrandedLinkRequest, +) + + +class CreateBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_branded_link_request: Optional[CreateBrandedLinkRequest] = None, + ): + path = "/v3/whitelabel/links" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_branded_link_request: + data = create_branded_link_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/delete_branded_link.py b/sendgrid/rest/api/link_branding/v3/delete_branded_link.py new file mode 100644 index 00000000..6357becf --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/delete_branded_link.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/links/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/disassociate_branded_link_from_subuser.py b/sendgrid/rest/api/link_branding/v3/disassociate_branded_link_from_subuser.py new file mode 100644 index 00000000..204a4dac --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/disassociate_branded_link_from_subuser.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DisassociateBrandedLinkFromSubuser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: Optional[str] = None, + ): + path = "/v3/whitelabel/links/subuser" + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/get_branded_link.py b/sendgrid/rest/api/link_branding/v3/get_branded_link.py new file mode 100644 index 00000000..a68c9242 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/get_branded_link.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/links/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/list_branded_link.py b/sendgrid/rest/api/link_branding/v3/list_branded_link.py new file mode 100644 index 00000000..b9830feb --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/list_branded_link.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + ): + path = "/v3/whitelabel/links" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/list_default_branded_link.py b/sendgrid/rest/api/link_branding/v3/list_default_branded_link.py new file mode 100644 index 00000000..b7a8e9fe --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/list_default_branded_link.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListDefaultBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + domain: Optional[str] = None, + ): + path = "/v3/whitelabel/links/default" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/list_subuser_branded_link.py b/sendgrid/rest/api/link_branding/v3/list_subuser_branded_link.py new file mode 100644 index 00000000..43bda144 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/list_subuser_branded_link.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListSubuserBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: Optional[str] = None, + ): + path = "/v3/whitelabel/links/subuser" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/__init__.py b/sendgrid/rest/api/link_branding/v3/models/__init__.py new file mode 100644 index 00000000..9810f19c --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/__init__.py @@ -0,0 +1,94 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.link_branding.v3.models.associate_branded_link_with_subuser_request import ( + AssociateBrandedLinkWithSubuserRequest, +) +from sendgrid.rest.api.link_branding.v3.models.create_branded_link_request import ( + CreateBrandedLinkRequest, +) +from sendgrid.rest.api.link_branding.v3.models.default import Default +from sendgrid.rest.api.link_branding.v3.models.default1 import Default1 +from sendgrid.rest.api.link_branding.v3.models.default2 import Default2 +from sendgrid.rest.api.link_branding.v3.models.legacy import Legacy +from sendgrid.rest.api.link_branding.v3.models.link_branding200 import LinkBranding200 +from sendgrid.rest.api.link_branding.v3.models.link_branding200_dns import ( + LinkBranding200Dns, +) +from sendgrid.rest.api.link_branding.v3.models.link_branding200_dns_domain_cname import ( + LinkBranding200DnsDomainCname, +) +from sendgrid.rest.api.link_branding.v3.models.link_branding200_dns_owner_cname import ( + LinkBranding200DnsOwnerCname, +) +from sendgrid.rest.api.link_branding.v3.models.region import Region +from sendgrid.rest.api.link_branding.v3.models.type import Type +from sendgrid.rest.api.link_branding.v3.models.type1 import Type1 +from sendgrid.rest.api.link_branding.v3.models.update_branded_link_request import ( + UpdateBrandedLinkRequest, +) +from sendgrid.rest.api.link_branding.v3.models.valid import Valid +from sendgrid.rest.api.link_branding.v3.models.valid1 import Valid1 +from sendgrid.rest.api.link_branding.v3.models.valid2 import Valid2 +from sendgrid.rest.api.link_branding.v3.models.valid3 import Valid3 +from sendgrid.rest.api.link_branding.v3.models.valid4 import Valid4 +from sendgrid.rest.api.link_branding.v3.models.valid5 import Valid5 +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response import ( + ValidateBrandedLink200Response, +) +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response_validation_results import ( + ValidateBrandedLink200ResponseValidationResults, +) +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response_validation_results_domain_cname import ( + ValidateBrandedLink200ResponseValidationResultsDomainCname, +) +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response_validation_results_owner_cname import ( + ValidateBrandedLink200ResponseValidationResultsOwnerCname, +) +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link500_response import ( + ValidateBrandedLink500Response, +) +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link500_response_errors_inner import ( + ValidateBrandedLink500ResponseErrorsInner, +) + +__all__ = [ + "AssociateBrandedLinkWithSubuserRequest", + "CreateBrandedLinkRequest", + "Default", + "Default1", + "Default2", + "Legacy", + "LinkBranding200", + "LinkBranding200Dns", + "LinkBranding200DnsDomainCname", + "LinkBranding200DnsOwnerCname", + "Region", + "Type", + "Type1", + "UpdateBrandedLinkRequest", + "Valid", + "Valid1", + "Valid2", + "Valid3", + "Valid4", + "Valid5", + "ValidateBrandedLink200Response", + "ValidateBrandedLink200ResponseValidationResults", + "ValidateBrandedLink200ResponseValidationResultsDomainCname", + "ValidateBrandedLink200ResponseValidationResultsOwnerCname", + "ValidateBrandedLink500Response", + "ValidateBrandedLink500ResponseErrorsInner", +] +# Testing code diff --git a/sendgrid/rest/api/link_branding/v3/models/associate_branded_link_with_subuser_request.py b/sendgrid/rest/api/link_branding/v3/models/associate_branded_link_with_subuser_request.py new file mode 100644 index 00000000..8084aa83 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/associate_branded_link_with_subuser_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AssociateBrandedLinkWithSubuserRequest: + def __init__(self, username: Optional[str] = None): + self.username = username + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"username": self.username}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AssociateBrandedLinkWithSubuserRequest(username=payload.get("username")) diff --git a/sendgrid/rest/api/link_branding/v3/models/create_branded_link_request.py b/sendgrid/rest/api/link_branding/v3/models/create_branded_link_request.py new file mode 100644 index 00000000..66db65a4 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/create_branded_link_request.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.default import Default +from sendgrid.rest.api.link_branding.v3.models.region import Region + + +class CreateBrandedLinkRequest: + def __init__( + self, + domain: Optional[str] = None, + subdomain: Optional[str] = None, + default: Optional[Default] = None, + region: Optional[Region] = None, + ): + self.domain = domain + self.subdomain = subdomain + self.default = default + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "domain": self.domain, + "subdomain": self.subdomain, + "default": self.default, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateBrandedLinkRequest( + domain=payload.get("domain"), + subdomain=payload.get("subdomain"), + default=payload.get("default"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/default.py b/sendgrid/rest/api/link_branding/v3/models/default.py new file mode 100644 index 00000000..87253322 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/default.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Default(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/default1.py b/sendgrid/rest/api/link_branding/v3/models/default1.py new file mode 100644 index 00000000..5fc4803c --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/default1.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Default1(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/default2.py b/sendgrid/rest/api/link_branding/v3/models/default2.py new file mode 100644 index 00000000..e72d4bc0 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/default2.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Default2(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/legacy.py b/sendgrid/rest/api/link_branding/v3/models/legacy.py new file mode 100644 index 00000000..85e590be --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/legacy.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Legacy(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/link_branding200.py b/sendgrid/rest/api/link_branding/v3/models/link_branding200.py new file mode 100644 index 00000000..96c24cb1 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/link_branding200.py @@ -0,0 +1,67 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.default2 import Default2 +from sendgrid.rest.api.link_branding.v3.models.legacy import Legacy +from sendgrid.rest.api.link_branding.v3.models.link_branding200_dns import ( + LinkBranding200Dns, +) +from sendgrid.rest.api.link_branding.v3.models.valid3 import Valid3 + + +class LinkBranding200: + def __init__( + self, + id: Optional[int] = None, + domain: Optional[str] = None, + subdomain: Optional[str] = None, + username: Optional[str] = None, + user_id: Optional[int] = None, + default: Optional[Default2] = None, + valid: Optional[Valid3] = None, + legacy: Optional[Legacy] = None, + dns: Optional[LinkBranding200Dns] = None, + ): + self.id = id + self.domain = domain + self.subdomain = subdomain + self.username = username + self.user_id = user_id + self.default = default + self.valid = valid + self.legacy = legacy + self.dns = dns + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "domain": self.domain, + "subdomain": self.subdomain, + "username": self.username, + "user_id": self.user_id, + "default": self.default, + "valid": self.valid, + "legacy": self.legacy, + "dns": self.dns, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return LinkBranding200( + id=payload.get("id"), + domain=payload.get("domain"), + subdomain=payload.get("subdomain"), + username=payload.get("username"), + user_id=payload.get("user_id"), + default=payload.get("default"), + valid=payload.get("valid"), + legacy=payload.get("legacy"), + dns=payload.get("dns"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns.py b/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns.py new file mode 100644 index 00000000..56a01c2d --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns.py @@ -0,0 +1,39 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.link_branding200_dns_domain_cname import ( + LinkBranding200DnsDomainCname, +) +from sendgrid.rest.api.link_branding.v3.models.link_branding200_dns_owner_cname import ( + LinkBranding200DnsOwnerCname, +) + + +class LinkBranding200Dns: + def __init__( + self, + domain_cname: Optional[LinkBranding200DnsDomainCname] = None, + owner_cname: Optional[LinkBranding200DnsOwnerCname] = None, + ): + self.domain_cname = domain_cname + self.owner_cname = owner_cname + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "domain_cname": self.domain_cname, + "owner_cname": self.owner_cname, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return LinkBranding200Dns( + domain_cname=payload.get("domain_cname"), + owner_cname=payload.get("owner_cname"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_domain_cname.py b/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_domain_cname.py new file mode 100644 index 00000000..01c45611 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_domain_cname.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.type import Type +from sendgrid.rest.api.link_branding.v3.models.valid4 import Valid4 + + +class LinkBranding200DnsDomainCname: + def __init__( + self, + valid: Optional[Valid4] = None, + type: Optional[Type] = None, + host: Optional[str] = None, + data: Optional[str] = None, + ): + self.valid = valid + self.type = type + self.host = host + self.data = data + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "valid": self.valid, + "type": self.type, + "host": self.host, + "data": self.data, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return LinkBranding200DnsDomainCname( + valid=payload.get("valid"), + type=payload.get("type"), + host=payload.get("host"), + data=payload.get("data"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_owner_cname.py b/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_owner_cname.py new file mode 100644 index 00000000..310d18ae --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/link_branding200_dns_owner_cname.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.type1 import Type1 +from sendgrid.rest.api.link_branding.v3.models.valid5 import Valid5 + + +class LinkBranding200DnsOwnerCname: + def __init__( + self, + valid: Optional[Valid5] = None, + type: Optional[Type1] = None, + host: Optional[str] = None, + data: Optional[str] = None, + ): + self.valid = valid + self.type = type + self.host = host + self.data = data + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "valid": self.valid, + "type": self.type, + "host": self.host, + "data": self.data, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return LinkBranding200DnsOwnerCname( + valid=payload.get("valid"), + type=payload.get("type"), + host=payload.get("host"), + data=payload.get("data"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/region.py b/sendgrid/rest/api/link_branding/v3/models/region.py new file mode 100644 index 00000000..7a3adff7 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/region.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region(Enum): + EU = "eu" + US = "us" diff --git a/sendgrid/rest/api/link_branding/v3/models/type.py b/sendgrid/rest/api/link_branding/v3/models/type.py new file mode 100644 index 00000000..ecb752dd --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/type.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + CNAME = "cname" + TXT = "txt" + MX = "mx" diff --git a/sendgrid/rest/api/link_branding/v3/models/type1.py b/sendgrid/rest/api/link_branding/v3/models/type1.py new file mode 100644 index 00000000..a01654bf --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/type1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Type1(Enum): + CNAME = "cname" + TXT = "txt" + MX = "mx" diff --git a/sendgrid/rest/api/link_branding/v3/models/update_branded_link_request.py b/sendgrid/rest/api/link_branding/v3/models/update_branded_link_request.py new file mode 100644 index 00000000..b8db059e --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/update_branded_link_request.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.default1 import Default1 + + +class UpdateBrandedLinkRequest: + def __init__(self, default: Optional[Default1] = None): + self.default = default + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"default": self.default}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateBrandedLinkRequest(default=payload.get("default")) diff --git a/sendgrid/rest/api/link_branding/v3/models/valid.py b/sendgrid/rest/api/link_branding/v3/models/valid.py new file mode 100644 index 00000000..570b350b --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/valid.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/valid1.py b/sendgrid/rest/api/link_branding/v3/models/valid1.py new file mode 100644 index 00000000..60adc23f --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/valid1.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid1(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/valid2.py b/sendgrid/rest/api/link_branding/v3/models/valid2.py new file mode 100644 index 00000000..f13d1435 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/valid2.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid2(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/valid3.py b/sendgrid/rest/api/link_branding/v3/models/valid3.py new file mode 100644 index 00000000..ff8a91d7 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/valid3.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid3(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/valid4.py b/sendgrid/rest/api/link_branding/v3/models/valid4.py new file mode 100644 index 00000000..58f1f8da --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/valid4.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid4(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/valid5.py b/sendgrid/rest/api/link_branding/v3/models/valid5.py new file mode 100644 index 00000000..9db85a74 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/valid5.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid5(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response.py b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response.py new file mode 100644 index 00000000..4fa96511 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.valid import Valid +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response_validation_results import ( + ValidateBrandedLink200ResponseValidationResults, +) + + +class ValidateBrandedLink200Response: + def __init__( + self, + id: Optional[int] = None, + valid: Optional[Valid] = None, + validation_results: Optional[ + ValidateBrandedLink200ResponseValidationResults + ] = None, + ): + self.id = id + self.valid = valid + self.validation_results = validation_results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "valid": self.valid, + "validation_results": self.validation_results, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateBrandedLink200Response( + id=payload.get("id"), + valid=payload.get("valid"), + validation_results=payload.get("validation_results"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results.py b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results.py new file mode 100644 index 00000000..06153650 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response_validation_results_domain_cname import ( + ValidateBrandedLink200ResponseValidationResultsDomainCname, +) +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link200_response_validation_results_owner_cname import ( + ValidateBrandedLink200ResponseValidationResultsOwnerCname, +) + + +class ValidateBrandedLink200ResponseValidationResults: + def __init__( + self, + domain_cname: Optional[ + ValidateBrandedLink200ResponseValidationResultsDomainCname + ] = None, + owner_cname: Optional[ + ValidateBrandedLink200ResponseValidationResultsOwnerCname + ] = None, + ): + self.domain_cname = domain_cname + self.owner_cname = owner_cname + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "domain_cname": self.domain_cname, + "owner_cname": self.owner_cname, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateBrandedLink200ResponseValidationResults( + domain_cname=payload.get("domain_cname"), + owner_cname=payload.get("owner_cname"), + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_domain_cname.py b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_domain_cname.py new file mode 100644 index 00000000..194e1eef --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_domain_cname.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.valid1 import Valid1 + + +class ValidateBrandedLink200ResponseValidationResultsDomainCname: + def __init__(self, valid: Optional[Valid1] = None, reason: Optional[str] = None): + self.valid = valid + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"valid": self.valid, "reason": self.reason}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateBrandedLink200ResponseValidationResultsDomainCname( + valid=payload.get("valid"), reason=payload.get("reason") + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_owner_cname.py b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_owner_cname.py new file mode 100644 index 00000000..c5405da0 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link200_response_validation_results_owner_cname.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.valid2 import Valid2 + + +class ValidateBrandedLink200ResponseValidationResultsOwnerCname: + def __init__(self, valid: Optional[Valid2] = None, reason: Optional[str] = None): + self.valid = valid + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"valid": self.valid, "reason": self.reason}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateBrandedLink200ResponseValidationResultsOwnerCname( + valid=payload.get("valid"), reason=payload.get("reason") + ) diff --git a/sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response.py b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response.py new file mode 100644 index 00000000..6703c994 --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.link_branding.v3.models.validate_branded_link500_response_errors_inner import ( + ValidateBrandedLink500ResponseErrorsInner, +) + + +class ValidateBrandedLink500Response: + def __init__( + self, errors: Optional[List[ValidateBrandedLink500ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateBrandedLink500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response_errors_inner.py b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response_errors_inner.py new file mode 100644 index 00000000..1b38c59f --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/models/validate_branded_link500_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateBrandedLink500ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateBrandedLink500ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/link_branding/v3/update_branded_link.py b/sendgrid/rest/api/link_branding/v3/update_branded_link.py new file mode 100644 index 00000000..f7e3f9aa --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/update_branded_link.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.link_branding.v3.models.update_branded_link_request import ( + UpdateBrandedLinkRequest, +) + + +class UpdateBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + update_branded_link_request: Optional[UpdateBrandedLinkRequest] = None, + ): + path = "/v3/whitelabel/links/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_branded_link_request: + data = update_branded_link_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/link_branding/v3/validate_branded_link.py b/sendgrid/rest/api/link_branding/v3/validate_branded_link.py new file mode 100644 index 00000000..4f29550a --- /dev/null +++ b/sendgrid/rest/api/link_branding/v3/validate_branded_link.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Link Branding API + The Twilio SendGrid Link Branding API allows you to configure your domain settings so that all of the click-tracked links, opens, and images in your emails are served from your domain rather than `sendgrid.net`. Spam filters and recipient servers look at the links within emails to determine whether the email appear trustworthy. They use the reputation of the root domain to determine whether the links can be trusted. You can also manage Link Branding in the **Sender Authentication** section of the Twilio SendGrid application user interface. See [**How to Set Up Link Branding**](https: //sendgrid.com/docs/ui/account-and-settings/how-to-set-up-link-branding/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ValidateBrandedLink: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/links/{id}/validate" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/__init__.py b/sendgrid/rest/api/lmc_campaigns/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/lmc_campaigns/v3/create_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/create_campaign.py new file mode 100644 index 00000000..351c498f --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/create_campaign.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_campaigns.v3.models.post_campaigns_request import ( + PostCampaignsRequest, +) + + +class CreateCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + post_campaigns_request: Optional[PostCampaignsRequest] = None, + ): + path = "/v3/campaigns" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if post_campaigns_request: + data = post_campaigns_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/delete_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/delete_campaign.py new file mode 100644 index 00000000..5f3e650c --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/delete_campaign.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/campaigns/{campaign_id}" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/get_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/get_campaign.py new file mode 100644 index 00000000..7cd91834 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/get_campaign.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/campaigns/{campaign_id}" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/get_scheduled_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/get_scheduled_campaign.py new file mode 100644 index 00000000..75c8c285 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/get_scheduled_campaign.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetScheduledCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/campaigns/{campaign_id}/schedules" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/list_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/list_campaign.py new file mode 100644 index 00000000..0ec86af2 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/list_campaign.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/campaigns" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/__init__.py b/sendgrid/rest/api/lmc_campaigns/v3/models/__init__.py new file mode 100644 index 00000000..6c3e1e67 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/__init__.py @@ -0,0 +1,78 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.lmc_campaigns.v3.models.campaigns2xx import Campaigns2xx +from sendgrid.rest.api.lmc_campaigns.v3.models.editor import Editor +from sendgrid.rest.api.lmc_campaigns.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.lmc_campaigns.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.get_campaign200_response import ( + GetCampaign200Response, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.list_campaign200_response import ( + ListCampaign200Response, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.post_campaigns_request import ( + PostCampaignsRequest, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.schedule_a_campaign_request import ( + ScheduleACampaignRequest, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.schedule_a_campaign_response import ( + ScheduleACampaignResponse, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.send_a_campaign_response import ( + SendACampaignResponse, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.send_a_test_campaign_request import ( + SendATestCampaignRequest, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.send_test_campaign_request import ( + SendTestCampaignRequest, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.status import Status +from sendgrid.rest.api.lmc_campaigns.v3.models.update_a_campaign_request import ( + UpdateACampaignRequest, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.update_a_scheduled_campaign_request import ( + UpdateAScheduledCampaignRequest, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.update_a_scheduled_campaign_response import ( + UpdateAScheduledCampaignResponse, +) +from sendgrid.rest.api.lmc_campaigns.v3.models.view_scheduled_time_of_a_campaign_response import ( + ViewScheduledTimeOfACampaignResponse, +) + +__all__ = [ + "Campaigns2xx", + "Editor", + "ErrorResponse", + "ErrorResponseErrorsInner", + "GetCampaign200Response", + "ListCampaign200Response", + "PostCampaignsRequest", + "ScheduleACampaignRequest", + "ScheduleACampaignResponse", + "SendACampaignResponse", + "SendATestCampaignRequest", + "SendTestCampaignRequest", + "Status", + "UpdateACampaignRequest", + "UpdateAScheduledCampaignRequest", + "UpdateAScheduledCampaignResponse", + "ViewScheduledTimeOfACampaignResponse", +] +# Testing code diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/campaigns2xx.py b/sendgrid/rest/api/lmc_campaigns/v3/models/campaigns2xx.py new file mode 100644 index 00000000..94b24533 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/campaigns2xx.py @@ -0,0 +1,82 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_campaigns.v3.models.editor import Editor + + +class Campaigns2xx: + def __init__( + self, + title: Optional[str] = None, + subject: Optional[str] = None, + sender_id: Optional[int] = None, + list_ids: Optional[List[int]] = None, + segment_ids: Optional[List[int]] = None, + categories: Optional[List[str]] = None, + suppression_group_id: Optional[int] = None, + custom_unsubscribe_url: Optional[str] = None, + ip_pool: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + editor: Optional[Editor] = None, + status: Optional[str] = None, + id: Optional[int] = None, + ): + self.title = title + self.subject = subject + self.sender_id = sender_id + self.list_ids = list_ids + self.segment_ids = segment_ids + self.categories = categories + self.suppression_group_id = suppression_group_id + self.custom_unsubscribe_url = custom_unsubscribe_url + self.ip_pool = ip_pool + self.html_content = html_content + self.plain_content = plain_content + self.editor = editor + self.status = status + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "title": self.title, + "subject": self.subject, + "sender_id": self.sender_id, + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "categories": self.categories, + "suppression_group_id": self.suppression_group_id, + "custom_unsubscribe_url": self.custom_unsubscribe_url, + "ip_pool": self.ip_pool, + "html_content": self.html_content, + "plain_content": self.plain_content, + "editor": self.editor, + "status": self.status, + "id": self.id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Campaigns2xx( + title=payload.get("title"), + subject=payload.get("subject"), + sender_id=payload.get("sender_id"), + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + categories=payload.get("categories"), + suppression_group_id=payload.get("suppression_group_id"), + custom_unsubscribe_url=payload.get("custom_unsubscribe_url"), + ip_pool=payload.get("ip_pool"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + editor=payload.get("editor"), + status=payload.get("status"), + id=payload.get("id"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/editor.py b/sendgrid/rest/api/lmc_campaigns/v3/models/editor.py new file mode 100644 index 00000000..47b41f47 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/editor.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Editor(Enum): + CODE = "code" + DESIGN = "design" diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/error_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/error_response.py new file mode 100644 index 00000000..9c1c5529 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_campaigns.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/lmc_campaigns/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/get_campaign200_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/get_campaign200_response.py new file mode 100644 index 00000000..abf44215 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/get_campaign200_response.py @@ -0,0 +1,77 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetCampaign200Response: + def __init__( + self, + categories: Optional[List[str]] = None, + custom_unsubscribe_url: Optional[str] = None, + html_content: Optional[str] = None, + id: Optional[int] = None, + ip_pool: Optional[str] = None, + list_ids: Optional[List[int]] = None, + plain_content: Optional[str] = None, + segment_ids: Optional[List[int]] = None, + sender_id: Optional[int] = None, + status: Optional[str] = None, + subject: Optional[str] = None, + suppression_group_id: Optional[int] = None, + title: Optional[str] = None, + ): + self.categories = categories + self.custom_unsubscribe_url = custom_unsubscribe_url + self.html_content = html_content + self.id = id + self.ip_pool = ip_pool + self.list_ids = list_ids + self.plain_content = plain_content + self.segment_ids = segment_ids + self.sender_id = sender_id + self.status = status + self.subject = subject + self.suppression_group_id = suppression_group_id + self.title = title + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "categories": self.categories, + "custom_unsubscribe_url": self.custom_unsubscribe_url, + "html_content": self.html_content, + "id": self.id, + "ip_pool": self.ip_pool, + "list_ids": self.list_ids, + "plain_content": self.plain_content, + "segment_ids": self.segment_ids, + "sender_id": self.sender_id, + "status": self.status, + "subject": self.subject, + "suppression_group_id": self.suppression_group_id, + "title": self.title, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetCampaign200Response( + categories=payload.get("categories"), + custom_unsubscribe_url=payload.get("custom_unsubscribe_url"), + html_content=payload.get("html_content"), + id=payload.get("id"), + ip_pool=payload.get("ip_pool"), + list_ids=payload.get("list_ids"), + plain_content=payload.get("plain_content"), + segment_ids=payload.get("segment_ids"), + sender_id=payload.get("sender_id"), + status=payload.get("status"), + subject=payload.get("subject"), + suppression_group_id=payload.get("suppression_group_id"), + title=payload.get("title"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/list_campaign200_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/list_campaign200_response.py new file mode 100644 index 00000000..4cd34865 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/list_campaign200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_campaigns.v3.models.campaigns2xx import Campaigns2xx + + +class ListCampaign200Response: + def __init__(self, result: Optional[List[Campaigns2xx]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListCampaign200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/post_campaigns_request.py b/sendgrid/rest/api/lmc_campaigns/v3/models/post_campaigns_request.py new file mode 100644 index 00000000..e5d97fbb --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/post_campaigns_request.py @@ -0,0 +1,74 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_campaigns.v3.models.editor import Editor + + +class PostCampaignsRequest: + def __init__( + self, + title: Optional[str] = None, + subject: Optional[str] = None, + sender_id: Optional[int] = None, + list_ids: Optional[List[int]] = None, + segment_ids: Optional[List[int]] = None, + categories: Optional[List[str]] = None, + suppression_group_id: Optional[int] = None, + custom_unsubscribe_url: Optional[str] = None, + ip_pool: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + editor: Optional[Editor] = None, + ): + self.title = title + self.subject = subject + self.sender_id = sender_id + self.list_ids = list_ids + self.segment_ids = segment_ids + self.categories = categories + self.suppression_group_id = suppression_group_id + self.custom_unsubscribe_url = custom_unsubscribe_url + self.ip_pool = ip_pool + self.html_content = html_content + self.plain_content = plain_content + self.editor = editor + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "title": self.title, + "subject": self.subject, + "sender_id": self.sender_id, + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "categories": self.categories, + "suppression_group_id": self.suppression_group_id, + "custom_unsubscribe_url": self.custom_unsubscribe_url, + "ip_pool": self.ip_pool, + "html_content": self.html_content, + "plain_content": self.plain_content, + "editor": self.editor, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PostCampaignsRequest( + title=payload.get("title"), + subject=payload.get("subject"), + sender_id=payload.get("sender_id"), + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + categories=payload.get("categories"), + suppression_group_id=payload.get("suppression_group_id"), + custom_unsubscribe_url=payload.get("custom_unsubscribe_url"), + ip_pool=payload.get("ip_pool"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + editor=payload.get("editor"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_request.py b/sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_request.py new file mode 100644 index 00000000..cf709fc1 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ScheduleACampaignRequest: + def __init__(self, send_at: Optional[int] = None): + self.send_at = send_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"send_at": self.send_at}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ScheduleACampaignRequest(send_at=payload.get("send_at")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_response.py new file mode 100644 index 00000000..7f589138 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/schedule_a_campaign_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_campaigns.v3.models.status import Status + + +class ScheduleACampaignResponse: + def __init__( + self, + id: Optional[int] = None, + send_at: Optional[int] = None, + status: Optional[Status] = None, + ): + self.id = id + self.send_at = send_at + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "send_at": self.send_at, + "status": self.status, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ScheduleACampaignResponse( + id=payload.get("id"), + send_at=payload.get("send_at"), + status=payload.get("status"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/send_a_campaign_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/send_a_campaign_response.py new file mode 100644 index 00000000..9f26feb5 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/send_a_campaign_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendACampaignResponse: + def __init__(self, id: Optional[int] = None, status: Optional[str] = None): + self.id = id + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"id": self.id, "status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendACampaignResponse(id=payload.get("id"), status=payload.get("status")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/send_a_test_campaign_request.py b/sendgrid/rest/api/lmc_campaigns/v3/models/send_a_test_campaign_request.py new file mode 100644 index 00000000..3eb50a0c --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/send_a_test_campaign_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendATestCampaignRequest: + def __init__(self, to: Optional[str] = None): + self.to = to + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"to": self.to}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendATestCampaignRequest(to=payload.get("to")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/send_test_campaign_request.py b/sendgrid/rest/api/lmc_campaigns/v3/models/send_test_campaign_request.py new file mode 100644 index 00000000..4eeb2dba --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/send_test_campaign_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendTestCampaignRequest: + def __init__(self, to: Optional[str] = None): + self.to = to + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"to": self.to}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendTestCampaignRequest(to=payload.get("to")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/status.py b/sendgrid/rest/api/lmc_campaigns/v3/models/status.py new file mode 100644 index 00000000..4914fae8 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/status.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Status(Enum): + SCHEDULED = "Scheduled" diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_campaign_request.py b/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_campaign_request.py new file mode 100644 index 00000000..f162bbd2 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_campaign_request.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateACampaignRequest: + def __init__( + self, + title: Optional[str] = None, + subject: Optional[str] = None, + categories: Optional[List[str]] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + ): + self.title = title + self.subject = subject + self.categories = categories + self.html_content = html_content + self.plain_content = plain_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "title": self.title, + "subject": self.subject, + "categories": self.categories, + "html_content": self.html_content, + "plain_content": self.plain_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateACampaignRequest( + title=payload.get("title"), + subject=payload.get("subject"), + categories=payload.get("categories"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_request.py b/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_request.py new file mode 100644 index 00000000..ec66a56b --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAScheduledCampaignRequest: + def __init__(self, send_at: Optional[int] = None): + self.send_at = send_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"send_at": self.send_at}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAScheduledCampaignRequest(send_at=payload.get("send_at")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_response.py new file mode 100644 index 00000000..22fb4f7d --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/update_a_scheduled_campaign_response.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAScheduledCampaignResponse: + def __init__( + self, + id: Optional[int] = None, + send_at: Optional[int] = None, + status: Optional[str] = None, + ): + self.id = id + self.send_at = send_at + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "send_at": self.send_at, + "status": self.status, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAScheduledCampaignResponse( + id=payload.get("id"), + send_at=payload.get("send_at"), + status=payload.get("status"), + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/models/view_scheduled_time_of_a_campaign_response.py b/sendgrid/rest/api/lmc_campaigns/v3/models/view_scheduled_time_of_a_campaign_response.py new file mode 100644 index 00000000..15372284 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/models/view_scheduled_time_of_a_campaign_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ViewScheduledTimeOfACampaignResponse: + def __init__(self, send_at: Optional[int] = None): + self.send_at = send_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"send_at": self.send_at}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ViewScheduledTimeOfACampaignResponse(send_at=payload.get("send_at")) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/schedule_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/schedule_campaign.py new file mode 100644 index 00000000..6c76cee5 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/schedule_campaign.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_campaigns.v3.models.schedule_a_campaign_request import ( + ScheduleACampaignRequest, +) + + +class ScheduleCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + schedule_a_campaign_request: Optional[ScheduleACampaignRequest] = None, + ): + path = "/v3/campaigns/{campaign_id}/schedules" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if schedule_a_campaign_request: + data = schedule_a_campaign_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/send_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/send_campaign.py new file mode 100644 index 00000000..99448c65 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/send_campaign.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class SendCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/campaigns/{campaign_id}/schedules/now" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/send_test_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/send_test_campaign.py new file mode 100644 index 00000000..5036694f --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/send_test_campaign.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_campaigns.v3.models.send_test_campaign_request import ( + SendTestCampaignRequest, +) + + +class SendTestCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + send_test_campaign_request: Optional[SendTestCampaignRequest] = None, + ): + path = "/v3/campaigns/{campaign_id}/schedules/test" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if send_test_campaign_request: + data = send_test_campaign_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/un_schedule_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/un_schedule_campaign.py new file mode 100644 index 00000000..c6846923 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/un_schedule_campaign.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class UnScheduleCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/campaigns/{campaign_id}/schedules" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/update_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/update_campaign.py new file mode 100644 index 00000000..92f7d562 --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/update_campaign.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_campaigns.v3.models.update_a_campaign_request import ( + UpdateACampaignRequest, +) + + +class UpdateCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + update_a_campaign_request: Optional[UpdateACampaignRequest] = None, + ): + path = "/v3/campaigns/{campaign_id}" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_a_campaign_request: + data = update_a_campaign_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_campaigns/v3/update_scheduled_campaign.py b/sendgrid/rest/api/lmc_campaigns/v3/update_scheduled_campaign.py new file mode 100644 index 00000000..622ecc1f --- /dev/null +++ b/sendgrid/rest/api/lmc_campaigns/v3/update_scheduled_campaign.py @@ -0,0 +1,71 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Campaigns API + The Twilio SendGrid Legacy Marketing Campaigns Campaigns API allows you to manage your marketing email messages programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your marketing messages with SendGrid [Single Sends](https://docs.sendgrid.com/api-reference/single-sends/) and [Automations](https://docs.sendgrid.com/ui/sending-email/getting-started-with-automation). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_campaigns.v3.models.update_a_scheduled_campaign_request import ( + UpdateAScheduledCampaignRequest, +) + + +class UpdateScheduledCampaign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + campaign_id: int, + on_behalf_of: Optional[str] = None, + update_a_scheduled_campaign_request: Optional[ + UpdateAScheduledCampaignRequest + ] = None, + ): + path = "/v3/campaigns/{campaign_id}/schedules" + path = path.format( + campaign_id=campaign_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_a_scheduled_campaign_request: + data = update_a_scheduled_campaign_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/__init__.py b/sendgrid/rest/api/lmc_contactdb/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/lmc_contactdb/v3/add_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/add_recipient.py new file mode 100644 index 00000000..f75b75cb --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/add_recipient.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.add_recipient_request_inner import ( + AddRecipientRequestInner, +) + + +class AddRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + add_recipient_request_inner: Optional[List[AddRecipientRequestInner]] = None, + ): + path = "/v3/contactdb/recipients" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if add_recipient_request_inner: + data = add_recipient_request_inner.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/add_recipient_to_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/add_recipient_to_contact_db_list.py new file mode 100644 index 00000000..6238ff2a --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/add_recipient_to_contact_db_list.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class AddRecipientToContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + recipient_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/lists/{list_id}/recipients/{recipient_id}" + path = path.format( + list_id=list_id, + recipient_id=recipient_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/add_recipients_to_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/add_recipients_to_contact_db_list.py new file mode 100644 index 00000000..dd124cc7 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/add_recipients_to_contact_db_list.py @@ -0,0 +1,66 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class AddRecipientsToContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + on_behalf_of: Optional[str] = None, + request_body: Optional[List[str]] = None, + ): + path = "/v3/contactdb/lists/{list_id}/recipients" + path = path.format( + list_id=list_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if request_body: + data = request_body.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/create_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/create_contact_db_list.py new file mode 100644 index 00000000..16d5de03 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/create_contact_db_list.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.create_a_list_request import ( + CreateAListRequest, +) + + +class CreateContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_a_list_request: Optional[CreateAListRequest] = None, + ): + path = "/v3/contactdb/lists" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_a_list_request: + data = create_a_list_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/create_custom_field.py b/sendgrid/rest/api/lmc_contactdb/v3/create_custom_field.py new file mode 100644 index 00000000..5ce761c0 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/create_custom_field.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.create_custom_field_request import ( + CreateCustomFieldRequest, +) + + +class CreateCustomField: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_custom_field_request: Optional[CreateCustomFieldRequest] = None, + ): + path = "/v3/contactdb/custom_fields" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_custom_field_request: + data = create_custom_field_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/create_segment.py b/sendgrid/rest/api/lmc_contactdb/v3/create_segment.py new file mode 100644 index 00000000..a36a5d7f --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/create_segment.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments import ( + ContactdbSegments, +) + + +class CreateSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + contactdb_segments: Optional[ContactdbSegments] = None, + ): + path = "/v3/contactdb/segments" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if contactdb_segments: + data = contactdb_segments.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_list.py new file mode 100644 index 00000000..ad4e8a3a --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_list.py @@ -0,0 +1,68 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.delete_contacts import DeleteContacts + + +class DeleteContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + on_behalf_of: Optional[str] = None, + delete_contacts: Optional[DeleteContacts] = None, + body: Optional[object] = None, + ): + path = "/v3/contactdb/lists/{list_id}" + path = path.format( + list_id=list_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if body: + data = body.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_lists.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_lists.py new file mode 100644 index 00000000..c497e3be --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_contact_db_lists.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class DeleteContactDbLists: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + request_body: Optional[List[int]] = None, + ): + path = "/v3/contactdb/lists" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if request_body: + data = request_body.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_custom_field.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_custom_field.py new file mode 100644 index 00000000..f83d5db8 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_custom_field.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteCustomField: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + custom_field_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/custom_fields/{custom_field_id}" + path = path.format( + custom_field_id=custom_field_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_recipient.py new file mode 100644 index 00000000..92e877f8 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_recipient.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + recipient_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/recipients/{recipient_id}" + path = path.format( + recipient_id=recipient_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_recipient_from_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_recipient_from_contact_db_list.py new file mode 100644 index 00000000..23ca7c23 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_recipient_from_contact_db_list.py @@ -0,0 +1,68 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteRecipientFromContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + recipient_id: str, + on_behalf_of: Optional[str] = None, + body: Optional[object] = None, + ): + path = "/v3/contactdb/lists/{list_id}/recipients/{recipient_id}" + path = path.format( + list_id=list_id, + recipient_id=recipient_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if body: + data = body.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_recipients.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_recipients.py new file mode 100644 index 00000000..96d629f9 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_recipients.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class DeleteRecipients: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + request_body: Optional[List[str]] = None, + ): + path = "/v3/contactdb/recipients" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if request_body: + data = request_body.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/delete_segment.py b/sendgrid/rest/api/lmc_contactdb/v3/delete_segment.py new file mode 100644 index 00000000..dae2f7b4 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/delete_segment.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: int, + on_behalf_of: Optional[str] = None, + delete_contacts: Optional[bool] = None, + body: Optional[object] = None, + ): + path = "/v3/contactdb/segments/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if body: + data = body.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/get_billable.py b/sendgrid/rest/api/lmc_contactdb/v3/get_billable.py new file mode 100644 index 00000000..2aec4fb9 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/get_billable.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetBillable: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/recipients/billable_count" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/get_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/get_contact_db_list.py new file mode 100644 index 00000000..7492692c --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/get_contact_db_list.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/lists/{list_id}" + path = path.format( + list_id=list_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/get_custom_field.py b/sendgrid/rest/api/lmc_contactdb/v3/get_custom_field.py new file mode 100644 index 00000000..784cdea1 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/get_custom_field.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetCustomField: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + custom_field_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/custom_fields/{custom_field_id}" + path = path.format( + custom_field_id=custom_field_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/get_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/get_recipient.py new file mode 100644 index 00000000..8c3264da --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/get_recipient.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + recipient_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/recipients/{recipient_id}" + path = path.format( + recipient_id=recipient_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/get_recipient_list.py b/sendgrid/rest/api/lmc_contactdb/v3/get_recipient_list.py new file mode 100644 index 00000000..58dea3e4 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/get_recipient_list.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetRecipientList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + recipient_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/recipients/{recipient_id}/lists" + path = path.format( + recipient_id=recipient_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/get_segment.py b/sendgrid/rest/api/lmc_contactdb/v3/get_segment.py new file mode 100644 index 00000000..54d69231 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/get_segment.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/segments/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/list_contact_db_list.py new file mode 100644 index 00000000..e5edfd46 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_contact_db_list.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/lists" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_custom_field.py b/sendgrid/rest/api/lmc_contactdb/v3/list_custom_field.py new file mode 100644 index 00000000..5ac689fc --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_custom_field.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListCustomField: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/custom_fields" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/list_recipient.py new file mode 100644 index 00000000..686e81ad --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_recipient.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + ): + path = "/v3/contactdb/recipients" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_recipient_count.py b/sendgrid/rest/api/lmc_contactdb/v3/list_recipient_count.py new file mode 100644 index 00000000..2efea749 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_recipient_count.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListRecipientCount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/recipients/count" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_recipient_for_segment.py b/sendgrid/rest/api/lmc_contactdb/v3/list_recipient_for_segment.py new file mode 100644 index 00000000..9de8061c --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_recipient_for_segment.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListRecipientForSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: int, + on_behalf_of: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + ): + path = "/v3/contactdb/segments/{segment_id}/recipients" + path = path.format( + segment_id=segment_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_recipients_from_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/list_recipients_from_contact_db_list.py new file mode 100644 index 00000000..e393c8f1 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_recipients_from_contact_db_list.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListRecipientsFromContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + on_behalf_of: Optional[str] = None, + page: Optional[int] = None, + page_size: Optional[int] = None, + ): + path = "/v3/contactdb/lists/{list_id}/recipients" + path = path.format( + list_id=list_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_reserved_field.py b/sendgrid/rest/api/lmc_contactdb/v3/list_reserved_field.py new file mode 100644 index 00000000..a2cbae21 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_reserved_field.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListReservedField: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/reserved_fields" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_search_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/list_search_recipient.py new file mode 100644 index 00000000..7aa4019f --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_search_recipient.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSearchRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + field_name: Optional[str] = None, + ): + path = "/v3/contactdb/recipients/search" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_segment.py b/sendgrid/rest/api/lmc_contactdb/v3/list_segment.py new file mode 100644 index 00000000..0506551a --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_segment.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/segments" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/list_status.py b/sendgrid/rest/api/lmc_contactdb/v3/list_status.py new file mode 100644 index 00000000..96d7f499 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/list_status.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListStatus: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/contactdb/status" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/__init__.py b/sendgrid/rest/api/lmc_contactdb/v3/models/__init__.py new file mode 100644 index 00000000..f47992fb --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/__init__.py @@ -0,0 +1,170 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.lmc_contactdb.v3.models.add_recipient_request_inner import ( + AddRecipientRequestInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.and_or import AndOr +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_custom_field import ( + ContactdbCustomField, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_custom_field_id2xx import ( + ContactdbCustomFieldId2xx, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_custom_field_id_value import ( + ContactdbCustomFieldIdValue, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_list2xx import ContactdbList2xx +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient200 import ( + ContactdbRecipient200, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient200_recipients_inner import ( + ContactdbRecipient200RecipientsInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient_count200 import ( + ContactdbRecipientCount200, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient_response201 import ( + ContactdbRecipientResponse201, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient_response201_errors_inner import ( + ContactdbRecipientResponse201ErrorsInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments import ( + ContactdbSegments, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments_conditions import ( + ContactdbSegmentsConditions, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments_id200 import ( + ContactdbSegmentsId200, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.create_a_list_request import ( + CreateAListRequest, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.create_custom_field_request import ( + CreateCustomFieldRequest, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.delete_contacts import DeleteContacts +from sendgrid.rest.api.lmc_contactdb.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.lmc_contactdb.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.get_recipient_list200_response import ( + GetRecipientList200Response, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_all_custom_fields_response import ( + ListAllCustomFieldsResponse, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_all_lists_response import ( + ListAllListsResponse, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_all_segments_response import ( + ListAllSegmentsResponse, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_recipients_from_contact_db_list200_response import ( + ListRecipientsFromContactDbList200Response, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_recipients_on_a_segment_response import ( + ListRecipientsOnASegmentResponse, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_recipients_response import ( + ListRecipientsResponse, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_reserved_field200_response import ( + ListReservedField200Response, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_reserved_field200_response_reserved_fields_inner import ( + ListReservedField200ResponseReservedFieldsInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_status200_response import ( + ListStatus200Response, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.list_status200_response_status_inner import ( + ListStatus200ResponseStatusInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.operator import Operator +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response import ( + SearchRecipient200Response, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response_recipients_inner import ( + SearchRecipient200ResponseRecipientsInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response_recipients_inner_custom_fields_inner import ( + SearchRecipient200ResponseRecipientsInnerCustomFieldsInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response_recipients_inner_custom_fields_inner_value import ( + SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient_request import ( + SearchRecipientRequest, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.type import Type +from sendgrid.rest.api.lmc_contactdb.v3.models.update_a_list_request import ( + UpdateAListRequest, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.update_contact_db_list200_response import ( + UpdateContactDbList200Response, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.update_recipient_request_inner import ( + UpdateRecipientRequestInner, +) +from sendgrid.rest.api.lmc_contactdb.v3.models.update_segment_request import ( + UpdateSegmentRequest, +) + +__all__ = [ + "AddRecipientRequestInner", + "AndOr", + "ContactdbCustomField", + "ContactdbCustomFieldId2xx", + "ContactdbCustomFieldIdValue", + "ContactdbList2xx", + "ContactdbRecipient200", + "ContactdbRecipient200RecipientsInner", + "ContactdbRecipientCount200", + "ContactdbRecipientResponse201", + "ContactdbRecipientResponse201ErrorsInner", + "ContactdbSegments", + "ContactdbSegmentsConditions", + "ContactdbSegmentsId200", + "CreateAListRequest", + "CreateCustomFieldRequest", + "DeleteContacts", + "ErrorResponse", + "ErrorResponseErrorsInner", + "GetRecipientList200Response", + "ListAllCustomFieldsResponse", + "ListAllListsResponse", + "ListAllSegmentsResponse", + "ListRecipientsFromContactDbList200Response", + "ListRecipientsOnASegmentResponse", + "ListRecipientsResponse", + "ListReservedField200Response", + "ListReservedField200ResponseReservedFieldsInner", + "ListStatus200Response", + "ListStatus200ResponseStatusInner", + "Operator", + "SearchRecipient200Response", + "SearchRecipient200ResponseRecipientsInner", + "SearchRecipient200ResponseRecipientsInnerCustomFieldsInner", + "SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue", + "SearchRecipientRequest", + "Type", + "UpdateAListRequest", + "UpdateContactDbList200Response", + "UpdateRecipientRequestInner", + "UpdateSegmentRequest", +] +# Testing code diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/add_recipient_request_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/add_recipient_request_inner.py new file mode 100644 index 00000000..8e502523 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/add_recipient_request_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddRecipientRequestInner: + def __init__( + self, + email: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + age: Optional[int] = None, + ): + self.email = email + self.first_name = first_name + self.last_name = last_name + self.age = age + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "first_name": self.first_name, + "last_name": self.last_name, + "age": self.age, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddRecipientRequestInner( + email=payload.get("email"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + age=payload.get("age"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/and_or.py b/sendgrid/rest/api/lmc_contactdb/v3/models/and_or.py new file mode 100644 index 00000000..1d8c2651 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/and_or.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AndOr(Enum): + AND = "and" + OR = "or" + EMPTY = "" diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field.py new file mode 100644 index 00000000..43f26b87 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.type import Type + + +class ContactdbCustomField: + def __init__(self, name: Optional[str] = None, type: Optional[Type] = None): + self.name = name + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "type": self.type}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbCustomField(name=payload.get("name"), type=payload.get("type")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id2xx.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id2xx.py new file mode 100644 index 00000000..4ca8281f --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id2xx.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.type import Type + + +class ContactdbCustomFieldId2xx: + def __init__( + self, + name: Optional[str] = None, + type: Optional[Type] = None, + id: Optional[float] = None, + ): + self.name = name + self.type = type + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "type": self.type, + "id": self.id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbCustomFieldId2xx( + name=payload.get("name"), type=payload.get("type"), id=payload.get("id") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id_value.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id_value.py new file mode 100644 index 00000000..f7b5ac5d --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_custom_field_id_value.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.type import Type + + +class ContactdbCustomFieldIdValue: + def __init__( + self, + name: Optional[str] = None, + type: Optional[Type] = None, + id: Optional[float] = None, + value: Optional[str] = None, + ): + self.name = name + self.type = type + self.id = id + self.value = value + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "type": self.type, + "id": self.id, + "value": self.value, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbCustomFieldIdValue( + name=payload.get("name"), + type=payload.get("type"), + id=payload.get("id"), + value=payload.get("value"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_list2xx.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_list2xx.py new file mode 100644 index 00000000..6c342bad --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_list2xx.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactdbList2xx: + def __init__( + self, + id: Optional[int] = None, + name: Optional[str] = None, + recipient_count: Optional[int] = None, + ): + self.id = id + self.name = name + self.recipient_count = recipient_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "recipient_count": self.recipient_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbList2xx( + id=payload.get("id"), + name=payload.get("name"), + recipient_count=payload.get("recipient_count"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200.py new file mode 100644 index 00000000..79378276 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient200_recipients_inner import ( + ContactdbRecipient200RecipientsInner, +) + + +class ContactdbRecipient200: + def __init__( + self, recipients: Optional[List[ContactdbRecipient200RecipientsInner]] = None + ): + self.recipients = recipients + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipients": self.recipients}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbRecipient200(recipients=payload.get("recipients")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200_recipients_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200_recipients_inner.py new file mode 100644 index 00000000..d6d284b0 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient200_recipients_inner.py @@ -0,0 +1,68 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_custom_field_id_value import ( + ContactdbCustomFieldIdValue, +) + + +class ContactdbRecipient200RecipientsInner: + def __init__( + self, + id: Optional[str] = None, + created_at: Optional[float] = None, + custom_fields: Optional[List[ContactdbCustomFieldIdValue]] = None, + email: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + last_clicked: Optional[float] = None, + last_emailed: Optional[float] = None, + last_opened: Optional[float] = None, + updated_at: Optional[float] = None, + ): + self.id = id + self.created_at = created_at + self.custom_fields = custom_fields + self.email = email + self.first_name = first_name + self.last_name = last_name + self.last_clicked = last_clicked + self.last_emailed = last_emailed + self.last_opened = last_opened + self.updated_at = updated_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "created_at": self.created_at, + "custom_fields": self.custom_fields, + "email": self.email, + "first_name": self.first_name, + "last_name": self.last_name, + "last_clicked": self.last_clicked, + "last_emailed": self.last_emailed, + "last_opened": self.last_opened, + "updated_at": self.updated_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbRecipient200RecipientsInner( + id=payload.get("id"), + created_at=payload.get("created_at"), + custom_fields=payload.get("custom_fields"), + email=payload.get("email"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + last_clicked=payload.get("last_clicked"), + last_emailed=payload.get("last_emailed"), + last_opened=payload.get("last_opened"), + updated_at=payload.get("updated_at"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_count200.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_count200.py new file mode 100644 index 00000000..fe20e309 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_count200.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactdbRecipientCount200: + def __init__(self, recipient_count: Optional[float] = None): + self.recipient_count = recipient_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipient_count": self.recipient_count}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbRecipientCount200( + recipient_count=payload.get("recipient_count") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201.py new file mode 100644 index 00000000..bd842632 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201.py @@ -0,0 +1,52 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient_response201_errors_inner import ( + ContactdbRecipientResponse201ErrorsInner, +) + + +class ContactdbRecipientResponse201: + def __init__( + self, + error_count: Optional[float] = None, + error_indices: Optional[List[float]] = None, + new_count: Optional[float] = None, + persisted_recipients: Optional[List[str]] = None, + updated_count: Optional[float] = None, + errors: Optional[List[ContactdbRecipientResponse201ErrorsInner]] = None, + ): + self.error_count = error_count + self.error_indices = error_indices + self.new_count = new_count + self.persisted_recipients = persisted_recipients + self.updated_count = updated_count + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "error_count": self.error_count, + "error_indices": self.error_indices, + "new_count": self.new_count, + "persisted_recipients": self.persisted_recipients, + "updated_count": self.updated_count, + "errors": self.errors, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbRecipientResponse201( + error_count=payload.get("error_count"), + error_indices=payload.get("error_indices"), + new_count=payload.get("new_count"), + persisted_recipients=payload.get("persisted_recipients"), + updated_count=payload.get("updated_count"), + errors=payload.get("errors"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201_errors_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201_errors_inner.py new file mode 100644 index 00000000..582d3a84 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_recipient_response201_errors_inner.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactdbRecipientResponse201ErrorsInner: + def __init__( + self, message: Optional[str] = None, error_indices: Optional[List[float]] = None + ): + self.message = message + self.error_indices = error_indices + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "error_indices": self.error_indices, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbRecipientResponse201ErrorsInner( + message=payload.get("message"), error_indices=payload.get("error_indices") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments.py new file mode 100644 index 00000000..23b980cb --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments.py @@ -0,0 +1,44 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments_conditions import ( + ContactdbSegmentsConditions, +) + + +class ContactdbSegments: + def __init__( + self, + name: Optional[str] = None, + list_id: Optional[int] = None, + conditions: Optional[List[ContactdbSegmentsConditions]] = None, + recipient_count: Optional[float] = None, + ): + self.name = name + self.list_id = list_id + self.conditions = conditions + self.recipient_count = recipient_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "list_id": self.list_id, + "conditions": self.conditions, + "recipient_count": self.recipient_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbSegments( + name=payload.get("name"), + list_id=payload.get("list_id"), + conditions=payload.get("conditions"), + recipient_count=payload.get("recipient_count"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_conditions.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_conditions.py new file mode 100644 index 00000000..37ef070c --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_conditions.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.and_or import AndOr +from sendgrid.rest.api.lmc_contactdb.v3.models.operator import Operator + + +class ContactdbSegmentsConditions: + def __init__( + self, + field: Optional[str] = None, + value: Optional[str] = None, + operator: Optional[Operator] = None, + and_or: Optional[AndOr] = None, + ): + self.field = field + self.value = value + self.operator = operator + self.and_or = and_or + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "field": self.field, + "value": self.value, + "operator": self.operator, + "and_or": self.and_or, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbSegmentsConditions( + field=payload.get("field"), + value=payload.get("value"), + operator=payload.get("operator"), + and_or=payload.get("and_or"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_id200.py b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_id200.py new file mode 100644 index 00000000..6c34fa7b --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/contactdb_segments_id200.py @@ -0,0 +1,48 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments_conditions import ( + ContactdbSegmentsConditions, +) + + +class ContactdbSegmentsId200: + def __init__( + self, + id: Optional[float] = None, + name: Optional[str] = None, + list_id: Optional[int] = None, + conditions: Optional[List[ContactdbSegmentsConditions]] = None, + recipient_count: Optional[float] = None, + ): + self.id = id + self.name = name + self.list_id = list_id + self.conditions = conditions + self.recipient_count = recipient_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "list_id": self.list_id, + "conditions": self.conditions, + "recipient_count": self.recipient_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactdbSegmentsId200( + id=payload.get("id"), + name=payload.get("name"), + list_id=payload.get("list_id"), + conditions=payload.get("conditions"), + recipient_count=payload.get("recipient_count"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/create_a_list_request.py b/sendgrid/rest/api/lmc_contactdb/v3/models/create_a_list_request.py new file mode 100644 index 00000000..313a984b --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/create_a_list_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateAListRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateAListRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/create_custom_field_request.py b/sendgrid/rest/api/lmc_contactdb/v3/models/create_custom_field_request.py new file mode 100644 index 00000000..148d0890 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/create_custom_field_request.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateCustomFieldRequest: + def __init__(self, name: Optional[str] = None, type: Optional[str] = None): + self.name = name + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "type": self.type}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateCustomFieldRequest( + name=payload.get("name"), type=payload.get("type") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/delete_contacts.py b/sendgrid/rest/api/lmc_contactdb/v3/models/delete_contacts.py new file mode 100644 index 00000000..f412b211 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/delete_contacts.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class DeleteContacts(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/error_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/error_response.py new file mode 100644 index 00000000..d87370ef --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/get_recipient_list200_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/get_recipient_list200_response.py new file mode 100644 index 00000000..b10f666d --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/get_recipient_list200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_list2xx import ContactdbList2xx + + +class GetRecipientList200Response: + def __init__(self, lists: Optional[List[ContactdbList2xx]] = None): + self.lists = lists + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"lists": self.lists}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetRecipientList200Response(lists=payload.get("lists")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_custom_fields_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_custom_fields_response.py new file mode 100644 index 00000000..b6d5f170 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_custom_fields_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_custom_field_id2xx import ( + ContactdbCustomFieldId2xx, +) + + +class ListAllCustomFieldsResponse: + def __init__(self, custom_fields: Optional[List[ContactdbCustomFieldId2xx]] = None): + self.custom_fields = custom_fields + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"custom_fields": self.custom_fields}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllCustomFieldsResponse(custom_fields=payload.get("custom_fields")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_lists_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_lists_response.py new file mode 100644 index 00000000..6fefa54e --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_lists_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_list2xx import ContactdbList2xx + + +class ListAllListsResponse: + def __init__(self, lists: Optional[List[ContactdbList2xx]] = None): + self.lists = lists + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"lists": self.lists}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllListsResponse(lists=payload.get("lists")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_segments_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_segments_response.py new file mode 100644 index 00000000..e7421572 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_all_segments_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments import ( + ContactdbSegments, +) + + +class ListAllSegmentsResponse: + def __init__(self, segments: Optional[List[ContactdbSegments]] = None): + self.segments = segments + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"segments": self.segments}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAllSegmentsResponse(segments=payload.get("segments")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_from_contact_db_list200_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_from_contact_db_list200_response.py new file mode 100644 index 00000000..9e93466c --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_from_contact_db_list200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient200 import ( + ContactdbRecipient200, +) + + +class ListRecipientsFromContactDbList200Response: + def __init__(self, recipients: Optional[List[ContactdbRecipient200]] = None): + self.recipients = recipients + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipients": self.recipients}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListRecipientsFromContactDbList200Response( + recipients=payload.get("recipients") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_on_a_segment_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_on_a_segment_response.py new file mode 100644 index 00000000..71c3d21b --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_on_a_segment_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_recipient200 import ( + ContactdbRecipient200, +) + + +class ListRecipientsOnASegmentResponse: + def __init__(self, recipients: Optional[List[ContactdbRecipient200]] = None): + self.recipients = recipients + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipients": self.recipients}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListRecipientsOnASegmentResponse(recipients=payload.get("recipients")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_response.py new file mode 100644 index 00000000..5327ca49 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_recipients_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListRecipientsResponse: + def __init__(self, recipients: Optional[List[object]] = None): + self.recipients = recipients + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipients": self.recipients}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListRecipientsResponse(recipients=payload.get("recipients")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response.py new file mode 100644 index 00000000..2dcbc0a2 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.list_reserved_field200_response_reserved_fields_inner import ( + ListReservedField200ResponseReservedFieldsInner, +) + + +class ListReservedField200Response: + def __init__( + self, + reserved_fields: Optional[ + List[ListReservedField200ResponseReservedFieldsInner] + ] = None, + ): + self.reserved_fields = reserved_fields + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"reserved_fields": self.reserved_fields}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListReservedField200Response( + reserved_fields=payload.get("reserved_fields") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response_reserved_fields_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response_reserved_fields_inner.py new file mode 100644 index 00000000..c41573b2 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_reserved_field200_response_reserved_fields_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListReservedField200ResponseReservedFieldsInner: + def __init__(self, name: Optional[str] = None, type: Optional[str] = None): + self.name = name + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "type": self.type}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListReservedField200ResponseReservedFieldsInner( + name=payload.get("name"), type=payload.get("type") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response.py new file mode 100644 index 00000000..a06582cd --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.list_status200_response_status_inner import ( + ListStatus200ResponseStatusInner, +) + + +class ListStatus200Response: + def __init__(self, status: Optional[List[ListStatus200ResponseStatusInner]] = None): + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListStatus200Response(status=payload.get("status")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response_status_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response_status_inner.py new file mode 100644 index 00000000..d14c4905 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/list_status200_response_status_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListStatus200ResponseStatusInner: + def __init__(self, id: Optional[str] = None, value: Optional[str] = None): + self.id = id + self.value = value + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"id": self.id, "value": self.value}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListStatus200ResponseStatusInner( + id=payload.get("id"), value=payload.get("value") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/operator.py b/sendgrid/rest/api/lmc_contactdb/v3/models/operator.py new file mode 100644 index 00000000..ad755a51 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/operator.py @@ -0,0 +1,10 @@ +from enum import Enum +from enum import Enum + + +class Operator(Enum): + EQ = "eq" + NE = "ne" + LT = "lt" + GT = "gt" + CONTAINS = "contains" diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response.py new file mode 100644 index 00000000..6ed78b49 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response_recipients_inner import ( + SearchRecipient200ResponseRecipientsInner, +) + + +class SearchRecipient200Response: + def __init__( + self, + recipients: Optional[List[SearchRecipient200ResponseRecipientsInner]] = None, + recipient_count: Optional[int] = None, + ): + self.recipients = recipients + self.recipient_count = recipient_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "recipients": self.recipients, + "recipient_count": self.recipient_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchRecipient200Response( + recipients=payload.get("recipients"), + recipient_count=payload.get("recipient_count"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner.py new file mode 100644 index 00000000..d42ee459 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner.py @@ -0,0 +1,66 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response_recipients_inner_custom_fields_inner import ( + SearchRecipient200ResponseRecipientsInnerCustomFieldsInner, +) + + +class SearchRecipient200ResponseRecipientsInner: + def __init__( + self, + created_at: Optional[int] = None, + email: Optional[str] = None, + id: Optional[str] = None, + last_emailed: Optional[int] = None, + last_clicked: Optional[int] = None, + last_opened: Optional[int] = None, + custom_fields: Optional[ + List[SearchRecipient200ResponseRecipientsInnerCustomFieldsInner] + ] = None, + updated_at: Optional[int] = None, + first_name: Optional[str] = None, + ): + self.created_at = created_at + self.email = email + self.id = id + self.last_emailed = last_emailed + self.last_clicked = last_clicked + self.last_opened = last_opened + self.custom_fields = custom_fields + self.updated_at = updated_at + self.first_name = first_name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created_at": self.created_at, + "email": self.email, + "id": self.id, + "last_emailed": self.last_emailed, + "last_clicked": self.last_clicked, + "last_opened": self.last_opened, + "custom_fields": self.custom_fields, + "updated_at": self.updated_at, + "first_name": self.first_name, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchRecipient200ResponseRecipientsInner( + created_at=payload.get("created_at"), + email=payload.get("email"), + id=payload.get("id"), + last_emailed=payload.get("last_emailed"), + last_clicked=payload.get("last_clicked"), + last_opened=payload.get("last_opened"), + custom_fields=payload.get("custom_fields"), + updated_at=payload.get("updated_at"), + first_name=payload.get("first_name"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner.py new file mode 100644 index 00000000..e28926e4 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient200_response_recipients_inner_custom_fields_inner_value import ( + SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue, +) + + +class SearchRecipient200ResponseRecipientsInnerCustomFieldsInner: + def __init__( + self, + id: Optional[int] = None, + name: Optional[str] = None, + value: Optional[ + SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue + ] = None, + type: Optional[str] = None, + ): + self.id = id + self.name = name + self.value = value + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "value": self.value, + "type": self.type, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchRecipient200ResponseRecipientsInnerCustomFieldsInner( + id=payload.get("id"), + name=payload.get("name"), + value=payload.get("value"), + type=payload.get("type"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner_value.py b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner_value.py new file mode 100644 index 00000000..b2f9e9ae --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient200_response_recipients_inner_custom_fields_inner_value.py @@ -0,0 +1,26 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue: + def __init__( + self, + ): + + def to_dict(self): + return {key: to_serializable(value) + for key, value in { + }.items() if value is not None} + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchRecipient200ResponseRecipientsInnerCustomFieldsInnerValue( + ) + diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient_request.py b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient_request.py new file mode 100644 index 00000000..68311eab --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/search_recipient_request.py @@ -0,0 +1,35 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments_conditions import ( + ContactdbSegmentsConditions, +) + + +class SearchRecipientRequest: + def __init__( + self, + list_id: Optional[int] = None, + conditions: Optional[List[ContactdbSegmentsConditions]] = None, + ): + self.list_id = list_id + self.conditions = conditions + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "list_id": self.list_id, + "conditions": self.conditions, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchRecipientRequest( + list_id=payload.get("list_id"), conditions=payload.get("conditions") + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/type.py b/sendgrid/rest/api/lmc_contactdb/v3/models/type.py new file mode 100644 index 00000000..7de12d96 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/type.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + DATE = "date" + TEXT = "text" + NUMBER = "number" diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/update_a_list_request.py b/sendgrid/rest/api/lmc_contactdb/v3/models/update_a_list_request.py new file mode 100644 index 00000000..17c0dd41 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/update_a_list_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAListRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAListRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/update_contact_db_list200_response.py b/sendgrid/rest/api/lmc_contactdb/v3/models/update_contact_db_list200_response.py new file mode 100644 index 00000000..a1ea57ea --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/update_contact_db_list200_response.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateContactDbList200Response: + def __init__( + self, + id: Optional[int] = None, + name: Optional[str] = None, + recipient_count: Optional[int] = None, + ): + self.id = id + self.name = name + self.recipient_count = recipient_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "recipient_count": self.recipient_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateContactDbList200Response( + id=payload.get("id"), + name=payload.get("name"), + recipient_count=payload.get("recipient_count"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/update_recipient_request_inner.py b/sendgrid/rest/api/lmc_contactdb/v3/models/update_recipient_request_inner.py new file mode 100644 index 00000000..54112eb4 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/update_recipient_request_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateRecipientRequestInner: + def __init__( + self, + email: Optional[str] = None, + last_name: Optional[str] = None, + first_name: Optional[str] = None, + ): + self.email = email + self.last_name = last_name + self.first_name = first_name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "last_name": self.last_name, + "first_name": self.first_name, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateRecipientRequestInner( + email=payload.get("email"), + last_name=payload.get("last_name"), + first_name=payload.get("first_name"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/models/update_segment_request.py b/sendgrid/rest/api/lmc_contactdb/v3/models/update_segment_request.py new file mode 100644 index 00000000..3c7ce060 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/models/update_segment_request.py @@ -0,0 +1,40 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_contactdb.v3.models.contactdb_segments_conditions import ( + ContactdbSegmentsConditions, +) + + +class UpdateSegmentRequest: + def __init__( + self, + name: Optional[str] = None, + list_id: Optional[float] = None, + conditions: Optional[List[ContactdbSegmentsConditions]] = None, + ): + self.name = name + self.list_id = list_id + self.conditions = conditions + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "list_id": self.list_id, + "conditions": self.conditions, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSegmentRequest( + name=payload.get("name"), + list_id=payload.get("list_id"), + conditions=payload.get("conditions"), + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/search_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/search_recipient.py new file mode 100644 index 00000000..9f2e2022 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/search_recipient.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.search_recipient_request import ( + SearchRecipientRequest, +) + + +class SearchRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + search_recipient_request: Optional[SearchRecipientRequest] = None, + ): + path = "/v3/contactdb/recipients/search" + + data = None + if search_recipient_request: + data = search_recipient_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/update_contact_db_list.py b/sendgrid/rest/api/lmc_contactdb/v3/update_contact_db_list.py new file mode 100644 index 00000000..5bd5e25b --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/update_contact_db_list.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.update_a_list_request import ( + UpdateAListRequest, +) + + +class UpdateContactDbList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_id: int, + on_behalf_of: Optional[str] = None, + update_a_list_request: Optional[UpdateAListRequest] = None, + ): + path = "/v3/contactdb/lists/{list_id}" + path = path.format( + list_id=list_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_a_list_request: + data = update_a_list_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/update_recipient.py b/sendgrid/rest/api/lmc_contactdb/v3/update_recipient.py new file mode 100644 index 00000000..3bd1d3b2 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/update_recipient.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.update_recipient_request_inner import ( + UpdateRecipientRequestInner, +) + + +class UpdateRecipient: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_recipient_request_inner: Optional[ + List[UpdateRecipientRequestInner] + ] = None, + ): + path = "/v3/contactdb/recipients" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_recipient_request_inner: + data = update_recipient_request_inner.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_contactdb/v3/update_segment.py b/sendgrid/rest/api/lmc_contactdb/v3/update_segment.py new file mode 100644 index 00000000..bc291802 --- /dev/null +++ b/sendgrid/rest/api/lmc_contactdb/v3/update_segment.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Contacts API + The Twilio SendGrid Legacy Marketing Campaigns Contacts API allows you to manage your marketing contacts programmatically. This API is operational, but we recommend using the current version of Marketing Campaigns' [Contacts API](https://docs.sendgrid.com/api-reference/contacts/), [Lists API](https://docs.sendgrid.com/api-reference/lists/), and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) to manage your contacts. See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_contactdb.v3.models.update_segment_request import ( + UpdateSegmentRequest, +) + + +class UpdateSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: int, + on_behalf_of: Optional[str] = None, + update_segment_request: Optional[UpdateSegmentRequest] = None, + ): + path = "/v3/contactdb/segments/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_segment_request: + data = update_segment_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/__init__.py b/sendgrid/rest/api/lmc_senders/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/lmc_senders/v3/create_sender.py b/sendgrid/rest/api/lmc_senders/v3/create_sender.py new file mode 100644 index 00000000..e3e909a8 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/create_sender.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_senders.v3.models.create_sender_request import ( + CreateSenderRequest, +) + + +class CreateSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_sender_request: Optional[CreateSenderRequest] = None, + ): + path = "/v3/senders" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_sender_request: + data = create_sender_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/delete_sender.py b/sendgrid/rest/api/lmc_senders/v3/delete_sender.py new file mode 100644 index 00000000..f92da99d --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/delete_sender.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + sender_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/senders/{sender_id}" + path = path.format( + sender_id=sender_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/get_sender.py b/sendgrid/rest/api/lmc_senders/v3/get_sender.py new file mode 100644 index 00000000..a86106aa --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/get_sender.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + sender_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/senders/{sender_id}" + path = path.format( + sender_id=sender_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/list_sender.py b/sendgrid/rest/api/lmc_senders/v3/list_sender.py new file mode 100644 index 00000000..b0500c97 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/list_sender.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/senders" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/__init__.py b/sendgrid/rest/api/lmc_senders/v3/models/__init__.py new file mode 100644 index 00000000..d8123f34 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/__init__.py @@ -0,0 +1,46 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.lmc_senders.v3.models.create_sender400_response import ( + CreateSender400Response, +) +from sendgrid.rest.api.lmc_senders.v3.models.create_sender400_response_errors_inner import ( + CreateSender400ResponseErrorsInner, +) +from sendgrid.rest.api.lmc_senders.v3.models.create_sender_request import ( + CreateSenderRequest, +) +from sendgrid.rest.api.lmc_senders.v3.models.list_sender200_response import ( + ListSender200Response, +) +from sendgrid.rest.api.lmc_senders.v3.models.sender_id import SenderId +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request import SenderIdRequest +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request_from import ( + SenderIdRequestFrom, +) +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request_reply_to import ( + SenderIdRequestReplyTo, +) + +__all__ = [ + "CreateSender400Response", + "CreateSender400ResponseErrorsInner", + "CreateSenderRequest", + "ListSender200Response", + "SenderId", + "SenderIdRequest", + "SenderIdRequestFrom", + "SenderIdRequestReplyTo", +] +# Testing code diff --git a/sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response.py b/sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response.py new file mode 100644 index 00000000..6de1783d --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_senders.v3.models.create_sender400_response_errors_inner import ( + CreateSender400ResponseErrorsInner, +) + + +class CreateSender400Response: + def __init__( + self, errors: Optional[List[CreateSender400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSender400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response_errors_inner.py b/sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response_errors_inner.py new file mode 100644 index 00000000..eda8322a --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/create_sender400_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateSender400ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSender400ResponseErrorsInner( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/create_sender_request.py b/sendgrid/rest/api/lmc_senders/v3/models/create_sender_request.py new file mode 100644 index 00000000..7031de47 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/create_sender_request.py @@ -0,0 +1,61 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateSenderRequest: + def __init__( + self, + nickname: Optional[str] = None, + var_from: Optional[object] = None, + reply_to: Optional[object] = None, + address: Optional[str] = None, + address_2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.nickname = nickname + self.var_from = var_from + self.reply_to = reply_to + self.address = address + self.address_2 = address_2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "nickname": self.nickname, + "from": self.var_from, + "reply_to": self.reply_to, + "address": self.address, + "address_2": self.address_2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSenderRequest( + nickname=payload.get("nickname"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + address=payload.get("address"), + address_2=payload.get("address_2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/list_sender200_response.py b/sendgrid/rest/api/lmc_senders/v3/models/list_sender200_response.py new file mode 100644 index 00000000..b84c2c1a --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/list_sender200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_senders.v3.models.sender_id import SenderId + + +class ListSender200Response: + def __init__(self, result: Optional[List[SenderId]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSender200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/sender_id.py b/sendgrid/rest/api/lmc_senders/v3/models/sender_id.py new file mode 100644 index 00000000..af6acf31 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/sender_id.py @@ -0,0 +1,87 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request_from import ( + SenderIdRequestFrom, +) +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request_reply_to import ( + SenderIdRequestReplyTo, +) + + +class SenderId: + def __init__( + self, + nickname: Optional[str] = None, + var_from: Optional[SenderIdRequestFrom] = None, + reply_to: Optional[SenderIdRequestReplyTo] = None, + address: Optional[str] = None, + address_2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + id: Optional[int] = None, + verified: Optional[bool] = None, + updated_at: Optional[int] = None, + created_at: Optional[int] = None, + locked: Optional[bool] = None, + ): + self.nickname = nickname + self.var_from = var_from + self.reply_to = reply_to + self.address = address + self.address_2 = address_2 + self.city = city + self.state = state + self.zip = zip + self.country = country + self.id = id + self.verified = verified + self.updated_at = updated_at + self.created_at = created_at + self.locked = locked + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "nickname": self.nickname, + "from": self.var_from, + "reply_to": self.reply_to, + "address": self.address, + "address_2": self.address_2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + "id": self.id, + "verified": self.verified, + "updated_at": self.updated_at, + "created_at": self.created_at, + "locked": self.locked, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderId( + nickname=payload.get("nickname"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + address=payload.get("address"), + address_2=payload.get("address_2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + id=payload.get("id"), + verified=payload.get("verified"), + updated_at=payload.get("updated_at"), + created_at=payload.get("created_at"), + locked=payload.get("locked"), + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request.py b/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request.py new file mode 100644 index 00000000..87271ba0 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request.py @@ -0,0 +1,67 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request_from import ( + SenderIdRequestFrom, +) +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request_reply_to import ( + SenderIdRequestReplyTo, +) + + +class SenderIdRequest: + def __init__( + self, + nickname: Optional[str] = None, + var_from: Optional[SenderIdRequestFrom] = None, + reply_to: Optional[SenderIdRequestReplyTo] = None, + address: Optional[str] = None, + address_2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.nickname = nickname + self.var_from = var_from + self.reply_to = reply_to + self.address = address + self.address_2 = address_2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "nickname": self.nickname, + "from": self.var_from, + "reply_to": self.reply_to, + "address": self.address, + "address_2": self.address_2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderIdRequest( + nickname=payload.get("nickname"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + address=payload.get("address"), + address_2=payload.get("address_2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_from.py b/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_from.py new file mode 100644 index 00000000..2423f9e9 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_from.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SenderIdRequestFrom: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderIdRequestFrom(email=payload.get("email"), name=payload.get("name")) diff --git a/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_reply_to.py b/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_reply_to.py new file mode 100644 index 00000000..541d552f --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/models/sender_id_request_reply_to.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SenderIdRequestReplyTo: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderIdRequestReplyTo( + email=payload.get("email"), name=payload.get("name") + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/reset_sender_verification.py b/sendgrid/rest/api/lmc_senders/v3/reset_sender_verification.py new file mode 100644 index 00000000..79c51b7b --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/reset_sender_verification.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ResetSenderVerification: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + sender_id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/senders/{sender_id}/resend_verification" + path = path.format( + sender_id=sender_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/lmc_senders/v3/update_sender.py b/sendgrid/rest/api/lmc_senders/v3/update_sender.py new file mode 100644 index 00000000..f7d90b81 --- /dev/null +++ b/sendgrid/rest/api/lmc_senders/v3/update_sender.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Legacy Marketing Campaigns Sender Identities API + The Twilio SendGrid Legacy Marketing Campaigns Sender Identites API allows you to manage the email addresses used to send your marketing email. This API is operational, but we recommend using the current version of Marketing Campaigns to manage your [senders](https://docs.sendgrid.com/api-reference/senders/). See [**Migrating from Legacy Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/migrating-from-legacy-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.lmc_senders.v3.models.sender_id_request import SenderIdRequest + + +class UpdateSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + sender_id: int, + on_behalf_of: Optional[str] = None, + sender_id_request: Optional[SenderIdRequest] = None, + ): + path = "/v3/senders/{sender_id}" + path = path.format( + sender_id=sender_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if sender_id_request: + data = sender_id_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail/v3/__init__.py b/sendgrid/rest/api/mail/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mail/v3/create_mail_batch.py b/sendgrid/rest/api/mail/v3/create_mail_batch.py new file mode 100644 index 00000000..29968326 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/create_mail_batch.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail API + The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class CreateMailBatch: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail/batch" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail/v3/get_mail_batch.py b/sendgrid/rest/api/mail/v3/get_mail_batch.py new file mode 100644 index 00000000..04173c54 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/get_mail_batch.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail API + The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetMailBatch: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail/batch/{batch_id}" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail/v3/models/__init__.py b/sendgrid/rest/api/mail/v3/models/__init__.py new file mode 100644 index 00000000..f0adea87 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/__init__.py @@ -0,0 +1,98 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail API + The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mail.v3.models.content_encoding import ContentEncoding +from sendgrid.rest.api.mail.v3.models.disposition import Disposition +from sendgrid.rest.api.mail.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.mail.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.mail.v3.models.mail_batch_response import MailBatchResponse +from sendgrid.rest.api.mail.v3.models.mail_from import MailFrom +from sendgrid.rest.api.mail.v3.models.mail_to import MailTo +from sendgrid.rest.api.mail.v3.models.send_mail_request import SendMailRequest +from sendgrid.rest.api.mail.v3.models.send_mail_request_asm import SendMailRequestAsm +from sendgrid.rest.api.mail.v3.models.send_mail_request_attachments_inner import ( + SendMailRequestAttachmentsInner, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_content_inner import ( + SendMailRequestContentInner, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings import ( + SendMailRequestMailSettings, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_bounce_management import ( + SendMailRequestMailSettingsBypassBounceManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_list_management import ( + SendMailRequestMailSettingsBypassListManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_spam_management import ( + SendMailRequestMailSettingsBypassSpamManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_unsubscribe_management import ( + SendMailRequestMailSettingsBypassUnsubscribeManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_footer import ( + SendMailRequestMailSettingsFooter, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_sandbox_mode import ( + SendMailRequestMailSettingsSandboxMode, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_personalizations_inner import ( + SendMailRequestPersonalizationsInner, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings import ( + SendMailRequestTrackingSettings, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_click_tracking import ( + SendMailRequestTrackingSettingsClickTracking, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_ganalytics import ( + SendMailRequestTrackingSettingsGanalytics, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_open_tracking import ( + SendMailRequestTrackingSettingsOpenTracking, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_subscription_tracking import ( + SendMailRequestTrackingSettingsSubscriptionTracking, +) + +__all__ = [ + "ContentEncoding", + "Disposition", + "ErrorResponse", + "ErrorResponseErrorsInner", + "MailBatchResponse", + "MailFrom", + "MailTo", + "SendMailRequest", + "SendMailRequestAsm", + "SendMailRequestAttachmentsInner", + "SendMailRequestContentInner", + "SendMailRequestMailSettings", + "SendMailRequestMailSettingsBypassBounceManagement", + "SendMailRequestMailSettingsBypassListManagement", + "SendMailRequestMailSettingsBypassSpamManagement", + "SendMailRequestMailSettingsBypassUnsubscribeManagement", + "SendMailRequestMailSettingsFooter", + "SendMailRequestMailSettingsSandboxMode", + "SendMailRequestPersonalizationsInner", + "SendMailRequestTrackingSettings", + "SendMailRequestTrackingSettingsClickTracking", + "SendMailRequestTrackingSettingsGanalytics", + "SendMailRequestTrackingSettingsOpenTracking", + "SendMailRequestTrackingSettingsSubscriptionTracking", +] +# Testing code diff --git a/sendgrid/rest/api/mail/v3/models/content_encoding.py b/sendgrid/rest/api/mail/v3/models/content_encoding.py new file mode 100644 index 00000000..effc5307 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/content_encoding.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class ContentEncoding(Enum): + GZIP = "gzip" diff --git a/sendgrid/rest/api/mail/v3/models/disposition.py b/sendgrid/rest/api/mail/v3/models/disposition.py new file mode 100644 index 00000000..b68290a6 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/disposition.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Disposition(Enum): + INLINE = "inline" + ATTACHMENT = "attachment" diff --git a/sendgrid/rest/api/mail/v3/models/error_response.py b/sendgrid/rest/api/mail/v3/models/error_response.py new file mode 100644 index 00000000..d4e780fe --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/mail/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/mail/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/mail_batch_response.py b/sendgrid/rest/api/mail/v3/models/mail_batch_response.py new file mode 100644 index 00000000..e35bbcf4 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/mail_batch_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailBatchResponse: + def __init__(self, batch_id: Optional[str] = None): + self.batch_id = batch_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"batch_id": self.batch_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailBatchResponse(batch_id=payload.get("batch_id")) diff --git a/sendgrid/rest/api/mail/v3/models/mail_from.py b/sendgrid/rest/api/mail/v3/models/mail_from.py new file mode 100644 index 00000000..a487a8d2 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/mail_from.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailFrom: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailFrom(email=payload.get("email"), name=payload.get("name")) diff --git a/sendgrid/rest/api/mail/v3/models/mail_to.py b/sendgrid/rest/api/mail/v3/models/mail_to.py new file mode 100644 index 00000000..9f8e83bc --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/mail_to.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailTo: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailTo(email=payload.get("email"), name=payload.get("name")) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request.py b/sendgrid/rest/api/mail/v3/models/send_mail_request.py new file mode 100644 index 00000000..8dcf0ad7 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request.py @@ -0,0 +1,111 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail.v3.models.mail_from import MailFrom +from sendgrid.rest.api.mail.v3.models.mail_to import MailTo +from sendgrid.rest.api.mail.v3.models.send_mail_request_asm import SendMailRequestAsm +from sendgrid.rest.api.mail.v3.models.send_mail_request_attachments_inner import ( + SendMailRequestAttachmentsInner, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_content_inner import ( + SendMailRequestContentInner, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings import ( + SendMailRequestMailSettings, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_personalizations_inner import ( + SendMailRequestPersonalizationsInner, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings import ( + SendMailRequestTrackingSettings, +) + + +class SendMailRequest: + def __init__( + self, + personalizations: Optional[List[SendMailRequestPersonalizationsInner]] = None, + var_from: Optional[MailFrom] = None, + reply_to: Optional[MailTo] = None, + reply_to_list: Optional[List[MailTo]] = None, + subject: Optional[str] = None, + content: Optional[List[SendMailRequestContentInner]] = None, + attachments: Optional[List[SendMailRequestAttachmentsInner]] = None, + template_id: Optional[str] = None, + headers: Optional[object] = None, + categories: Optional[List[str]] = None, + custom_args: Optional[str] = None, + send_at: Optional[int] = None, + batch_id: Optional[str] = None, + asm: Optional[SendMailRequestAsm] = None, + ip_pool_name: Optional[str] = None, + mail_settings: Optional[SendMailRequestMailSettings] = None, + tracking_settings: Optional[SendMailRequestTrackingSettings] = None, + ): + self.personalizations = personalizations + self.var_from = var_from + self.reply_to = reply_to + self.reply_to_list = reply_to_list + self.subject = subject + self.content = content + self.attachments = attachments + self.template_id = template_id + self.headers = headers + self.categories = categories + self.custom_args = custom_args + self.send_at = send_at + self.batch_id = batch_id + self.asm = asm + self.ip_pool_name = ip_pool_name + self.mail_settings = mail_settings + self.tracking_settings = tracking_settings + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "personalizations": self.personalizations, + "from": self.var_from, + "reply_to": self.reply_to, + "reply_to_list": self.reply_to_list, + "subject": self.subject, + "content": self.content, + "attachments": self.attachments, + "template_id": self.template_id, + "headers": self.headers, + "categories": self.categories, + "custom_args": self.custom_args, + "send_at": self.send_at, + "batch_id": self.batch_id, + "asm": self.asm, + "ip_pool_name": self.ip_pool_name, + "mail_settings": self.mail_settings, + "tracking_settings": self.tracking_settings, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequest( + personalizations=payload.get("personalizations"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + reply_to_list=payload.get("reply_to_list"), + subject=payload.get("subject"), + content=payload.get("content"), + attachments=payload.get("attachments"), + template_id=payload.get("template_id"), + headers=payload.get("headers"), + categories=payload.get("categories"), + custom_args=payload.get("custom_args"), + send_at=payload.get("send_at"), + batch_id=payload.get("batch_id"), + asm=payload.get("asm"), + ip_pool_name=payload.get("ip_pool_name"), + mail_settings=payload.get("mail_settings"), + tracking_settings=payload.get("tracking_settings"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_asm.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_asm.py new file mode 100644 index 00000000..9ca34fe6 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_asm.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestAsm: + def __init__( + self, + group_id: Optional[int] = None, + groups_to_display: Optional[List[int]] = None, + ): + self.group_id = group_id + self.groups_to_display = groups_to_display + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "group_id": self.group_id, + "groups_to_display": self.groups_to_display, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestAsm( + group_id=payload.get("group_id"), + groups_to_display=payload.get("groups_to_display"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_attachments_inner.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_attachments_inner.py new file mode 100644 index 00000000..2142ca96 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_attachments_inner.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail.v3.models.disposition import Disposition + + +class SendMailRequestAttachmentsInner: + def __init__( + self, + content: Optional[str] = None, + type: Optional[str] = None, + filename: Optional[str] = None, + disposition: Optional[Disposition] = None, + content_id: Optional[str] = None, + ): + self.content = content + self.type = type + self.filename = filename + self.disposition = disposition + self.content_id = content_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "content": self.content, + "type": self.type, + "filename": self.filename, + "disposition": self.disposition, + "content_id": self.content_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestAttachmentsInner( + content=payload.get("content"), + type=payload.get("type"), + filename=payload.get("filename"), + disposition=payload.get("disposition"), + content_id=payload.get("content_id"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_content_inner.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_content_inner.py new file mode 100644 index 00000000..bc81a6c4 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_content_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestContentInner: + def __init__(self, type: Optional[str] = None, value: Optional[str] = None): + self.type = type + self.value = value + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"type": self.type, "value": self.value}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestContentInner( + type=payload.get("type"), value=payload.get("value") + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings.py new file mode 100644 index 00000000..66ba00fb --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings.py @@ -0,0 +1,75 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_bounce_management import ( + SendMailRequestMailSettingsBypassBounceManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_list_management import ( + SendMailRequestMailSettingsBypassListManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_spam_management import ( + SendMailRequestMailSettingsBypassSpamManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_bypass_unsubscribe_management import ( + SendMailRequestMailSettingsBypassUnsubscribeManagement, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_footer import ( + SendMailRequestMailSettingsFooter, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_mail_settings_sandbox_mode import ( + SendMailRequestMailSettingsSandboxMode, +) + + +class SendMailRequestMailSettings: + def __init__( + self, + bypass_list_management: Optional[ + SendMailRequestMailSettingsBypassListManagement + ] = None, + bypass_spam_management: Optional[ + SendMailRequestMailSettingsBypassSpamManagement + ] = None, + bypass_bounce_management: Optional[ + SendMailRequestMailSettingsBypassBounceManagement + ] = None, + bypass_unsubscribe_management: Optional[ + SendMailRequestMailSettingsBypassUnsubscribeManagement + ] = None, + footer: Optional[SendMailRequestMailSettingsFooter] = None, + sandbox_mode: Optional[SendMailRequestMailSettingsSandboxMode] = None, + ): + self.bypass_list_management = bypass_list_management + self.bypass_spam_management = bypass_spam_management + self.bypass_bounce_management = bypass_bounce_management + self.bypass_unsubscribe_management = bypass_unsubscribe_management + self.footer = footer + self.sandbox_mode = sandbox_mode + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "bypass_list_management": self.bypass_list_management, + "bypass_spam_management": self.bypass_spam_management, + "bypass_bounce_management": self.bypass_bounce_management, + "bypass_unsubscribe_management": self.bypass_unsubscribe_management, + "footer": self.footer, + "sandbox_mode": self.sandbox_mode, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettings( + bypass_list_management=payload.get("bypass_list_management"), + bypass_spam_management=payload.get("bypass_spam_management"), + bypass_bounce_management=payload.get("bypass_bounce_management"), + bypass_unsubscribe_management=payload.get("bypass_unsubscribe_management"), + footer=payload.get("footer"), + sandbox_mode=payload.get("sandbox_mode"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_bounce_management.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_bounce_management.py new file mode 100644 index 00000000..1e395e76 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_bounce_management.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestMailSettingsBypassBounceManagement: + def __init__(self, enable: Optional[bool] = None): + self.enable = enable + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enable": self.enable}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettingsBypassBounceManagement( + enable=payload.get("enable") + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_list_management.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_list_management.py new file mode 100644 index 00000000..76e457ba --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_list_management.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestMailSettingsBypassListManagement: + def __init__(self, enable: Optional[bool] = None): + self.enable = enable + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enable": self.enable}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettingsBypassListManagement( + enable=payload.get("enable") + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_spam_management.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_spam_management.py new file mode 100644 index 00000000..c2b2a7a2 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_spam_management.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestMailSettingsBypassSpamManagement: + def __init__(self, enable: Optional[bool] = None): + self.enable = enable + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enable": self.enable}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettingsBypassSpamManagement( + enable=payload.get("enable") + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_unsubscribe_management.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_unsubscribe_management.py new file mode 100644 index 00000000..a9395e44 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_bypass_unsubscribe_management.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestMailSettingsBypassUnsubscribeManagement: + def __init__(self, enable: Optional[bool] = None): + self.enable = enable + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enable": self.enable}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettingsBypassUnsubscribeManagement( + enable=payload.get("enable") + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_footer.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_footer.py new file mode 100644 index 00000000..7c5beb19 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_footer.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestMailSettingsFooter: + def __init__( + self, + enable: Optional[bool] = None, + text: Optional[str] = None, + html: Optional[str] = None, + ): + self.enable = enable + self.text = text + self.html = html + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enable": self.enable, + "text": self.text, + "html": self.html, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettingsFooter( + enable=payload.get("enable"), + text=payload.get("text"), + html=payload.get("html"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_sandbox_mode.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_sandbox_mode.py new file mode 100644 index 00000000..e1e390ef --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_mail_settings_sandbox_mode.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestMailSettingsSandboxMode: + def __init__(self, enable: Optional[bool] = None): + self.enable = enable + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enable": self.enable}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestMailSettingsSandboxMode(enable=payload.get("enable")) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_personalizations_inner.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_personalizations_inner.py new file mode 100644 index 00000000..212dec09 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_personalizations_inner.py @@ -0,0 +1,67 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail.v3.models.mail_from import MailFrom +from sendgrid.rest.api.mail.v3.models.mail_to import MailTo + + +class SendMailRequestPersonalizationsInner: + def __init__( + self, + var_from: Optional[MailFrom] = None, + to: Optional[List[MailTo]] = None, + cc: Optional[List[MailTo]] = None, + bcc: Optional[List[MailTo]] = None, + subject: Optional[str] = None, + headers: Optional[object] = None, + substitutions: Optional[Dict[str, str]] = None, + dynamic_template_data: Optional[object] = None, + custom_args: Optional[object] = None, + send_at: Optional[int] = None, + ): + self.var_from = var_from + self.to = to + self.cc = cc + self.bcc = bcc + self.subject = subject + self.headers = headers + self.substitutions = substitutions + self.dynamic_template_data = dynamic_template_data + self.custom_args = custom_args + self.send_at = send_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "from": self.var_from, + "to": self.to, + "cc": self.cc, + "bcc": self.bcc, + "subject": self.subject, + "headers": self.headers, + "substitutions": self.substitutions, + "dynamic_template_data": self.dynamic_template_data, + "custom_args": self.custom_args, + "send_at": self.send_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestPersonalizationsInner( + var_from=payload.get("from"), + to=payload.get("to"), + cc=payload.get("cc"), + bcc=payload.get("bcc"), + subject=payload.get("subject"), + headers=payload.get("headers"), + substitutions=payload.get("substitutions"), + dynamic_template_data=payload.get("dynamic_template_data"), + custom_args=payload.get("custom_args"), + send_at=payload.get("send_at"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings.py new file mode 100644 index 00000000..85ae5c59 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings.py @@ -0,0 +1,55 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_click_tracking import ( + SendMailRequestTrackingSettingsClickTracking, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_ganalytics import ( + SendMailRequestTrackingSettingsGanalytics, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_open_tracking import ( + SendMailRequestTrackingSettingsOpenTracking, +) +from sendgrid.rest.api.mail.v3.models.send_mail_request_tracking_settings_subscription_tracking import ( + SendMailRequestTrackingSettingsSubscriptionTracking, +) + + +class SendMailRequestTrackingSettings: + def __init__( + self, + click_tracking: Optional[SendMailRequestTrackingSettingsClickTracking] = None, + open_tracking: Optional[SendMailRequestTrackingSettingsOpenTracking] = None, + subscription_tracking: Optional[ + SendMailRequestTrackingSettingsSubscriptionTracking + ] = None, + ganalytics: Optional[SendMailRequestTrackingSettingsGanalytics] = None, + ): + self.click_tracking = click_tracking + self.open_tracking = open_tracking + self.subscription_tracking = subscription_tracking + self.ganalytics = ganalytics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "click_tracking": self.click_tracking, + "open_tracking": self.open_tracking, + "subscription_tracking": self.subscription_tracking, + "ganalytics": self.ganalytics, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestTrackingSettings( + click_tracking=payload.get("click_tracking"), + open_tracking=payload.get("open_tracking"), + subscription_tracking=payload.get("subscription_tracking"), + ganalytics=payload.get("ganalytics"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_click_tracking.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_click_tracking.py new file mode 100644 index 00000000..02e57388 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_click_tracking.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestTrackingSettingsClickTracking: + def __init__( + self, enable: Optional[bool] = None, enable_text: Optional[bool] = None + ): + self.enable = enable + self.enable_text = enable_text + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enable": self.enable, + "enable_text": self.enable_text, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestTrackingSettingsClickTracking( + enable=payload.get("enable"), enable_text=payload.get("enable_text") + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_ganalytics.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_ganalytics.py new file mode 100644 index 00000000..7cdf500a --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_ganalytics.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestTrackingSettingsGanalytics: + def __init__( + self, + enable: Optional[bool] = None, + utm_source: Optional[str] = None, + utm_medium: Optional[str] = None, + utm_term: Optional[str] = None, + utm_content: Optional[str] = None, + utm_campaign: Optional[str] = None, + ): + self.enable = enable + self.utm_source = utm_source + self.utm_medium = utm_medium + self.utm_term = utm_term + self.utm_content = utm_content + self.utm_campaign = utm_campaign + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enable": self.enable, + "utm_source": self.utm_source, + "utm_medium": self.utm_medium, + "utm_term": self.utm_term, + "utm_content": self.utm_content, + "utm_campaign": self.utm_campaign, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestTrackingSettingsGanalytics( + enable=payload.get("enable"), + utm_source=payload.get("utm_source"), + utm_medium=payload.get("utm_medium"), + utm_term=payload.get("utm_term"), + utm_content=payload.get("utm_content"), + utm_campaign=payload.get("utm_campaign"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_open_tracking.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_open_tracking.py new file mode 100644 index 00000000..282743a3 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_open_tracking.py @@ -0,0 +1,31 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestTrackingSettingsOpenTracking: + def __init__( + self, enable: Optional[bool] = None, substitution_tag: Optional[str] = None + ): + self.enable = enable + self.substitution_tag = substitution_tag + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enable": self.enable, + "substitution_tag": self.substitution_tag, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestTrackingSettingsOpenTracking( + enable=payload.get("enable"), + substitution_tag=payload.get("substitution_tag"), + ) diff --git a/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_subscription_tracking.py b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_subscription_tracking.py new file mode 100644 index 00000000..f271c9eb --- /dev/null +++ b/sendgrid/rest/api/mail/v3/models/send_mail_request_tracking_settings_subscription_tracking.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendMailRequestTrackingSettingsSubscriptionTracking: + def __init__( + self, + enable: Optional[bool] = None, + text: Optional[str] = None, + html: Optional[str] = None, + substitution_tag: Optional[str] = None, + ): + self.enable = enable + self.text = text + self.html = html + self.substitution_tag = substitution_tag + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enable": self.enable, + "text": self.text, + "html": self.html, + "substitution_tag": self.substitution_tag, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendMailRequestTrackingSettingsSubscriptionTracking( + enable=payload.get("enable"), + text=payload.get("text"), + html=payload.get("html"), + substitution_tag=payload.get("substitution_tag"), + ) diff --git a/sendgrid/rest/api/mail/v3/send_mail.py b/sendgrid/rest/api/mail/v3/send_mail.py new file mode 100644 index 00000000..46cfb2b8 --- /dev/null +++ b/sendgrid/rest/api/mail/v3/send_mail.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail API + The Twilio SendGrid v3 Mail API allows you to send email at scale over HTTP. The Mail Send endpoint supports many levels of functionality, allowing you to send templates, set categories and custom arguments that can be used to analyze your send, and configure which tracking settings to include such as opens and clicks. You can also group mail sends into batches, allowing you to schedule and cancel sends by their batch IDs. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail.v3.models.content_encoding import ContentEncoding +from sendgrid.rest.api.mail.v3.models.send_mail_request import SendMailRequest + + +class SendMail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + content_encoding: Optional[ContentEncoding] = None, + send_mail_request: Optional[SendMailRequest] = None, + ): + path = "/v3/mail/send" + + headers = values.of( + { + "Content-Encoding": content_encoding, + } + ) + headers["Content-Type"] = "application/json" + data = None + if send_mail_request: + data = send_mail_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/__init__.py b/sendgrid/rest/api/mail_settings/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mail_settings/v3/list_address_whitelist.py b/sendgrid/rest/api/mail_settings/v3/list_address_whitelist.py new file mode 100644 index 00000000..0b737c70 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_address_whitelist.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAddressWhitelist: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail_settings/address_whitelist" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/list_bounce_purge.py b/sendgrid/rest/api/mail_settings/v3/list_bounce_purge.py new file mode 100644 index 00000000..195f47be --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_bounce_purge.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListBouncePurge: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail_settings/bounce_purge" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/list_footer.py b/sendgrid/rest/api/mail_settings/v3/list_footer.py new file mode 100644 index 00000000..e237473d --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_footer.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListFooter: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail_settings/footer" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/list_forward_bounce.py b/sendgrid/rest/api/mail_settings/v3/list_forward_bounce.py new file mode 100644 index 00000000..4c43c52e --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_forward_bounce.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListForwardBounce: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail_settings/forward_bounce" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/list_forward_spam.py b/sendgrid/rest/api/mail_settings/v3/list_forward_spam.py new file mode 100644 index 00000000..e6412064 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_forward_spam.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListForwardSpam: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail_settings/forward_spam" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/list_mail_setting.py b/sendgrid/rest/api/mail_settings/v3/list_mail_setting.py new file mode 100644 index 00000000..03896ab0 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_mail_setting.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListMailSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/mail_settings" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/list_template.py b/sendgrid/rest/api/mail_settings/v3/list_template.py new file mode 100644 index 00000000..d7c72c0a --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/list_template.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/mail_settings/template" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/__init__.py b/sendgrid/rest/api/mail_settings/v3/models/__init__.py new file mode 100644 index 00000000..ab0d8d53 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/__init__.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mail_settings.v3.models.list_mail_setting200_response import ( + ListMailSetting200Response, +) +from sendgrid.rest.api.mail_settings.v3.models.list_mail_setting200_response_result_inner import ( + ListMailSetting200ResponseResultInner, +) +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_address_whitelabel200 import ( + MailSettingsAddressWhitelabel200, +) +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_bounce_purge import ( + MailSettingsBouncePurge, +) +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_footer import ( + MailSettingsFooter, +) +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_forward_bounce import ( + MailSettingsForwardBounce, +) +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_forward_spam import ( + MailSettingsForwardSpam, +) +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_template200 import ( + MailSettingsTemplate200, +) +from sendgrid.rest.api.mail_settings.v3.models.update_address_whitelist_request import ( + UpdateAddressWhitelistRequest, +) +from sendgrid.rest.api.mail_settings.v3.models.update_template200_response import ( + UpdateTemplate200Response, +) +from sendgrid.rest.api.mail_settings.v3.models.update_template_request import ( + UpdateTemplateRequest, +) + +__all__ = [ + "ListMailSetting200Response", + "ListMailSetting200ResponseResultInner", + "MailSettingsAddressWhitelabel200", + "MailSettingsBouncePurge", + "MailSettingsFooter", + "MailSettingsForwardBounce", + "MailSettingsForwardSpam", + "MailSettingsTemplate200", + "UpdateAddressWhitelistRequest", + "UpdateTemplate200Response", + "UpdateTemplateRequest", +] +# Testing code diff --git a/sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response.py b/sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response.py new file mode 100644 index 00000000..014fddea --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mail_settings.v3.models.list_mail_setting200_response_result_inner import ( + ListMailSetting200ResponseResultInner, +) + + +class ListMailSetting200Response: + def __init__( + self, result: Optional[List[ListMailSetting200ResponseResultInner]] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMailSetting200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response_result_inner.py b/sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response_result_inner.py new file mode 100644 index 00000000..6ffeb47e --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/list_mail_setting200_response_result_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListMailSetting200ResponseResultInner: + def __init__( + self, + title: Optional[str] = None, + enabled: Optional[bool] = None, + name: Optional[str] = None, + description: Optional[str] = None, + ): + self.title = title + self.enabled = enabled + self.name = name + self.description = description + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "title": self.title, + "enabled": self.enabled, + "name": self.name, + "description": self.description, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMailSetting200ResponseResultInner( + title=payload.get("title"), + enabled=payload.get("enabled"), + name=payload.get("name"), + description=payload.get("description"), + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/mail_settings_address_whitelabel200.py b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_address_whitelabel200.py new file mode 100644 index 00000000..3ed28f56 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_address_whitelabel200.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailSettingsAddressWhitelabel200: + def __init__( + self, enabled: Optional[bool] = None, list: Optional[List[str]] = None + ): + self.enabled = enabled + self.list = list + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enabled": self.enabled, "list": self.list}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailSettingsAddressWhitelabel200( + enabled=payload.get("enabled"), list=payload.get("list") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/mail_settings_bounce_purge.py b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_bounce_purge.py new file mode 100644 index 00000000..a03f8c2a --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_bounce_purge.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailSettingsBouncePurge: + def __init__( + self, + enabled: Optional[bool] = None, + soft_bounces: Optional[int] = None, + hard_bounces: Optional[int] = None, + ): + self.enabled = enabled + self.soft_bounces = soft_bounces + self.hard_bounces = hard_bounces + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "soft_bounces": self.soft_bounces, + "hard_bounces": self.hard_bounces, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailSettingsBouncePurge( + enabled=payload.get("enabled"), + soft_bounces=payload.get("soft_bounces"), + hard_bounces=payload.get("hard_bounces"), + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/mail_settings_footer.py b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_footer.py new file mode 100644 index 00000000..8e771d42 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_footer.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailSettingsFooter: + def __init__( + self, + enabled: Optional[bool] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + ): + self.enabled = enabled + self.html_content = html_content + self.plain_content = plain_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "html_content": self.html_content, + "plain_content": self.plain_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailSettingsFooter( + enabled=payload.get("enabled"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_bounce.py b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_bounce.py new file mode 100644 index 00000000..d0343e24 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_bounce.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailSettingsForwardBounce: + def __init__(self, email: Optional[str] = None, enabled: Optional[bool] = None): + self.email = email + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "enabled": self.enabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailSettingsForwardBounce( + email=payload.get("email"), enabled=payload.get("enabled") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_spam.py b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_spam.py new file mode 100644 index 00000000..2e24d53a --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_forward_spam.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailSettingsForwardSpam: + def __init__(self, email: Optional[str] = None, enabled: Optional[bool] = None): + self.email = email + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "enabled": self.enabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailSettingsForwardSpam( + email=payload.get("email"), enabled=payload.get("enabled") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/mail_settings_template200.py b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_template200.py new file mode 100644 index 00000000..c83ff420 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/mail_settings_template200.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailSettingsTemplate200: + def __init__( + self, enabled: Optional[bool] = None, html_content: Optional[str] = None + ): + self.enabled = enabled + self.html_content = html_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "html_content": self.html_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailSettingsTemplate200( + enabled=payload.get("enabled"), html_content=payload.get("html_content") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/update_address_whitelist_request.py b/sendgrid/rest/api/mail_settings/v3/models/update_address_whitelist_request.py new file mode 100644 index 00000000..f99ff206 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/update_address_whitelist_request.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAddressWhitelistRequest: + def __init__( + self, enabled: Optional[bool] = None, list: Optional[List[str]] = None + ): + self.enabled = enabled + self.list = list + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enabled": self.enabled, "list": self.list}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAddressWhitelistRequest( + enabled=payload.get("enabled"), list=payload.get("list") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/update_template200_response.py b/sendgrid/rest/api/mail_settings/v3/models/update_template200_response.py new file mode 100644 index 00000000..7c150dab --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/update_template200_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateTemplate200Response: + def __init__( + self, enabled: Optional[bool] = None, html_content: Optional[str] = None + ): + self.enabled = enabled + self.html_content = html_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "html_content": self.html_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateTemplate200Response( + enabled=payload.get("enabled"), html_content=payload.get("html_content") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/models/update_template_request.py b/sendgrid/rest/api/mail_settings/v3/models/update_template_request.py new file mode 100644 index 00000000..cba2ece2 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/models/update_template_request.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateTemplateRequest: + def __init__( + self, enabled: Optional[bool] = None, html_content: Optional[str] = None + ): + self.enabled = enabled + self.html_content = html_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "html_content": self.html_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateTemplateRequest( + enabled=payload.get("enabled"), html_content=payload.get("html_content") + ) diff --git a/sendgrid/rest/api/mail_settings/v3/update_address_whitelist.py b/sendgrid/rest/api/mail_settings/v3/update_address_whitelist.py new file mode 100644 index 00000000..b1957442 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/update_address_whitelist.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail_settings.v3.models.update_address_whitelist_request import ( + UpdateAddressWhitelistRequest, +) + + +class UpdateAddressWhitelist: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_address_whitelist_request: Optional[ + UpdateAddressWhitelistRequest + ] = None, + ): + path = "/v3/mail_settings/address_whitelist" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_address_whitelist_request: + data = update_address_whitelist_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/update_bounce_purge.py b/sendgrid/rest/api/mail_settings/v3/update_bounce_purge.py new file mode 100644 index 00000000..1f788d66 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/update_bounce_purge.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_bounce_purge import ( + MailSettingsBouncePurge, +) + + +class UpdateBouncePurge: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + mail_settings_bounce_purge: Optional[MailSettingsBouncePurge] = None, + ): + path = "/v3/mail_settings/bounce_purge" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if mail_settings_bounce_purge: + data = mail_settings_bounce_purge.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/update_footer.py b/sendgrid/rest/api/mail_settings/v3/update_footer.py new file mode 100644 index 00000000..21c3286d --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/update_footer.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_footer import ( + MailSettingsFooter, +) + + +class UpdateFooter: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + mail_settings_footer: Optional[MailSettingsFooter] = None, + ): + path = "/v3/mail_settings/footer" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if mail_settings_footer: + data = mail_settings_footer.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/update_forward_bounce.py b/sendgrid/rest/api/mail_settings/v3/update_forward_bounce.py new file mode 100644 index 00000000..f4ae5c2f --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/update_forward_bounce.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_forward_bounce import ( + MailSettingsForwardBounce, +) + + +class UpdateForwardBounce: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + mail_settings_forward_bounce: Optional[MailSettingsForwardBounce] = None, + ): + path = "/v3/mail_settings/forward_bounce" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if mail_settings_forward_bounce: + data = mail_settings_forward_bounce.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/update_forward_spam.py b/sendgrid/rest/api/mail_settings/v3/update_forward_spam.py new file mode 100644 index 00000000..a05b0783 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/update_forward_spam.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail_settings.v3.models.mail_settings_forward_spam import ( + MailSettingsForwardSpam, +) + + +class UpdateForwardSpam: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + mail_settings_forward_spam: Optional[MailSettingsForwardSpam] = None, + ): + path = "/v3/mail_settings/forward_spam" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if mail_settings_forward_spam: + data = mail_settings_forward_spam.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mail_settings/v3/update_template.py b/sendgrid/rest/api/mail_settings/v3/update_template.py new file mode 100644 index 00000000..60a9eff7 --- /dev/null +++ b/sendgrid/rest/api/mail_settings/v3/update_template.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Mail Settings API + The Twilio SendGrid Mail Settings API allows you to retrieve and configure the various Mail Settings available. Mail Settings instruct SendGrid to apply specific settings to every email that you send over [SendGrid’s Web API](https://docs.sendgrid.com/api-reference/mail-send/v3-mail-send) or [SMTP relay](https://sendgrid.com/docs/for-developers/sending-email/building-an-x-smtpapi-header/). These settings include how to embed a custom footer, how to manage blocks, spam, and bounces, and more. For a full list of Twilio SendGrid's Mail Settings, and what each one does, see [**Mail Settings**](https://sendgrid.com/docs/ui/account-and-settings/mail/). You can also manage your Mail Settings in the Twilio SendGrid application user interface. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mail_settings.v3.models.update_template_request import ( + UpdateTemplateRequest, +) + + +class UpdateTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_template_request: Optional[UpdateTemplateRequest] = None, + ): + path = "/v3/mail_settings/template" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_template_request: + data = update_template_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/__init__.py b/sendgrid/rest/api/mc_contacts/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_contacts/v3/delete_contact.py b/sendgrid/rest/api/mc_contacts/v3/delete_contact.py new file mode 100644 index 00000000..a6a516ab --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/delete_contact.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + delete_all_contacts: Optional[str] = None, + ids: Optional[str] = None, + ): + path = "/v3/marketing/contacts" + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/delete_contact_identifier.py b/sendgrid/rest/api/mc_contacts/v3/delete_contact_identifier.py new file mode 100644 index 00000000..934872ca --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/delete_contact_identifier.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.delete_contact_identifier_request import ( + DeleteContactIdentifierRequest, +) + + +class DeleteContactIdentifier: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + contact_id: str, + delete_contact_identifier_request: Optional[ + DeleteContactIdentifierRequest + ] = None, + ): + path = "/v3/marketing/contacts/{contact_id}/identifiers" + path = path.format( + contact_id=contact_id, + ) + + data = None + if delete_contact_identifier_request: + data = delete_contact_identifier_request.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/export_contact.py b/sendgrid/rest/api/mc_contacts/v3/export_contact.py new file mode 100644 index 00000000..3a9e6720 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/export_contact.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.export_contact_request import ( + ExportContactRequest, +) + + +class ExportContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + export_contact_request: Optional[ExportContactRequest] = None, + ): + path = "/v3/marketing/contacts/exports" + + data = None + if export_contact_request: + data = export_contact_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/get_contact.py b/sendgrid/rest/api/mc_contacts/v3/get_contact.py new file mode 100644 index 00000000..c1d7c0b6 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/get_contact.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/contacts/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/get_contact_by_identifiers.py b/sendgrid/rest/api/mc_contacts/v3/get_contact_by_identifiers.py new file mode 100644 index 00000000..b4c29d63 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/get_contact_by_identifiers.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.get_contact_by_identifiers_request import ( + GetContactByIdentifiersRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.identifier_type1 import IdentifierType1 + + +class GetContactByIdentifiers: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + identifier_type: IdentifierType1, + get_contact_by_identifiers_request: Optional[ + GetContactByIdentifiersRequest + ] = None, + ): + path = "/v3/marketing/contacts/search/identifiers/{identifier_type}" + path = path.format( + identifier_type=identifier_type, + ) + + data = None + if get_contact_by_identifiers_request: + data = get_contact_by_identifiers_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/get_export_contact.py b/sendgrid/rest/api/mc_contacts/v3/get_export_contact.py new file mode 100644 index 00000000..e64a2d09 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/get_export_contact.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetExportContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/contacts/exports/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/get_import_contact.py b/sendgrid/rest/api/mc_contacts/v3/get_import_contact.py new file mode 100644 index 00000000..f2c7e3a9 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/get_import_contact.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetImportContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/contacts/imports/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/import_contact.py b/sendgrid/rest/api/mc_contacts/v3/import_contact.py new file mode 100644 index 00000000..a70de835 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/import_contact.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.import_contact_request import ( + ImportContactRequest, +) + + +class ImportContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + import_contact_request: Optional[ImportContactRequest] = None, + ): + path = "/v3/marketing/contacts/imports" + + data = None + if import_contact_request: + data = import_contact_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/list_batched_contact.py b/sendgrid/rest/api/mc_contacts/v3/list_batched_contact.py new file mode 100644 index 00000000..1b1ac39b --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/list_batched_contact.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.list_batched_contact_request import ( + ListBatchedContactRequest, +) + + +class ListBatchedContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_batched_contact_request: Optional[ListBatchedContactRequest] = None, + ): + path = "/v3/marketing/contacts/batch" + + data = None + if list_batched_contact_request: + data = list_batched_contact_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/list_contact.py b/sendgrid/rest/api/mc_contacts/v3/list_contact.py new file mode 100644 index 00000000..418e22a5 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/list_contact.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/marketing/contacts" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/list_contact_by_email.py b/sendgrid/rest/api/mc_contacts/v3/list_contact_by_email.py new file mode 100644 index 00000000..515f6a0a --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/list_contact_by_email.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.list_contact_by_email_request import ( + ListContactByEmailRequest, +) + + +class ListContactByEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + list_contact_by_email_request: Optional[ListContactByEmailRequest] = None, + ): + path = "/v3/marketing/contacts/search/emails" + + data = None + if list_contact_by_email_request: + data = list_contact_by_email_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/list_contact_count.py b/sendgrid/rest/api/mc_contacts/v3/list_contact_count.py new file mode 100644 index 00000000..c4f98a9e --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/list_contact_count.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListContactCount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/marketing/contacts/count" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/list_export_contact.py b/sendgrid/rest/api/mc_contacts/v3/list_export_contact.py new file mode 100644 index 00000000..1ccb4985 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/list_export_contact.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListExportContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/marketing/contacts/exports" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/__init__.py b/sendgrid/rest/api/mc_contacts/v3/models/__init__.py new file mode 100644 index 00000000..325e5c7a --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/__init__.py @@ -0,0 +1,212 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_contacts.v3.models.contact_details3 import ContactDetails3 +from sendgrid.rest.api.mc_contacts.v3.models.contact_export import ContactExport +from sendgrid.rest.api.mc_contacts.v3.models.contact_import import ContactImport +from sendgrid.rest.api.mc_contacts.v3.models.contact_import_results import ( + ContactImportResults, +) +from sendgrid.rest.api.mc_contacts.v3.models.contact_request import ContactRequest +from sendgrid.rest.api.mc_contacts.v3.models.contact_request_custom_fields import ( + ContactRequestCustomFields, +) +from sendgrid.rest.api.mc_contacts.v3.models.contacts_error import ContactsError +from sendgrid.rest.api.mc_contacts.v3.models.delete_contact202_response import ( + DeleteContact202Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.delete_contact400_response import ( + DeleteContact400Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.delete_contact_identifier202_response import ( + DeleteContactIdentifier202Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.delete_contact_identifier_request import ( + DeleteContactIdentifierRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.mc_contacts.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.export_contact202_response import ( + ExportContact202Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.export_contact_request import ( + ExportContactRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.export_contact_request_notifications import ( + ExportContactRequestNotifications, +) +from sendgrid.rest.api.mc_contacts.v3.models.file_type import FileType +from sendgrid.rest.api.mc_contacts.v3.models.file_type1 import FileType1 +from sendgrid.rest.api.mc_contacts.v3.models.get_contact_by_identifiers200_response import ( + GetContactByIdentifiers200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.get_contact_by_identifiers200_response_result_value import ( + GetContactByIdentifiers200ResponseResultValue, +) +from sendgrid.rest.api.mc_contacts.v3.models.get_contact_by_identifiers_request import ( + GetContactByIdentifiersRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.get_import_contact400_response import ( + GetImportContact400Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.identifier_type import IdentifierType +from sendgrid.rest.api.mc_contacts.v3.models.identifier_type1 import IdentifierType1 +from sendgrid.rest.api.mc_contacts.v3.models.import_contact200_response import ( + ImportContact200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.import_contact200_response_upload_headers_inner import ( + ImportContact200ResponseUploadHeadersInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.import_contact400_response import ( + ImportContact400Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.import_contact404_response import ( + ImportContact404Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.import_contact_request import ( + ImportContactRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_batched_contact200_response import ( + ListBatchedContact200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_batched_contact_request import ( + ListBatchedContactRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_contact200_response import ( + ListContact200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_contact400_response import ( + ListContact400Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_contact_by_email200_response import ( + ListContactByEmail200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_contact_by_email_request import ( + ListContactByEmailRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_contact_count200_response import ( + ListContactCount200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_contact_count200_response_billable_breakdown import ( + ListContactCount200ResponseBillableBreakdown, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response import ( + ListExportContact200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_metadata import ( + ListExportContact200ResponseMetadata, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_result_inner import ( + ListExportContact200ResponseResultInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_result_inner_metadata import ( + ListExportContact200ResponseResultInnerMetadata, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_result_inner_segments_inner import ( + ListExportContact200ResponseResultInnerSegmentsInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact400_response import ( + ListExportContact400Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact400_response_errors_inner import ( + ListExportContact400ResponseErrorsInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_contacts.v3.models.search_contact200_response import ( + SearchContact200Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.search_contact400_response import ( + SearchContact400Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.search_contact400_response_errors_inner import ( + SearchContact400ResponseErrorsInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.search_contact500_response import ( + SearchContact500Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.search_contact500_response_errors_inner import ( + SearchContact500ResponseErrorsInner, +) +from sendgrid.rest.api.mc_contacts.v3.models.search_contact_request import ( + SearchContactRequest, +) +from sendgrid.rest.api.mc_contacts.v3.models.self_metadata import SelfMetadata +from sendgrid.rest.api.mc_contacts.v3.models.status import Status +from sendgrid.rest.api.mc_contacts.v3.models.update_contact202_response import ( + UpdateContact202Response, +) +from sendgrid.rest.api.mc_contacts.v3.models.update_contact_request import ( + UpdateContactRequest, +) + +__all__ = [ + "ContactDetails3", + "ContactExport", + "ContactImport", + "ContactImportResults", + "ContactRequest", + "ContactRequestCustomFields", + "ContactsError", + "DeleteContact202Response", + "DeleteContact400Response", + "DeleteContactIdentifier202Response", + "DeleteContactIdentifierRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "ExportContact202Response", + "ExportContactRequest", + "ExportContactRequestNotifications", + "FileType", + "FileType1", + "GetContactByIdentifiers200Response", + "GetContactByIdentifiers200ResponseResultValue", + "GetContactByIdentifiersRequest", + "GetImportContact400Response", + "IdentifierType", + "IdentifierType1", + "ImportContact200Response", + "ImportContact200ResponseUploadHeadersInner", + "ImportContact400Response", + "ImportContact404Response", + "ImportContactRequest", + "ListBatchedContact200Response", + "ListBatchedContactRequest", + "ListContact200Response", + "ListContact400Response", + "ListContactByEmail200Response", + "ListContactByEmailRequest", + "ListContactCount200Response", + "ListContactCount200ResponseBillableBreakdown", + "ListExportContact200Response", + "ListExportContact200ResponseMetadata", + "ListExportContact200ResponseResultInner", + "ListExportContact200ResponseResultInnerMetadata", + "ListExportContact200ResponseResultInnerSegmentsInner", + "ListExportContact400Response", + "ListExportContact400ResponseErrorsInner", + "Metadata", + "SearchContact200Response", + "SearchContact400Response", + "SearchContact400ResponseErrorsInner", + "SearchContact500Response", + "SearchContact500ResponseErrorsInner", + "SearchContactRequest", + "SelfMetadata", + "Status", + "UpdateContact202Response", + "UpdateContactRequest", +] +# Testing code diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contact_details3.py b/sendgrid/rest/api/mc_contacts/v3/models/contact_details3.py new file mode 100644 index 00000000..a8a61a5e --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contact_details3.py @@ -0,0 +1,126 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.self_metadata import SelfMetadata + + +class ContactDetails3: + def __init__( + self, + id: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + unique_name: Optional[str] = None, + email: Optional[str] = None, + phone_number_id: Optional[str] = None, + external_id: Optional[str] = None, + anonymous_id: Optional[str] = None, + alternate_emails: Optional[List[str]] = None, + address_line_1: Optional[str] = None, + address_line_2: Optional[str] = None, + city: Optional[str] = None, + state_province_region: Optional[str] = None, + country: Optional[str] = None, + postal_code: Optional[str] = None, + phone_number: Optional[str] = None, + whatsapp: Optional[str] = None, + line: Optional[str] = None, + facebook: Optional[str] = None, + list_ids: Optional[List[str]] = None, + segment_ids: Optional[List[str]] = None, + custom_fields: Optional[object] = None, + created_at: Optional[str] = None, + updated_at: Optional[str] = None, + metadata: Optional[SelfMetadata] = None, + ): + self.id = id + self.first_name = first_name + self.last_name = last_name + self.unique_name = unique_name + self.email = email + self.phone_number_id = phone_number_id + self.external_id = external_id + self.anonymous_id = anonymous_id + self.alternate_emails = alternate_emails + self.address_line_1 = address_line_1 + self.address_line_2 = address_line_2 + self.city = city + self.state_province_region = state_province_region + self.country = country + self.postal_code = postal_code + self.phone_number = phone_number + self.whatsapp = whatsapp + self.line = line + self.facebook = facebook + self.list_ids = list_ids + self.segment_ids = segment_ids + self.custom_fields = custom_fields + self.created_at = created_at + self.updated_at = updated_at + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "first_name": self.first_name, + "last_name": self.last_name, + "unique_name": self.unique_name, + "email": self.email, + "phone_number_id": self.phone_number_id, + "external_id": self.external_id, + "anonymous_id": self.anonymous_id, + "alternate_emails": self.alternate_emails, + "address_line_1": self.address_line_1, + "address_line_2": self.address_line_2, + "city": self.city, + "state_province_region": self.state_province_region, + "country": self.country, + "postal_code": self.postal_code, + "phone_number": self.phone_number, + "whatsapp": self.whatsapp, + "line": self.line, + "facebook": self.facebook, + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "custom_fields": self.custom_fields, + "created_at": self.created_at, + "updated_at": self.updated_at, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactDetails3( + id=payload.get("id"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + unique_name=payload.get("unique_name"), + email=payload.get("email"), + phone_number_id=payload.get("phone_number_id"), + external_id=payload.get("external_id"), + anonymous_id=payload.get("anonymous_id"), + alternate_emails=payload.get("alternate_emails"), + address_line_1=payload.get("address_line_1"), + address_line_2=payload.get("address_line_2"), + city=payload.get("city"), + state_province_region=payload.get("state_province_region"), + country=payload.get("country"), + postal_code=payload.get("postal_code"), + phone_number=payload.get("phone_number"), + whatsapp=payload.get("whatsapp"), + line=payload.get("line"), + facebook=payload.get("facebook"), + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + custom_fields=payload.get("custom_fields"), + created_at=payload.get("created_at"), + updated_at=payload.get("updated_at"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contact_export.py b/sendgrid/rest/api/mc_contacts/v3/models/contact_export.py new file mode 100644 index 00000000..eaf4af9f --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contact_export.py @@ -0,0 +1,67 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_contacts.v3.models.status import Status + + +class ContactExport: + def __init__( + self, + id: Optional[str] = None, + status: Optional[Status] = None, + created_at: Optional[str] = None, + updated_at: Optional[str] = None, + completed_at: Optional[str] = None, + expires_at: Optional[str] = None, + urls: Optional[List[str]] = None, + message: Optional[str] = None, + metadata: Optional[Metadata] = None, + contact_count: Optional[int] = None, + ): + self.id = id + self.status = status + self.created_at = created_at + self.updated_at = updated_at + self.completed_at = completed_at + self.expires_at = expires_at + self.urls = urls + self.message = message + self.metadata = metadata + self.contact_count = contact_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "status": self.status, + "created_at": self.created_at, + "updated_at": self.updated_at, + "completed_at": self.completed_at, + "expires_at": self.expires_at, + "urls": self.urls, + "message": self.message, + "_metadata": self.metadata, + "contact_count": self.contact_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactExport( + id=payload.get("id"), + status=payload.get("status"), + created_at=payload.get("created_at"), + updated_at=payload.get("updated_at"), + completed_at=payload.get("completed_at"), + expires_at=payload.get("expires_at"), + urls=payload.get("urls"), + message=payload.get("message"), + metadata=payload.get("_metadata"), + contact_count=payload.get("contact_count"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contact_import.py b/sendgrid/rest/api/mc_contacts/v3/models/contact_import.py new file mode 100644 index 00000000..0d86f002 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contact_import.py @@ -0,0 +1,52 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_import_results import ( + ContactImportResults, +) + + +class ContactImport: + def __init__( + self, + id: Optional[str] = None, + status: Optional[str] = None, + job_type: Optional[str] = None, + results: Optional[ContactImportResults] = None, + started_at: Optional[str] = None, + finished_at: Optional[str] = None, + ): + self.id = id + self.status = status + self.job_type = job_type + self.results = results + self.started_at = started_at + self.finished_at = finished_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "status": self.status, + "job_type": self.job_type, + "results": self.results, + "started_at": self.started_at, + "finished_at": self.finished_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactImport( + id=payload.get("id"), + status=payload.get("status"), + job_type=payload.get("job_type"), + results=payload.get("results"), + started_at=payload.get("started_at"), + finished_at=payload.get("finished_at"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contact_import_results.py b/sendgrid/rest/api/mc_contacts/v3/models/contact_import_results.py new file mode 100644 index 00000000..2cd17eb7 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contact_import_results.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactImportResults: + def __init__( + self, + requested_count: Optional[float] = None, + created_count: Optional[float] = None, + updated_count: Optional[float] = None, + deleted_count: Optional[float] = None, + errored_count: Optional[float] = None, + errors_url: Optional[str] = None, + ): + self.requested_count = requested_count + self.created_count = created_count + self.updated_count = updated_count + self.deleted_count = deleted_count + self.errored_count = errored_count + self.errors_url = errors_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "requested_count": self.requested_count, + "created_count": self.created_count, + "updated_count": self.updated_count, + "deleted_count": self.deleted_count, + "errored_count": self.errored_count, + "errors_url": self.errors_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactImportResults( + requested_count=payload.get("requested_count"), + created_count=payload.get("created_count"), + updated_count=payload.get("updated_count"), + deleted_count=payload.get("deleted_count"), + errored_count=payload.get("errored_count"), + errors_url=payload.get("errors_url"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contact_request.py b/sendgrid/rest/api/mc_contacts/v3/models/contact_request.py new file mode 100644 index 00000000..578ce0ed --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contact_request.py @@ -0,0 +1,84 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_request_custom_fields import ( + ContactRequestCustomFields, +) + + +class ContactRequest: + def __init__( + self, + address_line_1: Optional[str] = None, + address_line_2: Optional[str] = None, + alternate_emails: Optional[List[str]] = None, + city: Optional[str] = None, + country: Optional[str] = None, + email: Optional[str] = None, + phone_number_id: Optional[str] = None, + external_id: Optional[str] = None, + anonymous_id: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + postal_code: Optional[str] = None, + state_province_region: Optional[str] = None, + custom_fields: Optional[ContactRequestCustomFields] = None, + ): + self.address_line_1 = address_line_1 + self.address_line_2 = address_line_2 + self.alternate_emails = alternate_emails + self.city = city + self.country = country + self.email = email + self.phone_number_id = phone_number_id + self.external_id = external_id + self.anonymous_id = anonymous_id + self.first_name = first_name + self.last_name = last_name + self.postal_code = postal_code + self.state_province_region = state_province_region + self.custom_fields = custom_fields + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "address_line_1": self.address_line_1, + "address_line_2": self.address_line_2, + "alternate_emails": self.alternate_emails, + "city": self.city, + "country": self.country, + "email": self.email, + "phone_number_id": self.phone_number_id, + "external_id": self.external_id, + "anonymous_id": self.anonymous_id, + "first_name": self.first_name, + "last_name": self.last_name, + "postal_code": self.postal_code, + "state_province_region": self.state_province_region, + "custom_fields": self.custom_fields, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactRequest( + address_line_1=payload.get("address_line_1"), + address_line_2=payload.get("address_line_2"), + alternate_emails=payload.get("alternate_emails"), + city=payload.get("city"), + country=payload.get("country"), + email=payload.get("email"), + phone_number_id=payload.get("phone_number_id"), + external_id=payload.get("external_id"), + anonymous_id=payload.get("anonymous_id"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + postal_code=payload.get("postal_code"), + state_province_region=payload.get("state_province_region"), + custom_fields=payload.get("custom_fields"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contact_request_custom_fields.py b/sendgrid/rest/api/mc_contacts/v3/models/contact_request_custom_fields.py new file mode 100644 index 00000000..346be04c --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contact_request_custom_fields.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactRequestCustomFields: + def __init__(self, w1: Optional[str] = None): + self.w1 = w1 + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"w1": self.w1}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactRequestCustomFields(w1=payload.get("w1")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/contacts_error.py b/sendgrid/rest/api/mc_contacts/v3/models/contacts_error.py new file mode 100644 index 00000000..9b4a9257 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/contacts_error.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactsError: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + error_id: Optional[str] = None, + parameter: Optional[str] = None, + ): + self.message = message + self.field = field + self.error_id = error_id + self.parameter = parameter + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "error_id": self.error_id, + "parameter": self.parameter, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactsError( + message=payload.get("message"), + field=payload.get("field"), + error_id=payload.get("error_id"), + parameter=payload.get("parameter"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/delete_contact202_response.py b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact202_response.py new file mode 100644 index 00000000..fab99311 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact202_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteContact202Response: + def __init__(self, job_id: Optional[object] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteContact202Response(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/delete_contact400_response.py b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact400_response.py new file mode 100644 index 00000000..064e486a --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact400_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteContact400Response: + def __init__(self, errors: Optional[List[object]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteContact400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier202_response.py b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier202_response.py new file mode 100644 index 00000000..d6d94228 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier202_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteContactIdentifier202Response: + def __init__(self, job_id: Optional[object] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteContactIdentifier202Response(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier_request.py b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier_request.py new file mode 100644 index 00000000..b133abcb --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/delete_contact_identifier_request.py @@ -0,0 +1,34 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.identifier_type import IdentifierType + + +class DeleteContactIdentifierRequest: + def __init__( + self, + identifier_type: Optional[IdentifierType] = None, + identifier_value: Optional[str] = None, + ): + self.identifier_type = identifier_type + self.identifier_value = identifier_value + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "identifier_type": self.identifier_type, + "identifier_value": self.identifier_value, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteContactIdentifierRequest( + identifier_type=payload.get("identifier_type"), + identifier_value=payload.get("identifier_value"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/error_response.py b/sendgrid/rest/api/mc_contacts/v3/models/error_response.py new file mode 100644 index 00000000..be9b472a --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/export_contact202_response.py b/sendgrid/rest/api/mc_contacts/v3/models/export_contact202_response.py new file mode 100644 index 00000000..055f2b17 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/export_contact202_response.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.metadata import Metadata + + +class ExportContact202Response: + def __init__(self, metadata: Optional[Metadata] = None, id: Optional[str] = None): + self.metadata = metadata + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"_metadata": self.metadata, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ExportContact202Response( + metadata=payload.get("_metadata"), id=payload.get("id") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/export_contact_request.py b/sendgrid/rest/api/mc_contacts/v3/models/export_contact_request.py new file mode 100644 index 00000000..e42be19e --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/export_contact_request.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.export_contact_request_notifications import ( + ExportContactRequestNotifications, +) +from sendgrid.rest.api.mc_contacts.v3.models.file_type import FileType + + +class ExportContactRequest: + def __init__( + self, + list_ids: Optional[List[str]] = None, + segment_ids: Optional[List[str]] = None, + notifications: Optional[ExportContactRequestNotifications] = None, + file_type: Optional[FileType] = None, + max_file_size: Optional[int] = None, + ): + self.list_ids = list_ids + self.segment_ids = segment_ids + self.notifications = notifications + self.file_type = file_type + self.max_file_size = max_file_size + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "notifications": self.notifications, + "file_type": self.file_type, + "max_file_size": self.max_file_size, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ExportContactRequest( + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + notifications=payload.get("notifications"), + file_type=payload.get("file_type"), + max_file_size=payload.get("max_file_size"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/export_contact_request_notifications.py b/sendgrid/rest/api/mc_contacts/v3/models/export_contact_request_notifications.py new file mode 100644 index 00000000..5bc56609 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/export_contact_request_notifications.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ExportContactRequestNotifications: + def __init__(self, email: Optional[bool] = None): + self.email = email + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ExportContactRequestNotifications(email=payload.get("email")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/file_type.py b/sendgrid/rest/api/mc_contacts/v3/models/file_type.py new file mode 100644 index 00000000..d8c79ffb --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/file_type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class FileType(Enum): + CSV = "csv" + JSON = "json" diff --git a/sendgrid/rest/api/mc_contacts/v3/models/file_type1.py b/sendgrid/rest/api/mc_contacts/v3/models/file_type1.py new file mode 100644 index 00000000..c5815b1f --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/file_type1.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class FileType1(Enum): + CSV = "csv" diff --git a/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response.py new file mode 100644 index 00000000..7faa958f --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetContactByIdentifiers200Response: + def __init__(self, result: Optional[object] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetContactByIdentifiers200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response_result_value.py b/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response_result_value.py new file mode 100644 index 00000000..94431048 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers200_response_result_value.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_details3 import ContactDetails3 + + +class GetContactByIdentifiers200ResponseResultValue: + def __init__( + self, contact: Optional[ContactDetails3] = None, error: Optional[str] = None + ): + self.contact = contact + self.error = error + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"contact": self.contact, "error": self.error}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetContactByIdentifiers200ResponseResultValue( + contact=payload.get("contact"), error=payload.get("error") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers_request.py b/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers_request.py new file mode 100644 index 00000000..634f4e47 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/get_contact_by_identifiers_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetContactByIdentifiersRequest: + def __init__(self, identifiers: Optional[List[str]] = None): + self.identifiers = identifiers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"identifiers": self.identifiers}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetContactByIdentifiersRequest(identifiers=payload.get("identifiers")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/get_import_contact400_response.py b/sendgrid/rest/api/mc_contacts/v3/models/get_import_contact400_response.py new file mode 100644 index 00000000..59d7ff81 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/get_import_contact400_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contacts_error import ContactsError + + +class GetImportContact400Response: + def __init__(self, errors: Optional[ContactsError] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetImportContact400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/identifier_type.py b/sendgrid/rest/api/mc_contacts/v3/models/identifier_type.py new file mode 100644 index 00000000..075ab993 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/identifier_type.py @@ -0,0 +1,9 @@ +from enum import Enum +from enum import Enum + + +class IdentifierType(Enum): + EMAIL = "EMAIL" + PHONENUMBERID = "PHONENUMBERID" + EXTERNALID = "EXTERNALID" + ANONYMOUSID = "ANONYMOUSID" diff --git a/sendgrid/rest/api/mc_contacts/v3/models/identifier_type1.py b/sendgrid/rest/api/mc_contacts/v3/models/identifier_type1.py new file mode 100644 index 00000000..dbd6aa9b --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/identifier_type1.py @@ -0,0 +1,9 @@ +from enum import Enum +from enum import Enum + + +class IdentifierType1(Enum): + EMAIL = "email" + PHONE_NUMBER_ID = "phone_number_id" + EXTERNAL_ID = "external_id" + ANONYMOUS_ID = "anonymous_id" diff --git a/sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response.py new file mode 100644 index 00000000..7d0d63d1 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.import_contact200_response_upload_headers_inner import ( + ImportContact200ResponseUploadHeadersInner, +) + + +class ImportContact200Response: + def __init__( + self, + job_id: Optional[str] = None, + upload_uri: Optional[str] = None, + upload_headers: Optional[ + List[ImportContact200ResponseUploadHeadersInner] + ] = None, + ): + self.job_id = job_id + self.upload_uri = upload_uri + self.upload_headers = upload_headers + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "job_id": self.job_id, + "upload_uri": self.upload_uri, + "upload_headers": self.upload_headers, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ImportContact200Response( + job_id=payload.get("job_id"), + upload_uri=payload.get("upload_uri"), + upload_headers=payload.get("upload_headers"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response_upload_headers_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response_upload_headers_inner.py new file mode 100644 index 00000000..994b1852 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/import_contact200_response_upload_headers_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ImportContact200ResponseUploadHeadersInner: + def __init__(self, header: Optional[str] = None, value: Optional[str] = None): + self.header = header + self.value = value + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"header": self.header, "value": self.value}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ImportContact200ResponseUploadHeadersInner( + header=payload.get("header"), value=payload.get("value") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/import_contact400_response.py b/sendgrid/rest/api/mc_contacts/v3/models/import_contact400_response.py new file mode 100644 index 00000000..54a1670b --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/import_contact400_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contacts_error import ContactsError + + +class ImportContact400Response: + def __init__(self, errors: Optional[List[ContactsError]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ImportContact400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/import_contact404_response.py b/sendgrid/rest/api/mc_contacts/v3/models/import_contact404_response.py new file mode 100644 index 00000000..9b2ce23e --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/import_contact404_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contacts_error import ContactsError + + +class ImportContact404Response: + def __init__(self, errors: Optional[List[ContactsError]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ImportContact404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/import_contact_request.py b/sendgrid/rest/api/mc_contacts/v3/models/import_contact_request.py new file mode 100644 index 00000000..3264c618 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/import_contact_request.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.file_type1 import FileType1 + + +class ImportContactRequest: + def __init__( + self, + list_ids: Optional[List[str]] = None, + file_type: Optional[FileType1] = None, + field_mappings: Optional[List[str]] = None, + ): + self.list_ids = list_ids + self.file_type = file_type + self.field_mappings = field_mappings + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "list_ids": self.list_ids, + "file_type": self.file_type, + "field_mappings": self.field_mappings, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ImportContactRequest( + list_ids=payload.get("list_ids"), + file_type=payload.get("file_type"), + field_mappings=payload.get("field_mappings"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact200_response.py new file mode 100644 index 00000000..b52a33d0 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_details3 import ContactDetails3 + + +class ListBatchedContact200Response: + def __init__(self, result: Optional[List[ContactDetails3]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListBatchedContact200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact_request.py b/sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact_request.py new file mode 100644 index 00000000..44330319 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_batched_contact_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListBatchedContactRequest: + def __init__(self, ids: Optional[List[str]] = None): + self.ids = ids + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ids": self.ids}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListBatchedContactRequest(ids=payload.get("ids")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_contact200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_contact200_response.py new file mode 100644 index 00000000..65910dab --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_contact200_response.py @@ -0,0 +1,39 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_details3 import ContactDetails3 +from sendgrid.rest.api.mc_contacts.v3.models.self_metadata import SelfMetadata + + +class ListContact200Response: + def __init__( + self, + result: Optional[List[ContactDetails3]] = None, + metadata: Optional[SelfMetadata] = None, + contact_count: Optional[int] = None, + ): + self.result = result + self.metadata = metadata + self.contact_count = contact_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + "contact_count": self.contact_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContact200Response( + result=payload.get("result"), + metadata=payload.get("_metadata"), + contact_count=payload.get("contact_count"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_contact400_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_contact400_response.py new file mode 100644 index 00000000..2590d293 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_contact400_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contacts_error import ContactsError + + +class ListContact400Response: + def __init__(self, errors: Optional[List[ContactsError]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContact400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email200_response.py new file mode 100644 index 00000000..ad211e77 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListContactByEmail200Response: + def __init__(self, result: Optional[object] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContactByEmail200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email_request.py b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email_request.py new file mode 100644 index 00000000..c9052a60 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_by_email_request.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListContactByEmailRequest: + def __init__( + self, + emails: Optional[List[str]] = None, + phone_number_id: Optional[str] = None, + external_id: Optional[str] = None, + anonymous_id: Optional[str] = None, + ): + self.emails = emails + self.phone_number_id = phone_number_id + self.external_id = external_id + self.anonymous_id = anonymous_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "emails": self.emails, + "phone_number_id": self.phone_number_id, + "external_id": self.external_id, + "anonymous_id": self.anonymous_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContactByEmailRequest( + emails=payload.get("emails"), + phone_number_id=payload.get("phone_number_id"), + external_id=payload.get("external_id"), + anonymous_id=payload.get("anonymous_id"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response.py new file mode 100644 index 00000000..916a8cba --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.list_contact_count200_response_billable_breakdown import ( + ListContactCount200ResponseBillableBreakdown, +) + + +class ListContactCount200Response: + def __init__( + self, + contact_count: Optional[int] = None, + billable_count: Optional[int] = None, + billable_breakdown: Optional[ + ListContactCount200ResponseBillableBreakdown + ] = None, + ): + self.contact_count = contact_count + self.billable_count = billable_count + self.billable_breakdown = billable_breakdown + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "contact_count": self.contact_count, + "billable_count": self.billable_count, + "billable_breakdown": self.billable_breakdown, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContactCount200Response( + contact_count=payload.get("contact_count"), + billable_count=payload.get("billable_count"), + billable_breakdown=payload.get("billable_breakdown"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response_billable_breakdown.py b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response_billable_breakdown.py new file mode 100644 index 00000000..e833110f --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_contact_count200_response_billable_breakdown.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListContactCount200ResponseBillableBreakdown: + def __init__(self, total: Optional[int] = None, breakdown: Optional[object] = None): + self.total = total + self.breakdown = breakdown + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"total": self.total, "breakdown": self.breakdown}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContactCount200ResponseBillableBreakdown( + total=payload.get("total"), breakdown=payload.get("breakdown") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response.py new file mode 100644 index 00000000..12a7c544 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_metadata import ( + ListExportContact200ResponseMetadata, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_result_inner import ( + ListExportContact200ResponseResultInner, +) + + +class ListExportContact200Response: + def __init__( + self, + result: Optional[List[ListExportContact200ResponseResultInner]] = None, + metadata: Optional[ListExportContact200ResponseMetadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_metadata.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_metadata.py new file mode 100644 index 00000000..a3f9d643 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_metadata.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListExportContact200ResponseMetadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact200ResponseMetadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner.py new file mode 100644 index 00000000..e6faab30 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner.py @@ -0,0 +1,79 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_result_inner_metadata import ( + ListExportContact200ResponseResultInnerMetadata, +) +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact200_response_result_inner_segments_inner import ( + ListExportContact200ResponseResultInnerSegmentsInner, +) + + +class ListExportContact200ResponseResultInner: + def __init__( + self, + id: Optional[str] = None, + status: Optional[str] = None, + created_at: Optional[str] = None, + completed_at: Optional[str] = None, + expires_at: Optional[str] = None, + urls: Optional[List[str]] = None, + user_id: Optional[str] = None, + export_type: Optional[str] = None, + segments: Optional[ + List[ListExportContact200ResponseResultInnerSegmentsInner] + ] = None, + lists: Optional[ + List[ListExportContact200ResponseResultInnerSegmentsInner] + ] = None, + metadata: Optional[ListExportContact200ResponseResultInnerMetadata] = None, + ): + self.id = id + self.status = status + self.created_at = created_at + self.completed_at = completed_at + self.expires_at = expires_at + self.urls = urls + self.user_id = user_id + self.export_type = export_type + self.segments = segments + self.lists = lists + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "status": self.status, + "created_at": self.created_at, + "completed_at": self.completed_at, + "expires_at": self.expires_at, + "urls": self.urls, + "user_id": self.user_id, + "export_type": self.export_type, + "segments": self.segments, + "lists": self.lists, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact200ResponseResultInner( + id=payload.get("id"), + status=payload.get("status"), + created_at=payload.get("created_at"), + completed_at=payload.get("completed_at"), + expires_at=payload.get("expires_at"), + urls=payload.get("urls"), + user_id=payload.get("user_id"), + export_type=payload.get("export_type"), + segments=payload.get("segments"), + lists=payload.get("lists"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_metadata.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_metadata.py new file mode 100644 index 00000000..d2b4fd6d --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_metadata.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListExportContact200ResponseResultInnerMetadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact200ResponseResultInnerMetadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_segments_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_segments_inner.py new file mode 100644 index 00000000..17673d3a --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact200_response_result_inner_segments_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListExportContact200ResponseResultInnerSegmentsInner: + def __init__(self, id: Optional[str] = None, name: Optional[str] = None): + self.id = id + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ID": self.id, "Name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact200ResponseResultInnerSegmentsInner( + id=payload.get("ID"), name=payload.get("Name") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response.py new file mode 100644 index 00000000..14e651b7 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.list_export_contact400_response_errors_inner import ( + ListExportContact400ResponseErrorsInner, +) + + +class ListExportContact400Response: + def __init__( + self, errors: Optional[List[ListExportContact400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response_errors_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response_errors_inner.py new file mode 100644 index 00000000..a5fb1d1c --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/list_export_contact400_response_errors_inner.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListExportContact400ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, error_id: Optional[str] = None): + self.message = message + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListExportContact400ResponseErrorsInner( + message=payload.get("message"), error_id=payload.get("error_id") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/metadata.py b/sendgrid/rest/api/mc_contacts/v3/models/metadata.py new file mode 100644 index 00000000..2d7bf72c --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[float] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/search_contact200_response.py b/sendgrid/rest/api/mc_contacts/v3/models/search_contact200_response.py new file mode 100644 index 00000000..e33009d8 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/search_contact200_response.py @@ -0,0 +1,39 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_details3 import ContactDetails3 +from sendgrid.rest.api.mc_contacts.v3.models.self_metadata import SelfMetadata + + +class SearchContact200Response: + def __init__( + self, + result: Optional[List[ContactDetails3]] = None, + metadata: Optional[SelfMetadata] = None, + contact_count: Optional[float] = None, + ): + self.result = result + self.metadata = metadata + self.contact_count = contact_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + "contact_count": self.contact_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchContact200Response( + result=payload.get("result"), + metadata=payload.get("_metadata"), + contact_count=payload.get("contact_count"), + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response.py b/sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response.py new file mode 100644 index 00000000..dd5bf381 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.search_contact400_response_errors_inner import ( + SearchContact400ResponseErrorsInner, +) + + +class SearchContact400Response: + def __init__( + self, errors: Optional[List[SearchContact400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchContact400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response_errors_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response_errors_inner.py new file mode 100644 index 00000000..1b92d18e --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/search_contact400_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SearchContact400ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchContact400ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response.py b/sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response.py new file mode 100644 index 00000000..c0457c7f --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.search_contact500_response_errors_inner import ( + SearchContact500ResponseErrorsInner, +) + + +class SearchContact500Response: + def __init__( + self, errors: Optional[List[SearchContact500ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchContact500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response_errors_inner.py b/sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response_errors_inner.py new file mode 100644 index 00000000..b666e6fe --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/search_contact500_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SearchContact500ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchContact500ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/search_contact_request.py b/sendgrid/rest/api/mc_contacts/v3/models/search_contact_request.py new file mode 100644 index 00000000..c37a109c --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/search_contact_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SearchContactRequest: + def __init__(self, query: Optional[str] = None): + self.query = query + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"query": self.query}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchContactRequest(query=payload.get("query")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/self_metadata.py b/sendgrid/rest/api/mc_contacts/v3/models/self_metadata.py new file mode 100644 index 00000000..448cb9b0 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/self_metadata.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SelfMetadata: + def __init__(self, var_self: Optional[str] = None): + self.var_self = var_self + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"self": self.var_self}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SelfMetadata(var_self=payload.get("self")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/status.py b/sendgrid/rest/api/mc_contacts/v3/models/status.py new file mode 100644 index 00000000..e1193c69 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/status.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status(Enum): + PENDING = "pending" + READY = "ready" + FAILURE = "failure" diff --git a/sendgrid/rest/api/mc_contacts/v3/models/update_contact202_response.py b/sendgrid/rest/api/mc_contacts/v3/models/update_contact202_response.py new file mode 100644 index 00000000..a392f652 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/update_contact202_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateContact202Response: + def __init__(self, job_id: Optional[str] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateContact202Response(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/mc_contacts/v3/models/update_contact_request.py b/sendgrid/rest/api/mc_contacts/v3/models/update_contact_request.py new file mode 100644 index 00000000..af79a275 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/models/update_contact_request.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_contacts.v3.models.contact_request import ContactRequest + + +class UpdateContactRequest: + def __init__( + self, + list_ids: Optional[List[str]] = None, + contacts: Optional[List[ContactRequest]] = None, + ): + self.list_ids = list_ids + self.contacts = contacts + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "list_ids": self.list_ids, + "contacts": self.contacts, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateContactRequest( + list_ids=payload.get("list_ids"), contacts=payload.get("contacts") + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/search_contact.py b/sendgrid/rest/api/mc_contacts/v3/search_contact.py new file mode 100644 index 00000000..935501ac --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/search_contact.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.search_contact_request import ( + SearchContactRequest, +) + + +class SearchContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + search_contact_request: Optional[SearchContactRequest] = None, + ): + path = "/v3/marketing/contacts/search" + + data = None + if search_contact_request: + data = search_contact_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_contacts/v3/update_contact.py b/sendgrid/rest/api/mc_contacts/v3/update_contact.py new file mode 100644 index 00000000..a08e2662 --- /dev/null +++ b/sendgrid/rest/api/mc_contacts/v3/update_contact.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Contacts API + The Twilio SendGrid Marketing Campaigns Contacts API allows you to manage all of your marketing contacts programmatically. You can also import and export contacts using this API. The Contacts API allows you to associate contacts with lists and segments; however, to manage the lists and segments themselves, see the [Lists API](https://docs.sendgrid.com/api-reference/lists/) and [Segments API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/). You can also manage your marketing contacts with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**How to Send Email with New Marketing Campaigns**](https://docs.sendgrid.com/ui/sending-email/how-to-send-email-with-marketing-campaigns) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_contacts.v3.models.update_contact_request import ( + UpdateContactRequest, +) + + +class UpdateContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + update_contact_request: Optional[UpdateContactRequest] = None, + ): + path = "/v3/marketing/contacts" + + data = None + if update_contact_request: + data = update_contact_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/__init__.py b/sendgrid/rest/api/mc_custom_fields/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_custom_fields/v3/create_field_definition.py b/sendgrid/rest/api/mc_custom_fields/v3/create_field_definition.py new file mode 100644 index 00000000..6e8d0eda --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/create_field_definition.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Custom Fields API + The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_custom_fields.v3.models.create_field_definition_request import ( + CreateFieldDefinitionRequest, +) + + +class CreateFieldDefinition: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + create_field_definition_request: Optional[CreateFieldDefinitionRequest] = None, + ): + path = "/v3/marketing/field_definitions" + + data = None + if create_field_definition_request: + data = create_field_definition_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/delete_field_definition.py b/sendgrid/rest/api/mc_custom_fields/v3/delete_field_definition.py new file mode 100644 index 00000000..f1fb9d60 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/delete_field_definition.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Custom Fields API + The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteFieldDefinition: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + custom_field_id: str, + ): + path = "/v3/marketing/field_definitions/{custom_field_id}" + path = path.format( + custom_field_id=custom_field_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/list_field_definition.py b/sendgrid/rest/api/mc_custom_fields/v3/list_field_definition.py new file mode 100644 index 00000000..a508ec8e --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/list_field_definition.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Custom Fields API + The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListFieldDefinition: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/marketing/field_definitions" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/__init__.py b/sendgrid/rest/api/mc_custom_fields/v3/models/__init__.py new file mode 100644 index 00000000..59e30de7 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/__init__.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Custom Fields API + The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_custom_fields.v3.models.create_field_definition200_response import ( + CreateFieldDefinition200Response, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.create_field_definition400_response import ( + CreateFieldDefinition400Response, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.create_field_definition_request import ( + CreateFieldDefinitionRequest, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.custom_field_definitions_response import ( + CustomFieldDefinitionsResponse, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.custom_fields_error import ( + CustomFieldsError, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type import FieldType +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type1 import FieldType1 +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type2 import FieldType2 +from sendgrid.rest.api.mc_custom_fields.v3.models.list_field_definition200_response import ( + ListFieldDefinition200Response, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_custom_fields.v3.models.reserved_field_definitions_response_inner import ( + ReservedFieldDefinitionsResponseInner, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.update_field_definition_request import ( + UpdateFieldDefinitionRequest, +) + +__all__ = [ + "CreateFieldDefinition200Response", + "CreateFieldDefinition400Response", + "CreateFieldDefinitionRequest", + "CustomFieldDefinitionsResponse", + "CustomFieldsError", + "FieldType", + "FieldType1", + "FieldType2", + "ListFieldDefinition200Response", + "Metadata", + "ReservedFieldDefinitionsResponseInner", + "UpdateFieldDefinitionRequest", +] +# Testing code diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition200_response.py b/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition200_response.py new file mode 100644 index 00000000..d37d801c --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition200_response.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type2 import FieldType2 +from sendgrid.rest.api.mc_custom_fields.v3.models.metadata import Metadata + + +class CreateFieldDefinition200Response: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + field_type: Optional[FieldType2] = None, + metadata: Optional[Metadata] = None, + ): + self.id = id + self.name = name + self.field_type = field_type + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "field_type": self.field_type, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateFieldDefinition200Response( + id=payload.get("id"), + name=payload.get("name"), + field_type=payload.get("field_type"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition400_response.py b/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition400_response.py new file mode 100644 index 00000000..53a9f178 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition400_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_custom_fields.v3.models.custom_fields_error import ( + CustomFieldsError, +) + + +class CreateFieldDefinition400Response: + def __init__(self, errors: Optional[List[CustomFieldsError]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateFieldDefinition400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition_request.py b/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition_request.py new file mode 100644 index 00000000..7a2df6be --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/create_field_definition_request.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type import FieldType + + +class CreateFieldDefinitionRequest: + def __init__( + self, name: Optional[str] = None, field_type: Optional[FieldType] = None + ): + self.name = name + self.field_type = field_type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "field_type": self.field_type}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateFieldDefinitionRequest( + name=payload.get("name"), field_type=payload.get("field_type") + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/custom_field_definitions_response.py b/sendgrid/rest/api/mc_custom_fields/v3/models/custom_field_definitions_response.py new file mode 100644 index 00000000..d0cce70c --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/custom_field_definitions_response.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type2 import FieldType2 + + +class CustomFieldDefinitionsResponse: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + field_type: Optional[FieldType2] = None, + ): + self.id = id + self.name = name + self.field_type = field_type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "field_type": self.field_type, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CustomFieldDefinitionsResponse( + id=payload.get("id"), + name=payload.get("name"), + field_type=payload.get("field_type"), + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/custom_fields_error.py b/sendgrid/rest/api/mc_custom_fields/v3/models/custom_fields_error.py new file mode 100644 index 00000000..2954035d --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/custom_fields_error.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CustomFieldsError: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + error_id: Optional[str] = None, + parameter: Optional[str] = None, + ): + self.message = message + self.field = field + self.error_id = error_id + self.parameter = parameter + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "error_id": self.error_id, + "parameter": self.parameter, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CustomFieldsError( + message=payload.get("message"), + field=payload.get("field"), + error_id=payload.get("error_id"), + parameter=payload.get("parameter"), + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/field_type.py b/sendgrid/rest/api/mc_custom_fields/v3/models/field_type.py new file mode 100644 index 00000000..dbd0d3b4 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/field_type.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class FieldType(Enum): + TEXT = "Text" + NUMBER = "Number" + DATE = "Date" diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/field_type1.py b/sendgrid/rest/api/mc_custom_fields/v3/models/field_type1.py new file mode 100644 index 00000000..3c64bc3f --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/field_type1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class FieldType1(Enum): + TEXT = "Text" + NUMBER = "Number" + DATE = "Date" diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/field_type2.py b/sendgrid/rest/api/mc_custom_fields/v3/models/field_type2.py new file mode 100644 index 00000000..8adabf27 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/field_type2.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class FieldType2(Enum): + TEXT = "Text" + NUMBER = "Number" + DATE = "Date" diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/list_field_definition200_response.py b/sendgrid/rest/api/mc_custom_fields/v3/models/list_field_definition200_response.py new file mode 100644 index 00000000..56f85677 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/list_field_definition200_response.py @@ -0,0 +1,44 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_custom_fields.v3.models.custom_field_definitions_response import ( + CustomFieldDefinitionsResponse, +) +from sendgrid.rest.api.mc_custom_fields.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_custom_fields.v3.models.reserved_field_definitions_response_inner import ( + ReservedFieldDefinitionsResponseInner, +) + + +class ListFieldDefinition200Response: + def __init__( + self, + custom_fields: Optional[List[CustomFieldDefinitionsResponse]] = None, + reserved_fields: Optional[List[ReservedFieldDefinitionsResponseInner]] = None, + metadata: Optional[Metadata] = None, + ): + self.custom_fields = custom_fields + self.reserved_fields = reserved_fields + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "custom_fields": self.custom_fields, + "reserved_fields": self.reserved_fields, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListFieldDefinition200Response( + custom_fields=payload.get("custom_fields"), + reserved_fields=payload.get("reserved_fields"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/metadata.py b/sendgrid/rest/api/mc_custom_fields/v3/models/metadata.py new file mode 100644 index 00000000..3281a432 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[int] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/reserved_field_definitions_response_inner.py b/sendgrid/rest/api/mc_custom_fields/v3/models/reserved_field_definitions_response_inner.py new file mode 100644 index 00000000..6cfe5e39 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/reserved_field_definitions_response_inner.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_custom_fields.v3.models.field_type1 import FieldType1 + + +class ReservedFieldDefinitionsResponseInner: + def __init__( + self, + name: Optional[str] = None, + field_type: Optional[FieldType1] = None, + read_only: Optional[bool] = None, + ): + self.name = name + self.field_type = field_type + self.read_only = read_only + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "field_type": self.field_type, + "read_only": self.read_only, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ReservedFieldDefinitionsResponseInner( + name=payload.get("name"), + field_type=payload.get("field_type"), + read_only=payload.get("read_only"), + ) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/models/update_field_definition_request.py b/sendgrid/rest/api/mc_custom_fields/v3/models/update_field_definition_request.py new file mode 100644 index 00000000..b70abe5f --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/models/update_field_definition_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateFieldDefinitionRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateFieldDefinitionRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/mc_custom_fields/v3/update_field_definition.py b/sendgrid/rest/api/mc_custom_fields/v3/update_field_definition.py new file mode 100644 index 00000000..166c7a07 --- /dev/null +++ b/sendgrid/rest/api/mc_custom_fields/v3/update_field_definition.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Custom Fields API + The Twilio SendGrid Marketing Campaigns Custom Fields API allows you to add extra information about your marketing contacts that is relevant to your needs. For example, a fashion retailer might create a custom field for customers' shoe sizes, an ice cream shop might store customers' favorite flavors in a custom field, and you can create custom fields that make sense for your business. With custom fields, you can also create [segments](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2/) based on custom fields values. Your custom fields are completely customizable to the use-cases and user information that you need. You can also manage your Custom Fields using the SendGrid application user interface. See [**Using Custom Fields**](https://docs.sendgrid.com/ui/managing-contacts/custom-fields) for more information, including a list of Reserved Fields. You can also manage your custom fields in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/custom-fields). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_custom_fields.v3.models.update_field_definition_request import ( + UpdateFieldDefinitionRequest, +) + + +class UpdateFieldDefinition: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + custom_field_id: str, + update_field_definition_request: Optional[UpdateFieldDefinitionRequest] = None, + ): + path = "/v3/marketing/field_definitions/{custom_field_id}" + path = path.format( + custom_field_id=custom_field_id, + ) + + data = None + if update_field_definition_request: + data = update_field_definition_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/__init__.py b/sendgrid/rest/api/mc_designs/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_designs/v3/create_design.py b/sendgrid/rest/api/mc_designs/v3/create_design.py new file mode 100644 index 00000000..fd629778 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/create_design.py @@ -0,0 +1,55 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_designs.v3.models.design_input import DesignInput + + +class CreateDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + design_input: Optional[DesignInput] = None, + ): + path = "/v3/designs" + + data = None + if design_input: + data = design_input.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/delete_design.py b/sendgrid/rest/api/mc_designs/v3/delete_design.py new file mode 100644 index 00000000..13aae9ce --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/delete_design.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/designs/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/duplicate_design.py b/sendgrid/rest/api/mc_designs/v3/duplicate_design.py new file mode 100644 index 00000000..7e9b1632 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/duplicate_design.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_designs.v3.models.design_duplicate_input import ( + DesignDuplicateInput, +) + + +class DuplicateDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + design_duplicate_input: Optional[DesignDuplicateInput] = None, + ): + path = "/v3/designs/{id}" + path = path.format( + id=id, + ) + + data = None + if design_duplicate_input: + data = design_duplicate_input.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/duplicate_pre_built_design.py b/sendgrid/rest/api/mc_designs/v3/duplicate_pre_built_design.py new file mode 100644 index 00000000..2fa8c9c4 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/duplicate_pre_built_design.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_designs.v3.models.design_duplicate_input import ( + DesignDuplicateInput, +) + + +class DuplicatePreBuiltDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + design_duplicate_input: Optional[DesignDuplicateInput] = None, + ): + path = "/v3/designs/pre-builts/{id}" + path = path.format( + id=id, + ) + + data = None + if design_duplicate_input: + data = design_duplicate_input.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/get_design.py b/sendgrid/rest/api/mc_designs/v3/get_design.py new file mode 100644 index 00000000..ce4f947e --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/get_design.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/designs/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/get_pre_built_design.py b/sendgrid/rest/api/mc_designs/v3/get_pre_built_design.py new file mode 100644 index 00000000..0c3acb24 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/get_pre_built_design.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetPreBuiltDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/designs/pre-builts/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/list_design.py b/sendgrid/rest/api/mc_designs/v3/list_design.py new file mode 100644 index 00000000..964f5686 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/list_design.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + summary: Optional[bool] = None, + ): + path = "/v3/designs" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/list_pre_built_design.py b/sendgrid/rest/api/mc_designs/v3/list_pre_built_design.py new file mode 100644 index 00000000..c95e93ae --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/list_pre_built_design.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListPreBuiltDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + summary: Optional[bool] = None, + ): + path = "/v3/designs/pre-builts" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/__init__.py b/sendgrid/rest/api/mc_designs/v3/models/__init__.py new file mode 100644 index 00000000..f2296d61 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/__init__.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_designs.v3.models.api_error import ApiError +from sendgrid.rest.api.mc_designs.v3.models.api_errors import ApiErrors +from sendgrid.rest.api.mc_designs.v3.models.design_common_properties import ( + DesignCommonProperties, +) +from sendgrid.rest.api.mc_designs.v3.models.design_duplicate_input import ( + DesignDuplicateInput, +) +from sendgrid.rest.api.mc_designs.v3.models.design_input import DesignInput +from sendgrid.rest.api.mc_designs.v3.models.design_output import DesignOutput +from sendgrid.rest.api.mc_designs.v3.models.design_output_summary import ( + DesignOutputSummary, +) +from sendgrid.rest.api.mc_designs.v3.models.editor import Editor +from sendgrid.rest.api.mc_designs.v3.models.list_design200_response import ( + ListDesign200Response, +) +from sendgrid.rest.api.mc_designs.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_designs.v3.models.update_design_request import ( + UpdateDesignRequest, +) + +__all__ = [ + "ApiError", + "ApiErrors", + "DesignCommonProperties", + "DesignDuplicateInput", + "DesignInput", + "DesignOutput", + "DesignOutputSummary", + "Editor", + "ListDesign200Response", + "Metadata", + "UpdateDesignRequest", +] +# Testing code diff --git a/sendgrid/rest/api/mc_designs/v3/models/api_error.py b/sendgrid/rest/api/mc_designs/v3/models/api_error.py new file mode 100644 index 00000000..a2700a9f --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/api_error.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ApiError: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + error_id: Optional[str] = None, + ): + self.message = message + self.field = field + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ApiError( + message=payload.get("message"), + field=payload.get("field"), + error_id=payload.get("error_id"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/api_errors.py b/sendgrid/rest/api/mc_designs/v3/models/api_errors.py new file mode 100644 index 00000000..ba00ac23 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/api_errors.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.api_error import ApiError + + +class ApiErrors: + def __init__(self, errors: Optional[List[ApiError]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ApiErrors(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_designs/v3/models/design_common_properties.py b/sendgrid/rest/api/mc_designs/v3/models/design_common_properties.py new file mode 100644 index 00000000..dd5a15e7 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/design_common_properties.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.editor import Editor + + +class DesignCommonProperties: + def __init__( + self, + name: Optional[str] = None, + editor: Optional[Editor] = None, + generate_plain_content: Optional[bool] = None, + subject: Optional[str] = None, + categories: Optional[List[str]] = None, + ): + self.name = name + self.editor = editor + self.generate_plain_content = generate_plain_content + self.subject = subject + self.categories = categories + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "editor": self.editor, + "generate_plain_content": self.generate_plain_content, + "subject": self.subject, + "categories": self.categories, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DesignCommonProperties( + name=payload.get("name"), + editor=payload.get("editor"), + generate_plain_content=payload.get("generate_plain_content"), + subject=payload.get("subject"), + categories=payload.get("categories"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/design_duplicate_input.py b/sendgrid/rest/api/mc_designs/v3/models/design_duplicate_input.py new file mode 100644 index 00000000..422c7bf6 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/design_duplicate_input.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.editor import Editor + + +class DesignDuplicateInput: + def __init__(self, name: Optional[str] = None, editor: Optional[Editor] = None): + self.name = name + self.editor = editor + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "editor": self.editor}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DesignDuplicateInput( + name=payload.get("name"), editor=payload.get("editor") + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/design_input.py b/sendgrid/rest/api/mc_designs/v3/models/design_input.py new file mode 100644 index 00000000..6c020f8e --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/design_input.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.editor import Editor + + +class DesignInput: + def __init__( + self, + name: Optional[str] = None, + editor: Optional[Editor] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + ): + self.name = name + self.editor = editor + self.html_content = html_content + self.plain_content = plain_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "editor": self.editor, + "html_content": self.html_content, + "plain_content": self.plain_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DesignInput( + name=payload.get("name"), + editor=payload.get("editor"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/design_output.py b/sendgrid/rest/api/mc_designs/v3/models/design_output.py new file mode 100644 index 00000000..962b3e97 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/design_output.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.editor import Editor + + +class DesignOutput: + def __init__( + self, + name: Optional[str] = None, + editor: Optional[Editor] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + ): + self.name = name + self.editor = editor + self.html_content = html_content + self.plain_content = plain_content + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "editor": self.editor, + "html_content": self.html_content, + "plain_content": self.plain_content, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DesignOutput( + name=payload.get("name"), + editor=payload.get("editor"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/design_output_summary.py b/sendgrid/rest/api/mc_designs/v3/models/design_output_summary.py new file mode 100644 index 00000000..25cec530 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/design_output_summary.py @@ -0,0 +1,50 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.editor import Editor + + +class DesignOutputSummary: + def __init__( + self, + id: Optional[str] = None, + updated_at: Optional[str] = None, + created_at: Optional[str] = None, + thumbnail_url: Optional[str] = None, + name: Optional[str] = None, + editor: Optional[Editor] = None, + ): + self.id = id + self.updated_at = updated_at + self.created_at = created_at + self.thumbnail_url = thumbnail_url + self.name = name + self.editor = editor + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "updated_at": self.updated_at, + "created_at": self.created_at, + "thumbnail_url": self.thumbnail_url, + "name": self.name, + "editor": self.editor, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DesignOutputSummary( + id=payload.get("id"), + updated_at=payload.get("updated_at"), + created_at=payload.get("created_at"), + thumbnail_url=payload.get("thumbnail_url"), + name=payload.get("name"), + editor=payload.get("editor"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/editor.py b/sendgrid/rest/api/mc_designs/v3/models/editor.py new file mode 100644 index 00000000..47b41f47 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/editor.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Editor(Enum): + CODE = "code" + DESIGN = "design" diff --git a/sendgrid/rest/api/mc_designs/v3/models/list_design200_response.py b/sendgrid/rest/api/mc_designs/v3/models/list_design200_response.py new file mode 100644 index 00000000..a419d02e --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/list_design200_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_designs.v3.models.design_output_summary import ( + DesignOutputSummary, +) +from sendgrid.rest.api.mc_designs.v3.models.metadata import Metadata + + +class ListDesign200Response: + def __init__( + self, + result: Optional[List[DesignOutputSummary]] = None, + metadata: Optional[Metadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListDesign200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/metadata.py b/sendgrid/rest/api/mc_designs/v3/models/metadata.py new file mode 100644 index 00000000..3281a432 --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[int] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/models/update_design_request.py b/sendgrid/rest/api/mc_designs/v3/models/update_design_request.py new file mode 100644 index 00000000..4e21e94f --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/models/update_design_request.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateDesignRequest: + def __init__( + self, + name: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + generate_plain_content: Optional[bool] = None, + subject: Optional[str] = None, + categories: Optional[List[str]] = None, + ): + self.name = name + self.html_content = html_content + self.plain_content = plain_content + self.generate_plain_content = generate_plain_content + self.subject = subject + self.categories = categories + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "html_content": self.html_content, + "plain_content": self.plain_content, + "generate_plain_content": self.generate_plain_content, + "subject": self.subject, + "categories": self.categories, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateDesignRequest( + name=payload.get("name"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + generate_plain_content=payload.get("generate_plain_content"), + subject=payload.get("subject"), + categories=payload.get("categories"), + ) diff --git a/sendgrid/rest/api/mc_designs/v3/update_design.py b/sendgrid/rest/api/mc_designs/v3/update_design.py new file mode 100644 index 00000000..24ba35cf --- /dev/null +++ b/sendgrid/rest/api/mc_designs/v3/update_design.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Designs + The Twilio SendGrid Designs API offers the ability to manage assets stored in the Twilio SendGrid [Design Library](https://mc.sendgrid.com/design-library/my-designs). The Design Library is a feature-rich email layout tool and media repository. You can [build designs for all your marketing email needs](https://sendgrid.com/docs/ui/sending-email/working-with-marketing-campaigns-email-designs/), including Single Sends and Automations. You can also duplicate and then modify one of the pre-built designs provided by Twilio SendGrid to get you started. The Designs API provides a REST-like interface for creating new designs, retrieving a list of existing designs, duplicating or updating a design, and deleting a design. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_designs.v3.models.update_design_request import ( + UpdateDesignRequest, +) + + +class UpdateDesign: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + update_design_request: Optional[UpdateDesignRequest] = None, + ): + path = "/v3/designs/{id}" + path = path.format( + id=id, + ) + + data = None + if update_design_request: + data = update_design_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/__init__.py b/sendgrid/rest/api/mc_lists/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_lists/v3/create_marketing_list.py b/sendgrid/rest/api/mc_lists/v3/create_marketing_list.py new file mode 100644 index 00000000..bbc1f792 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/create_marketing_list.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_lists.v3.models.create_marketing_list_request import ( + CreateMarketingListRequest, +) + + +class CreateMarketingList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + create_marketing_list_request: Optional[CreateMarketingListRequest] = None, + ): + path = "/v3/marketing/lists" + + data = None + if create_marketing_list_request: + data = create_marketing_list_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/delete_contact.py b/sendgrid/rest/api/mc_lists/v3/delete_contact.py new file mode 100644 index 00000000..a627063d --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/delete_contact.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteContact: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + contact_ids: Optional[str] = None, + ): + path = "/v3/marketing/lists/{id}/contacts" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/delete_marketing_list.py b/sendgrid/rest/api/mc_lists/v3/delete_marketing_list.py new file mode 100644 index 00000000..1c1ff3bd --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/delete_marketing_list.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteMarketingList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + delete_contacts: Optional[bool] = None, + ): + path = "/v3/marketing/lists/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/get_marketing_list.py b/sendgrid/rest/api/mc_lists/v3/get_marketing_list.py new file mode 100644 index 00000000..c6f8c9ee --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/get_marketing_list.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetMarketingList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + contact_sample: Optional[bool] = None, + ): + path = "/v3/marketing/lists/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/list_contact_count.py b/sendgrid/rest/api/mc_lists/v3/list_contact_count.py new file mode 100644 index 00000000..c42ca449 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/list_contact_count.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListContactCount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/lists/{id}/contacts/count" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/list_marketing_list.py b/sendgrid/rest/api/mc_lists/v3/list_marketing_list.py new file mode 100644 index 00000000..7b2232b1 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/list_marketing_list.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListMarketingList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + page_size: Optional[float] = None, + page_token: Optional[str] = None, + ): + path = "/v3/marketing/lists" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/__init__.py b/sendgrid/rest/api/mc_lists/v3/models/__init__.py new file mode 100644 index 00000000..3d56217c --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/__init__.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_lists.v3.models.contact_details import ContactDetails +from sendgrid.rest.api.mc_lists.v3.models.create_marketing_list400_response import ( + CreateMarketingList400Response, +) +from sendgrid.rest.api.mc_lists.v3.models.create_marketing_list_request import ( + CreateMarketingListRequest, +) +from sendgrid.rest.api.mc_lists.v3.models.delete_contact202_response import ( + DeleteContact202Response, +) +from sendgrid.rest.api.mc_lists.v3.models.delete_marketing_list200_response import ( + DeleteMarketingList200Response, +) +from sendgrid.rest.api.mc_lists.v3.models.delete_marketing_list404_response import ( + DeleteMarketingList404Response, +) +from sendgrid.rest.api.mc_lists.v3.models.error import Error +from sendgrid.rest.api.mc_lists.v3.models.get_marketing_list200_response import ( + GetMarketingList200Response, +) +from sendgrid.rest.api.mc_lists.v3.models.list import List +from sendgrid.rest.api.mc_lists.v3.models.list_contact_count200_response import ( + ListContactCount200Response, +) +from sendgrid.rest.api.mc_lists.v3.models.list_marketing_list200_response import ( + ListMarketingList200Response, +) +from sendgrid.rest.api.mc_lists.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_lists.v3.models.self_metadata import SelfMetadata +from sendgrid.rest.api.mc_lists.v3.models.update_marketing_list_request import ( + UpdateMarketingListRequest, +) + +__all__ = [ + "ContactDetails", + "CreateMarketingList400Response", + "CreateMarketingListRequest", + "DeleteContact202Response", + "DeleteMarketingList200Response", + "DeleteMarketingList404Response", + "Error", + "GetMarketingList200Response", + "List", + "ListContactCount200Response", + "ListMarketingList200Response", + "Metadata", + "SelfMetadata", + "UpdateMarketingListRequest", +] +# Testing code diff --git a/sendgrid/rest/api/mc_lists/v3/models/contact_details.py b/sendgrid/rest/api/mc_lists/v3/models/contact_details.py new file mode 100644 index 00000000..7ee28daf --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/contact_details.py @@ -0,0 +1,126 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_lists.v3.models.self_metadata import SelfMetadata + + +class ContactDetails: + def __init__( + self, + id: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + unique_name: Optional[str] = None, + email: Optional[str] = None, + phone_number_id: Optional[str] = None, + external_id: Optional[str] = None, + anonymous_id: Optional[str] = None, + alternate_emails: Optional[List[str]] = None, + address_line_1: Optional[str] = None, + address_line_2: Optional[str] = None, + city: Optional[str] = None, + state_province_region: Optional[str] = None, + country: Optional[str] = None, + postal_code: Optional[str] = None, + phone_number: Optional[str] = None, + whatsapp: Optional[str] = None, + line: Optional[str] = None, + facebook: Optional[str] = None, + list_ids: Optional[List[str]] = None, + segment_ids: Optional[List[str]] = None, + custom_fields: Optional[object] = None, + created_at: Optional[datetime] = None, + updated_at: Optional[datetime] = None, + metadata: Optional[SelfMetadata] = None, + ): + self.id = id + self.first_name = first_name + self.last_name = last_name + self.unique_name = unique_name + self.email = email + self.phone_number_id = phone_number_id + self.external_id = external_id + self.anonymous_id = anonymous_id + self.alternate_emails = alternate_emails + self.address_line_1 = address_line_1 + self.address_line_2 = address_line_2 + self.city = city + self.state_province_region = state_province_region + self.country = country + self.postal_code = postal_code + self.phone_number = phone_number + self.whatsapp = whatsapp + self.line = line + self.facebook = facebook + self.list_ids = list_ids + self.segment_ids = segment_ids + self.custom_fields = custom_fields + self.created_at = created_at + self.updated_at = updated_at + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "first_name": self.first_name, + "last_name": self.last_name, + "unique_name": self.unique_name, + "email": self.email, + "phone_number_id": self.phone_number_id, + "external_id": self.external_id, + "anonymous_id": self.anonymous_id, + "alternate_emails": self.alternate_emails, + "address_line_1": self.address_line_1, + "address_line_2": self.address_line_2, + "city": self.city, + "state_province_region": self.state_province_region, + "country": self.country, + "postal_code": self.postal_code, + "phone_number": self.phone_number, + "whatsapp": self.whatsapp, + "line": self.line, + "facebook": self.facebook, + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "custom_fields": self.custom_fields, + "created_at": self.created_at, + "updated_at": self.updated_at, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactDetails( + id=payload.get("id"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + unique_name=payload.get("unique_name"), + email=payload.get("email"), + phone_number_id=payload.get("phone_number_id"), + external_id=payload.get("external_id"), + anonymous_id=payload.get("anonymous_id"), + alternate_emails=payload.get("alternate_emails"), + address_line_1=payload.get("address_line_1"), + address_line_2=payload.get("address_line_2"), + city=payload.get("city"), + state_province_region=payload.get("state_province_region"), + country=payload.get("country"), + postal_code=payload.get("postal_code"), + phone_number=payload.get("phone_number"), + whatsapp=payload.get("whatsapp"), + line=payload.get("line"), + facebook=payload.get("facebook"), + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + custom_fields=payload.get("custom_fields"), + created_at=payload.get("created_at"), + updated_at=payload.get("updated_at"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/create_marketing_list400_response.py b/sendgrid/rest/api/mc_lists/v3/models/create_marketing_list400_response.py new file mode 100644 index 00000000..dd97f4a7 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/create_marketing_list400_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_lists.v3.models.error import Error + + +class CreateMarketingList400Response: + def __init__(self, errors: Optional[List[Error]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateMarketingList400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_lists/v3/models/create_marketing_list_request.py b/sendgrid/rest/api/mc_lists/v3/models/create_marketing_list_request.py new file mode 100644 index 00000000..e25ac033 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/create_marketing_list_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateMarketingListRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateMarketingListRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/mc_lists/v3/models/delete_contact202_response.py b/sendgrid/rest/api/mc_lists/v3/models/delete_contact202_response.py new file mode 100644 index 00000000..fd792d1c --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/delete_contact202_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteContact202Response: + def __init__(self, job_id: Optional[str] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteContact202Response(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list200_response.py b/sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list200_response.py new file mode 100644 index 00000000..78cc1582 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteMarketingList200Response: + def __init__(self, job_id: Optional[str] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteMarketingList200Response(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list404_response.py b/sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list404_response.py new file mode 100644 index 00000000..1010c35a --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/delete_marketing_list404_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteMarketingList404Response: + def __init__(self, errors: Optional[List[object]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteMarketingList404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_lists/v3/models/error.py b/sendgrid/rest/api/mc_lists/v3/models/error.py new file mode 100644 index 00000000..2601be0c --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/error.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Error: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + error_id: Optional[str] = None, + parameter: Optional[str] = None, + ): + self.message = message + self.field = field + self.error_id = error_id + self.parameter = parameter + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "error_id": self.error_id, + "parameter": self.parameter, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Error( + message=payload.get("message"), + field=payload.get("field"), + error_id=payload.get("error_id"), + parameter=payload.get("parameter"), + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/get_marketing_list200_response.py b/sendgrid/rest/api/mc_lists/v3/models/get_marketing_list200_response.py new file mode 100644 index 00000000..9a5c97d4 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/get_marketing_list200_response.py @@ -0,0 +1,47 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_lists.v3.models.contact_details import ContactDetails +from sendgrid.rest.api.mc_lists.v3.models.self_metadata import SelfMetadata + + +class GetMarketingList200Response: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + contact_count: Optional[int] = None, + metadata: Optional[SelfMetadata] = None, + contact_sample: Optional[ContactDetails] = None, + ): + self.id = id + self.name = name + self.contact_count = contact_count + self.metadata = metadata + self.contact_sample = contact_sample + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "contact_count": self.contact_count, + "_metadata": self.metadata, + "contact_sample": self.contact_sample, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetMarketingList200Response( + id=payload.get("id"), + name=payload.get("name"), + contact_count=payload.get("contact_count"), + metadata=payload.get("_metadata"), + contact_sample=payload.get("contact_sample"), + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/list.py b/sendgrid/rest/api/mc_lists/v3/models/list.py new file mode 100644 index 00000000..78259244 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/list.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_lists.v3.models.self_metadata import SelfMetadata + + +class List: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + contact_count: Optional[int] = None, + metadata: Optional[SelfMetadata] = None, + ): + self.id = id + self.name = name + self.contact_count = contact_count + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "contact_count": self.contact_count, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return List( + id=payload.get("id"), + name=payload.get("name"), + contact_count=payload.get("contact_count"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/list_contact_count200_response.py b/sendgrid/rest/api/mc_lists/v3/models/list_contact_count200_response.py new file mode 100644 index 00000000..b7bb2a00 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/list_contact_count200_response.py @@ -0,0 +1,31 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListContactCount200Response: + def __init__( + self, contact_count: Optional[int] = None, billable_count: Optional[int] = None + ): + self.contact_count = contact_count + self.billable_count = billable_count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "contact_count": self.contact_count, + "billable_count": self.billable_count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListContactCount200Response( + contact_count=payload.get("contact_count"), + billable_count=payload.get("billable_count"), + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/list_marketing_list200_response.py b/sendgrid/rest/api/mc_lists/v3/models/list_marketing_list200_response.py new file mode 100644 index 00000000..6d6c9dbf --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/list_marketing_list200_response.py @@ -0,0 +1,31 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_lists.v3.models.metadata import Metadata + + +class ListMarketingList200Response: + def __init__( + self, result: Optional[List[List]] = None, metadata: Optional[Metadata] = None + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMarketingList200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/metadata.py b/sendgrid/rest/api/mc_lists/v3/models/metadata.py new file mode 100644 index 00000000..2d7bf72c --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[float] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_lists/v3/models/self_metadata.py b/sendgrid/rest/api/mc_lists/v3/models/self_metadata.py new file mode 100644 index 00000000..448cb9b0 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/self_metadata.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SelfMetadata: + def __init__(self, var_self: Optional[str] = None): + self.var_self = var_self + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"self": self.var_self}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SelfMetadata(var_self=payload.get("self")) diff --git a/sendgrid/rest/api/mc_lists/v3/models/update_marketing_list_request.py b/sendgrid/rest/api/mc_lists/v3/models/update_marketing_list_request.py new file mode 100644 index 00000000..91e940b0 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/models/update_marketing_list_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateMarketingListRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateMarketingListRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/mc_lists/v3/update_marketing_list.py b/sendgrid/rest/api/mc_lists/v3/update_marketing_list.py new file mode 100644 index 00000000..5fcc29e0 --- /dev/null +++ b/sendgrid/rest/api/mc_lists/v3/update_marketing_list.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Lists API + The Twilio SendGrid Marketing Campaigns Lists API allows you to manage your contacts lists programmatically. Lists are static collections of Marketing Campaigns contacts. You can use this API to interact with the list objects themselves. To add contacts to a list, you must use the [Contacts API](https://docs.sendgrid.com/api-reference/contacts/). You can also manage your lists using the Contacts menu in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). For more information about lists and best practices for building them, see [**Building your Contact Lists**](https://sendgrid.com/docs/ui/managing-contacts/building-your-contact-list/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_lists.v3.models.update_marketing_list_request import ( + UpdateMarketingListRequest, +) + + +class UpdateMarketingList: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + update_marketing_list_request: Optional[UpdateMarketingListRequest] = None, + ): + path = "/v3/marketing/lists/{id}" + path = path.format( + id=id, + ) + + data = None + if update_marketing_list_request: + data = update_marketing_list_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments/v3/__init__.py b/sendgrid/rest/api/mc_segments/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_segments/v3/delete_segment.py b/sendgrid/rest/api/mc_segments/v3/delete_segment.py new file mode 100644 index 00000000..63a8afd9 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/delete_segment.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments API + This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: str, + ): + path = "/v3/marketing/segments/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments/v3/get_segment.py b/sendgrid/rest/api/mc_segments/v3/get_segment.py new file mode 100644 index 00000000..37dd261f --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/get_segment.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments API + This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: str, + query_json: Optional[bool] = None, + ): + path = "/v3/marketing/segments/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments/v3/list_segment.py b/sendgrid/rest/api/mc_segments/v3/list_segment.py new file mode 100644 index 00000000..f2f7b124 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/list_segment.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments API + This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class ListSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ids: Optional[List[str]] = None, + parent_list_ids: Optional[str] = None, + no_parent_list_id: Optional[bool] = None, + ): + path = "/v3/marketing/segments" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/__init__.py b/sendgrid/rest/api/mc_segments/v3/models/__init__.py new file mode 100644 index 00000000..34462b2f --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/__init__.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments API + This API was deprecated on December 31, 2022. Following deprecation, all segments created in the Marketing Campaigns user interface began using the [Segmentation v2 API](https://docs.sendgrid.com/api-reference/segmenting-contacts-v2). To enable manual migration and data retrieval, this API's GET and DELETE operations will remain available. The POST (create) and PATCH (update) endpoints were removed on January 31, 2023 because it is no longer possible to create new v1 segments or modify existing ones. See our [Segmentation v1 to v2 upgrade instructions](https://docs.sendgrid.com/for-developers/sending-email/getting-started-the-marketing-campaigns-v2-segmentation-api#upgrade-a-v1-segment-to-v2) to manually migrate your segments to the v2 API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_segments.v3.models.contact_response import ContactResponse +from sendgrid.rest.api.mc_segments.v3.models.contact_response_custom_fields import ( + ContactResponseCustomFields, +) +from sendgrid.rest.api.mc_segments.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.mc_segments.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.mc_segments.v3.models.full_segment import FullSegment +from sendgrid.rest.api.mc_segments.v3.models.get_segment404_response import ( + GetSegment404Response, +) +from sendgrid.rest.api.mc_segments.v3.models.get_segment404_response_errors_inner import ( + GetSegment404ResponseErrorsInner, +) +from sendgrid.rest.api.mc_segments.v3.models.list_segment200_response import ( + ListSegment200Response, +) +from sendgrid.rest.api.mc_segments.v3.models.list_segment500_response import ( + ListSegment500Response, +) +from sendgrid.rest.api.mc_segments.v3.models.list_segment500_response_errors_inner import ( + ListSegment500ResponseErrorsInner, +) +from sendgrid.rest.api.mc_segments.v3.models.segment_summary import SegmentSummary +from sendgrid.rest.api.mc_segments.v3.models.segment_write_v2 import SegmentWriteV2 + +__all__ = [ + "ContactResponse", + "ContactResponseCustomFields", + "ErrorResponse", + "ErrorResponseErrorsInner", + "FullSegment", + "GetSegment404Response", + "GetSegment404ResponseErrorsInner", + "ListSegment200Response", + "ListSegment500Response", + "ListSegment500ResponseErrorsInner", + "SegmentSummary", + "SegmentWriteV2", +] +# Testing code diff --git a/sendgrid/rest/api/mc_segments/v3/models/contact_response.py b/sendgrid/rest/api/mc_segments/v3/models/contact_response.py new file mode 100644 index 00000000..6de8877f --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/contact_response.py @@ -0,0 +1,96 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments.v3.models.contact_response_custom_fields import ( + ContactResponseCustomFields, +) + + +class ContactResponse: + def __init__( + self, + id: Optional[str] = None, + email: Optional[str] = None, + phone_number_id: Optional[str] = None, + external_id: Optional[str] = None, + anonymous_id: Optional[str] = None, + alternate_emails: Optional[List[str]] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + address_line_1: Optional[str] = None, + address_line_2: Optional[str] = None, + city: Optional[str] = None, + state_province_region: Optional[str] = None, + postal_code: Optional[int] = None, + country: Optional[str] = None, + list_ids: Optional[List[str]] = None, + custom_fields: Optional[ContactResponseCustomFields] = None, + segment_ids: Optional[List[str]] = None, + ): + self.id = id + self.email = email + self.phone_number_id = phone_number_id + self.external_id = external_id + self.anonymous_id = anonymous_id + self.alternate_emails = alternate_emails + self.first_name = first_name + self.last_name = last_name + self.address_line_1 = address_line_1 + self.address_line_2 = address_line_2 + self.city = city + self.state_province_region = state_province_region + self.postal_code = postal_code + self.country = country + self.list_ids = list_ids + self.custom_fields = custom_fields + self.segment_ids = segment_ids + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "email": self.email, + "phone_number_id": self.phone_number_id, + "external_id": self.external_id, + "anonymous_id": self.anonymous_id, + "alternate_emails": self.alternate_emails, + "first_name": self.first_name, + "last_name": self.last_name, + "address_line_1": self.address_line_1, + "address_line_2": self.address_line_2, + "city": self.city, + "state_province_region": self.state_province_region, + "postal_code": self.postal_code, + "country": self.country, + "list_ids": self.list_ids, + "custom_fields": self.custom_fields, + "segment_ids": self.segment_ids, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactResponse( + id=payload.get("id"), + email=payload.get("email"), + phone_number_id=payload.get("phone_number_id"), + external_id=payload.get("external_id"), + anonymous_id=payload.get("anonymous_id"), + alternate_emails=payload.get("alternate_emails"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + address_line_1=payload.get("address_line_1"), + address_line_2=payload.get("address_line_2"), + city=payload.get("city"), + state_province_region=payload.get("state_province_region"), + postal_code=payload.get("postal_code"), + country=payload.get("country"), + list_ids=payload.get("list_ids"), + custom_fields=payload.get("custom_fields"), + segment_ids=payload.get("segment_ids"), + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/contact_response_custom_fields.py b/sendgrid/rest/api/mc_segments/v3/models/contact_response_custom_fields.py new file mode 100644 index 00000000..bd130acd --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/contact_response_custom_fields.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactResponseCustomFields: + def __init__( + self, + custom_field_name1: Optional[str] = None, + custom_field_name2: Optional[str] = None, + ): + self.custom_field_name1 = custom_field_name1 + self.custom_field_name2 = custom_field_name2 + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "custom_field_name1": self.custom_field_name1, + "custom_field_name2": self.custom_field_name2, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactResponseCustomFields( + custom_field_name1=payload.get("custom_field_name1"), + custom_field_name2=payload.get("custom_field_name2"), + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/error_response.py b/sendgrid/rest/api/mc_segments/v3/models/error_response.py new file mode 100644 index 00000000..23acd507 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/mc_segments/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/mc_segments/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/full_segment.py b/sendgrid/rest/api/mc_segments/v3/models/full_segment.py new file mode 100644 index 00000000..95d6aec0 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/full_segment.py @@ -0,0 +1,74 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments.v3.models.contact_response import ContactResponse + + +class FullSegment: + def __init__( + self, + id: Optional[str] = None, + contacts_count: Optional[int] = None, + created_at: Optional[datetime] = None, + name: Optional[str] = None, + parent_list_id: Optional[str] = None, + sample_updated_at: Optional[datetime] = None, + updated_at: Optional[datetime] = None, + next_sample_update: Optional[str] = None, + contacts_sample: Optional[List[ContactResponse]] = None, + query_json: Optional[object] = None, + parent_list_ids: Optional[List[str]] = None, + query_dsl: Optional[str] = None, + ): + self.id = id + self.contacts_count = contacts_count + self.created_at = created_at + self.name = name + self.parent_list_id = parent_list_id + self.sample_updated_at = sample_updated_at + self.updated_at = updated_at + self.next_sample_update = next_sample_update + self.contacts_sample = contacts_sample + self.query_json = query_json + self.parent_list_ids = parent_list_ids + self.query_dsl = query_dsl + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "contacts_count": self.contacts_count, + "created_at": self.created_at, + "name": self.name, + "parent_list_id": self.parent_list_id, + "sample_updated_at": self.sample_updated_at, + "updated_at": self.updated_at, + "next_sample_update": self.next_sample_update, + "contacts_sample": self.contacts_sample, + "query_json": self.query_json, + "parent_list_ids": self.parent_list_ids, + "query_dsl": self.query_dsl, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return FullSegment( + id=payload.get("id"), + contacts_count=payload.get("contacts_count"), + created_at=payload.get("created_at"), + name=payload.get("name"), + parent_list_id=payload.get("parent_list_id"), + sample_updated_at=payload.get("sample_updated_at"), + updated_at=payload.get("updated_at"), + next_sample_update=payload.get("next_sample_update"), + contacts_sample=payload.get("contacts_sample"), + query_json=payload.get("query_json"), + parent_list_ids=payload.get("parent_list_ids"), + query_dsl=payload.get("query_dsl"), + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/get_segment404_response.py b/sendgrid/rest/api/mc_segments/v3/models/get_segment404_response.py new file mode 100644 index 00000000..10e2435c --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/get_segment404_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments.v3.models.get_segment404_response_errors_inner import ( + GetSegment404ResponseErrorsInner, +) + + +class GetSegment404Response: + def __init__(self, errors: Optional[List[GetSegment404ResponseErrorsInner]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSegment404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_segments/v3/models/get_segment404_response_errors_inner.py b/sendgrid/rest/api/mc_segments/v3/models/get_segment404_response_errors_inner.py new file mode 100644 index 00000000..4a27e1a0 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/get_segment404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetSegment404ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSegment404ResponseErrorsInner( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/list_segment200_response.py b/sendgrid/rest/api/mc_segments/v3/models/list_segment200_response.py new file mode 100644 index 00000000..33a8c24a --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/list_segment200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments.v3.models.segment_summary import SegmentSummary + + +class ListSegment200Response: + def __init__(self, results: Optional[List[SegmentSummary]] = None): + self.results = results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"results": self.results}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSegment200Response(results=payload.get("results")) diff --git a/sendgrid/rest/api/mc_segments/v3/models/list_segment500_response.py b/sendgrid/rest/api/mc_segments/v3/models/list_segment500_response.py new file mode 100644 index 00000000..c4b07c8e --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/list_segment500_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments.v3.models.list_segment500_response_errors_inner import ( + ListSegment500ResponseErrorsInner, +) + + +class ListSegment500Response: + def __init__( + self, errors: Optional[List[ListSegment500ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSegment500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_segments/v3/models/list_segment500_response_errors_inner.py b/sendgrid/rest/api/mc_segments/v3/models/list_segment500_response_errors_inner.py new file mode 100644 index 00000000..293478ac --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/list_segment500_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListSegment500ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSegment500ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/mc_segments/v3/models/segment_summary.py b/sendgrid/rest/api/mc_segments/v3/models/segment_summary.py new file mode 100644 index 00000000..b531df80 --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/segment_summary.py @@ -0,0 +1,57 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentSummary: + def __init__( + self, + id: Optional[str] = None, + contacts_count: Optional[int] = None, + created_at: Optional[datetime] = None, + name: Optional[str] = None, + parent_list_id: Optional[str] = None, + sample_updated_at: Optional[datetime] = None, + updated_at: Optional[datetime] = None, + next_sample_update: Optional[str] = None, + ): + self.id = id + self.contacts_count = contacts_count + self.created_at = created_at + self.name = name + self.parent_list_id = parent_list_id + self.sample_updated_at = sample_updated_at + self.updated_at = updated_at + self.next_sample_update = next_sample_update + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "contacts_count": self.contacts_count, + "created_at": self.created_at, + "name": self.name, + "parent_list_id": self.parent_list_id, + "sample_updated_at": self.sample_updated_at, + "updated_at": self.updated_at, + "next_sample_update": self.next_sample_update, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentSummary( + id=payload.get("id"), + contacts_count=payload.get("contacts_count"), + created_at=payload.get("created_at"), + name=payload.get("name"), + parent_list_id=payload.get("parent_list_id"), + sample_updated_at=payload.get("sample_updated_at"), + updated_at=payload.get("updated_at"), + next_sample_update=payload.get("next_sample_update"), + ) diff --git a/sendgrid/rest/api/mc_segments/v3/models/segment_write_v2.py b/sendgrid/rest/api/mc_segments/v3/models/segment_write_v2.py new file mode 100644 index 00000000..1faaa3cd --- /dev/null +++ b/sendgrid/rest/api/mc_segments/v3/models/segment_write_v2.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentWriteV2: + def __init__( + self, + name: Optional[str] = None, + parent_list_ids: Optional[List[str]] = None, + query_dsl: Optional[str] = None, + ): + self.name = name + self.parent_list_ids = parent_list_ids + self.query_dsl = query_dsl + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "parent_list_ids": self.parent_list_ids, + "query_dsl": self.query_dsl, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentWriteV2( + name=payload.get("name"), + parent_list_ids=payload.get("parent_list_ids"), + query_dsl=payload.get("query_dsl"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/__init__.py b/sendgrid/rest/api/mc_segments_2/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_segments_2/v3/create_segment.py b/sendgrid/rest/api/mc_segments_2/v3/create_segment.py new file mode 100644 index 00000000..ea8b3561 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/create_segment.py @@ -0,0 +1,55 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_segments_2.v3.models.segment_write_v2 import SegmentWriteV2 + + +class CreateSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_write_v2: Optional[SegmentWriteV2] = None, + ): + path = "/v3/marketing/segments/2.0" + + data = None + if segment_write_v2: + data = segment_write_v2.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/delete_segment.py b/sendgrid/rest/api/mc_segments_2/v3/delete_segment.py new file mode 100644 index 00000000..02a548b6 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/delete_segment.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: str, + ): + path = "/v3/marketing/segments/2.0/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/get_segment.py b/sendgrid/rest/api/mc_segments_2/v3/get_segment.py new file mode 100644 index 00000000..6a831682 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/get_segment.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: str, + contacts_sample: Optional[bool] = None, + ): + path = "/v3/marketing/segments/2.0/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/list_segment.py b/sendgrid/rest/api/mc_segments_2/v3/list_segment.py new file mode 100644 index 00000000..10a1b15d --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/list_segment.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class ListSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ids: Optional[List[str]] = None, + parent_list_ids: Optional[str] = None, + no_parent_list_id: Optional[bool] = None, + ): + path = "/v3/marketing/segments/2.0" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/__init__.py b/sendgrid/rest/api/mc_segments_2/v3/models/__init__.py new file mode 100644 index 00000000..800b8bbf --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/__init__.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_segments_2.v3.models.all_segments200 import AllSegments200 +from sendgrid.rest.api.mc_segments_2.v3.models.contact_response import ContactResponse +from sendgrid.rest.api.mc_segments_2.v3.models.contact_response_custom_fields import ( + ContactResponseCustomFields, +) +from sendgrid.rest.api.mc_segments_2.v3.models.errors_segment_v2 import ErrorsSegmentV2 +from sendgrid.rest.api.mc_segments_2.v3.models.errors_segment_v2_errors_inner import ( + ErrorsSegmentV2ErrorsInner, +) +from sendgrid.rest.api.mc_segments_2.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_segments_2.v3.models.segment2xx import Segment2xx +from sendgrid.rest.api.mc_segments_2.v3.models.segment_error import SegmentError +from sendgrid.rest.api.mc_segments_2.v3.models.segment_refresh202 import ( + SegmentRefresh202, +) +from sendgrid.rest.api.mc_segments_2.v3.models.segment_refresh_request import ( + SegmentRefreshRequest, +) +from sendgrid.rest.api.mc_segments_2.v3.models.segment_status_response import ( + SegmentStatusResponse, +) +from sendgrid.rest.api.mc_segments_2.v3.models.segment_update import SegmentUpdate +from sendgrid.rest.api.mc_segments_2.v3.models.segment_write_v2 import SegmentWriteV2 + +__all__ = [ + "AllSegments200", + "ContactResponse", + "ContactResponseCustomFields", + "ErrorsSegmentV2", + "ErrorsSegmentV2ErrorsInner", + "Metadata", + "Segment2xx", + "SegmentError", + "SegmentRefresh202", + "SegmentRefreshRequest", + "SegmentStatusResponse", + "SegmentUpdate", + "SegmentWriteV2", +] +# Testing code diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/all_segments200.py b/sendgrid/rest/api/mc_segments_2/v3/models/all_segments200.py new file mode 100644 index 00000000..d2d859e6 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/all_segments200.py @@ -0,0 +1,73 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments_2.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_segments_2.v3.models.segment_status_response import ( + SegmentStatusResponse, +) + + +class AllSegments200: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + contacts_count: Optional[int] = None, + created_at: Optional[str] = None, + updated_at: Optional[str] = None, + sample_updated_at: Optional[str] = None, + next_sample_update: Optional[str] = None, + parent_list_ids: Optional[List[str]] = None, + query_version: Optional[str] = None, + metadata: Optional[Metadata] = None, + status: Optional[SegmentStatusResponse] = None, + ): + self.id = id + self.name = name + self.contacts_count = contacts_count + self.created_at = created_at + self.updated_at = updated_at + self.sample_updated_at = sample_updated_at + self.next_sample_update = next_sample_update + self.parent_list_ids = parent_list_ids + self.query_version = query_version + self.metadata = metadata + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "contacts_count": self.contacts_count, + "created_at": self.created_at, + "updated_at": self.updated_at, + "sample_updated_at": self.sample_updated_at, + "next_sample_update": self.next_sample_update, + "parent_list_ids": self.parent_list_ids, + "query_version": self.query_version, + "_metadata": self.metadata, + "status": self.status, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AllSegments200( + id=payload.get("id"), + name=payload.get("name"), + contacts_count=payload.get("contacts_count"), + created_at=payload.get("created_at"), + updated_at=payload.get("updated_at"), + sample_updated_at=payload.get("sample_updated_at"), + next_sample_update=payload.get("next_sample_update"), + parent_list_ids=payload.get("parent_list_ids"), + query_version=payload.get("query_version"), + metadata=payload.get("_metadata"), + status=payload.get("status"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/contact_response.py b/sendgrid/rest/api/mc_segments_2/v3/models/contact_response.py new file mode 100644 index 00000000..58158afc --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/contact_response.py @@ -0,0 +1,96 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments_2.v3.models.contact_response_custom_fields import ( + ContactResponseCustomFields, +) + + +class ContactResponse: + def __init__( + self, + id: Optional[str] = None, + email: Optional[str] = None, + phone_number_id: Optional[str] = None, + external_id: Optional[str] = None, + anonymous_id: Optional[str] = None, + alternate_emails: Optional[List[str]] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + address_line_1: Optional[str] = None, + address_line_2: Optional[str] = None, + city: Optional[str] = None, + state_province_region: Optional[str] = None, + postal_code: Optional[int] = None, + country: Optional[str] = None, + list_ids: Optional[List[str]] = None, + custom_fields: Optional[ContactResponseCustomFields] = None, + segment_ids: Optional[List[str]] = None, + ): + self.id = id + self.email = email + self.phone_number_id = phone_number_id + self.external_id = external_id + self.anonymous_id = anonymous_id + self.alternate_emails = alternate_emails + self.first_name = first_name + self.last_name = last_name + self.address_line_1 = address_line_1 + self.address_line_2 = address_line_2 + self.city = city + self.state_province_region = state_province_region + self.postal_code = postal_code + self.country = country + self.list_ids = list_ids + self.custom_fields = custom_fields + self.segment_ids = segment_ids + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "email": self.email, + "phone_number_id": self.phone_number_id, + "external_id": self.external_id, + "anonymous_id": self.anonymous_id, + "alternate_emails": self.alternate_emails, + "first_name": self.first_name, + "last_name": self.last_name, + "address_line_1": self.address_line_1, + "address_line_2": self.address_line_2, + "city": self.city, + "state_province_region": self.state_province_region, + "postal_code": self.postal_code, + "country": self.country, + "list_ids": self.list_ids, + "custom_fields": self.custom_fields, + "segment_ids": self.segment_ids, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactResponse( + id=payload.get("id"), + email=payload.get("email"), + phone_number_id=payload.get("phone_number_id"), + external_id=payload.get("external_id"), + anonymous_id=payload.get("anonymous_id"), + alternate_emails=payload.get("alternate_emails"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + address_line_1=payload.get("address_line_1"), + address_line_2=payload.get("address_line_2"), + city=payload.get("city"), + state_province_region=payload.get("state_province_region"), + postal_code=payload.get("postal_code"), + country=payload.get("country"), + list_ids=payload.get("list_ids"), + custom_fields=payload.get("custom_fields"), + segment_ids=payload.get("segment_ids"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/contact_response_custom_fields.py b/sendgrid/rest/api/mc_segments_2/v3/models/contact_response_custom_fields.py new file mode 100644 index 00000000..bd130acd --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/contact_response_custom_fields.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ContactResponseCustomFields: + def __init__( + self, + custom_field_name1: Optional[str] = None, + custom_field_name2: Optional[str] = None, + ): + self.custom_field_name1 = custom_field_name1 + self.custom_field_name2 = custom_field_name2 + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "custom_field_name1": self.custom_field_name1, + "custom_field_name2": self.custom_field_name2, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ContactResponseCustomFields( + custom_field_name1=payload.get("custom_field_name1"), + custom_field_name2=payload.get("custom_field_name2"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2.py b/sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2.py new file mode 100644 index 00000000..d71c9acf --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments_2.v3.models.errors_segment_v2_errors_inner import ( + ErrorsSegmentV2ErrorsInner, +) + + +class ErrorsSegmentV2: + def __init__(self, errors: Optional[List[ErrorsSegmentV2ErrorsInner]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorsSegmentV2(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2_errors_inner.py b/sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2_errors_inner.py new file mode 100644 index 00000000..685306b0 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/errors_segment_v2_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorsSegmentV2ErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorsSegmentV2ErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/metadata.py b/sendgrid/rest/api/mc_segments_2/v3/models/metadata.py new file mode 100644 index 00000000..3281a432 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[int] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment2xx.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment2xx.py new file mode 100644 index 00000000..549068c5 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment2xx.py @@ -0,0 +1,89 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_segments_2.v3.models.contact_response import ContactResponse +from sendgrid.rest.api.mc_segments_2.v3.models.segment_status_response import ( + SegmentStatusResponse, +) + + +class Segment2xx: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + query_dsl: Optional[str] = None, + contacts_count: Optional[int] = None, + contacts_sample: Optional[List[ContactResponse]] = None, + created_at: Optional[str] = None, + updated_at: Optional[str] = None, + sample_updated_at: Optional[str] = None, + next_sample_update: Optional[str] = None, + parent_list_ids: Optional[List[str]] = None, + query_version: Optional[str] = None, + status: Optional[SegmentStatusResponse] = None, + refreshes_used: Optional[int] = None, + max_refreshes: Optional[int] = None, + last_refreshed_at: Optional[str] = None, + ): + self.id = id + self.name = name + self.query_dsl = query_dsl + self.contacts_count = contacts_count + self.contacts_sample = contacts_sample + self.created_at = created_at + self.updated_at = updated_at + self.sample_updated_at = sample_updated_at + self.next_sample_update = next_sample_update + self.parent_list_ids = parent_list_ids + self.query_version = query_version + self.status = status + self.refreshes_used = refreshes_used + self.max_refreshes = max_refreshes + self.last_refreshed_at = last_refreshed_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "query_dsl": self.query_dsl, + "contacts_count": self.contacts_count, + "contacts_sample": self.contacts_sample, + "created_at": self.created_at, + "updated_at": self.updated_at, + "sample_updated_at": self.sample_updated_at, + "next_sample_update": self.next_sample_update, + "parent_list_ids": self.parent_list_ids, + "query_version": self.query_version, + "status": self.status, + "refreshes_used": self.refreshes_used, + "max_refreshes": self.max_refreshes, + "last_refreshed_at": self.last_refreshed_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Segment2xx( + id=payload.get("id"), + name=payload.get("name"), + query_dsl=payload.get("query_dsl"), + contacts_count=payload.get("contacts_count"), + contacts_sample=payload.get("contacts_sample"), + created_at=payload.get("created_at"), + updated_at=payload.get("updated_at"), + sample_updated_at=payload.get("sample_updated_at"), + next_sample_update=payload.get("next_sample_update"), + parent_list_ids=payload.get("parent_list_ids"), + query_version=payload.get("query_version"), + status=payload.get("status"), + refreshes_used=payload.get("refreshes_used"), + max_refreshes=payload.get("max_refreshes"), + last_refreshed_at=payload.get("last_refreshed_at"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment_error.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment_error.py new file mode 100644 index 00000000..8243f2bf --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment_error.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentError: + def __init__(self, error: Optional[str] = None): + self.error = error + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"error": self.error}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentError(error=payload.get("error")) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh202.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh202.py new file mode 100644 index 00000000..7922c8f2 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh202.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentRefresh202: + def __init__(self, job_id: Optional[str] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentRefresh202(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh_request.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh_request.py new file mode 100644 index 00000000..13d600a6 --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment_refresh_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentRefreshRequest: + def __init__(self, user_time_zone: Optional[str] = None): + self.user_time_zone = user_time_zone + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"user_time_zone": self.user_time_zone}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentRefreshRequest(user_time_zone=payload.get("user_time_zone")) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment_status_response.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment_status_response.py new file mode 100644 index 00000000..8cd149ee --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment_status_response.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentStatusResponse: + def __init__( + self, + query_validation: Optional[str] = None, + error_message: Optional[str] = None, + ): + self.query_validation = query_validation + self.error_message = error_message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "query_validation": self.query_validation, + "error_message": self.error_message, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentStatusResponse( + query_validation=payload.get("query_validation"), + error_message=payload.get("error_message"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment_update.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment_update.py new file mode 100644 index 00000000..2ce4a38b --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment_update.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentUpdate: + def __init__(self, name: Optional[str] = None, query_dsl: Optional[str] = None): + self.name = name + self.query_dsl = query_dsl + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "query_dsl": self.query_dsl}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentUpdate( + name=payload.get("name"), query_dsl=payload.get("query_dsl") + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/models/segment_write_v2.py b/sendgrid/rest/api/mc_segments_2/v3/models/segment_write_v2.py new file mode 100644 index 00000000..1faaa3cd --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/models/segment_write_v2.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SegmentWriteV2: + def __init__( + self, + name: Optional[str] = None, + parent_list_ids: Optional[List[str]] = None, + query_dsl: Optional[str] = None, + ): + self.name = name + self.parent_list_ids = parent_list_ids + self.query_dsl = query_dsl + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "parent_list_ids": self.parent_list_ids, + "query_dsl": self.query_dsl, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SegmentWriteV2( + name=payload.get("name"), + parent_list_ids=payload.get("parent_list_ids"), + query_dsl=payload.get("query_dsl"), + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/refresh_segment.py b/sendgrid/rest/api/mc_segments_2/v3/refresh_segment.py new file mode 100644 index 00000000..435c698f --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/refresh_segment.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.mc_segments_2.v3.models.segment_refresh_request import ( + SegmentRefreshRequest, +) + + +class RefreshSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: str, + segment_refresh_request: Optional[SegmentRefreshRequest] = None, + ): + path = "/v3/marketing/segments/2.0/refresh/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + data = None + if segment_refresh_request: + data = segment_refresh_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_segments_2/v3/update_segment.py b/sendgrid/rest/api/mc_segments_2/v3/update_segment.py new file mode 100644 index 00000000..bf3ec0ce --- /dev/null +++ b/sendgrid/rest/api/mc_segments_2/v3/update_segment.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Segments 2.0 API + The Twilio SendGrid Marketing Campaigns Segments V2 API allows you to create, edit, and delete segments as well as retrieve a list of segments or an individual segment by ID. Segments are similar to contact lists, except they update dynamically over time as information stored about your contacts or the criteria used to define your segments changes. When you segment your audience, you are able to create personalized Automation emails and Single Sends that directly address the wants and needs of your particular audience. Note that Twilio SendGrid checks for newly added or modified contacts who meet a segment's criteria on an hourly schedule. Only existing contacts who meet a segment's criteria will be included in the segment searches within 15 minutes. Segments built using engagement data such as \"was sent\" or \"clicked\" will take approximately 30 minutes to begin populating. Segment samples and counts are refreshed approximately once per hour; they do not update immediately. If no contacts are added to or removed from a segment since the last refresh, the sample and UI count displayed will be refreshed at increasing time intervals with a maximum sample and count refresh delay of 24 hours. You can also manage your Segments with the [Marketing Campaigns application user interface](https://mc.sendgrid.com/contacts). See [**Segmenting Your Contacts**](https://docs.sendgrid.com/ui/managing-contacts/segmenting-your-contacts) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_segments_2.v3.models.segment_update import SegmentUpdate + + +class UpdateSegment: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + segment_id: str, + segment_update: Optional[SegmentUpdate] = None, + ): + path = "/v3/marketing/segments/2.0/{segment_id}" + path = path.format( + segment_id=segment_id, + ) + + data = None + if segment_update: + data = segment_update.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_senders/v3/__init__.py b/sendgrid/rest/api/mc_senders/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_senders/v3/create_sender.py b/sendgrid/rest/api/mc_senders/v3/create_sender.py new file mode 100644 index 00000000..a937648c --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/create_sender.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request import ( + CreateSenderRequest, +) + + +class CreateSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_sender_request: Optional[CreateSenderRequest] = None, + ): + path = "/v3/marketing/senders" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_sender_request: + data = create_sender_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_senders/v3/delete_sender.py b/sendgrid/rest/api/mc_senders/v3/delete_sender.py new file mode 100644 index 00000000..9343a8af --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/delete_sender.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/marketing/senders/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_senders/v3/get_sender.py b/sendgrid/rest/api/mc_senders/v3/get_sender.py new file mode 100644 index 00000000..0df2bd6f --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/get_sender.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/marketing/senders/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_senders/v3/list_sender.py b/sendgrid/rest/api/mc_senders/v3/list_sender.py new file mode 100644 index 00000000..12fd0548 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/list_sender.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/marketing/senders" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/__init__.py b/sendgrid/rest/api/mc_senders/v3/models/__init__.py new file mode 100644 index 00000000..02d56189 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/__init__.py @@ -0,0 +1,50 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request import ( + CreateSenderRequest, +) +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request_from import ( + CreateSenderRequestFrom, +) +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request_reply_to import ( + CreateSenderRequestReplyTo, +) +from sendgrid.rest.api.mc_senders.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.mc_senders.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.mc_senders.v3.models.list_sender200_response import ( + ListSender200Response, +) +from sendgrid.rest.api.mc_senders.v3.models.sender import Sender +from sendgrid.rest.api.mc_senders.v3.models.sender_request import SenderRequest +from sendgrid.rest.api.mc_senders.v3.models.sender_request_from import SenderRequestFrom +from sendgrid.rest.api.mc_senders.v3.models.sender_request_reply_to import ( + SenderRequestReplyTo, +) + +__all__ = [ + "CreateSenderRequest", + "CreateSenderRequestFrom", + "CreateSenderRequestReplyTo", + "ErrorResponse", + "ErrorResponseErrorsInner", + "ListSender200Response", + "Sender", + "SenderRequest", + "SenderRequestFrom", + "SenderRequestReplyTo", +] +# Testing code diff --git a/sendgrid/rest/api/mc_senders/v3/models/create_sender_request.py b/sendgrid/rest/api/mc_senders/v3/models/create_sender_request.py new file mode 100644 index 00000000..47b08cdc --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/create_sender_request.py @@ -0,0 +1,67 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request_from import ( + CreateSenderRequestFrom, +) +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request_reply_to import ( + CreateSenderRequestReplyTo, +) + + +class CreateSenderRequest: + def __init__( + self, + nickname: Optional[str] = None, + var_from: Optional[CreateSenderRequestFrom] = None, + reply_to: Optional[CreateSenderRequestReplyTo] = None, + address: Optional[str] = None, + address_2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.nickname = nickname + self.var_from = var_from + self.reply_to = reply_to + self.address = address + self.address_2 = address_2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "nickname": self.nickname, + "from": self.var_from, + "reply_to": self.reply_to, + "address": self.address, + "address_2": self.address_2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSenderRequest( + nickname=payload.get("nickname"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + address=payload.get("address"), + address_2=payload.get("address_2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/create_sender_request_from.py b/sendgrid/rest/api/mc_senders/v3/models/create_sender_request_from.py new file mode 100644 index 00000000..f5216e8b --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/create_sender_request_from.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateSenderRequestFrom: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSenderRequestFrom( + email=payload.get("email"), name=payload.get("name") + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/create_sender_request_reply_to.py b/sendgrid/rest/api/mc_senders/v3/models/create_sender_request_reply_to.py new file mode 100644 index 00000000..0ce7c479 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/create_sender_request_reply_to.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateSenderRequestReplyTo: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSenderRequestReplyTo( + email=payload.get("email"), name=payload.get("name") + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/error_response.py b/sendgrid/rest/api/mc_senders/v3/models/error_response.py new file mode 100644 index 00000000..36f3b201 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_senders.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/mc_senders/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/mc_senders/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/list_sender200_response.py b/sendgrid/rest/api/mc_senders/v3/models/list_sender200_response.py new file mode 100644 index 00000000..ab0ccec9 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/list_sender200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_senders.v3.models.sender import Sender + + +class ListSender200Response: + def __init__(self, results: Optional[List[Sender]] = None): + self.results = results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"results": self.results}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSender200Response(results=payload.get("results")) diff --git a/sendgrid/rest/api/mc_senders/v3/models/sender.py b/sendgrid/rest/api/mc_senders/v3/models/sender.py new file mode 100644 index 00000000..bbf45cde --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/sender.py @@ -0,0 +1,87 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request_from import ( + CreateSenderRequestFrom, +) +from sendgrid.rest.api.mc_senders.v3.models.create_sender_request_reply_to import ( + CreateSenderRequestReplyTo, +) + + +class Sender: + def __init__( + self, + id: Optional[int] = None, + nickname: Optional[str] = None, + var_from: Optional[CreateSenderRequestFrom] = None, + reply_to: Optional[CreateSenderRequestReplyTo] = None, + address: Optional[str] = None, + address_2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + verified: Optional[bool] = None, + locked: Optional[bool] = None, + updated_at: Optional[int] = None, + created_at: Optional[int] = None, + ): + self.id = id + self.nickname = nickname + self.var_from = var_from + self.reply_to = reply_to + self.address = address + self.address_2 = address_2 + self.city = city + self.state = state + self.zip = zip + self.country = country + self.verified = verified + self.locked = locked + self.updated_at = updated_at + self.created_at = created_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "nickname": self.nickname, + "from": self.var_from, + "reply_to": self.reply_to, + "address": self.address, + "address_2": self.address_2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + "verified": self.verified, + "locked": self.locked, + "updated_at": self.updated_at, + "created_at": self.created_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Sender( + id=payload.get("id"), + nickname=payload.get("nickname"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + address=payload.get("address"), + address_2=payload.get("address_2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + verified=payload.get("verified"), + locked=payload.get("locked"), + updated_at=payload.get("updated_at"), + created_at=payload.get("created_at"), + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/sender_request.py b/sendgrid/rest/api/mc_senders/v3/models/sender_request.py new file mode 100644 index 00000000..32a952e3 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/sender_request.py @@ -0,0 +1,65 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_senders.v3.models.sender_request_from import SenderRequestFrom +from sendgrid.rest.api.mc_senders.v3.models.sender_request_reply_to import ( + SenderRequestReplyTo, +) + + +class SenderRequest: + def __init__( + self, + nickname: Optional[str] = None, + var_from: Optional[SenderRequestFrom] = None, + reply_to: Optional[SenderRequestReplyTo] = None, + address: Optional[str] = None, + address_2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.nickname = nickname + self.var_from = var_from + self.reply_to = reply_to + self.address = address + self.address_2 = address_2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "nickname": self.nickname, + "from": self.var_from, + "reply_to": self.reply_to, + "address": self.address, + "address_2": self.address_2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderRequest( + nickname=payload.get("nickname"), + var_from=payload.get("from"), + reply_to=payload.get("reply_to"), + address=payload.get("address"), + address_2=payload.get("address_2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/mc_senders/v3/models/sender_request_from.py b/sendgrid/rest/api/mc_senders/v3/models/sender_request_from.py new file mode 100644 index 00000000..46abfc11 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/sender_request_from.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SenderRequestFrom: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderRequestFrom(email=payload.get("email"), name=payload.get("name")) diff --git a/sendgrid/rest/api/mc_senders/v3/models/sender_request_reply_to.py b/sendgrid/rest/api/mc_senders/v3/models/sender_request_reply_to.py new file mode 100644 index 00000000..c756e937 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/models/sender_request_reply_to.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SenderRequestReplyTo: + def __init__(self, email: Optional[str] = None, name: Optional[str] = None): + self.email = email + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email, "name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SenderRequestReplyTo( + email=payload.get("email"), name=payload.get("name") + ) diff --git a/sendgrid/rest/api/mc_senders/v3/reset_sender_verification.py b/sendgrid/rest/api/mc_senders/v3/reset_sender_verification.py new file mode 100644 index 00000000..042b4e72 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/reset_sender_verification.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ResetSenderVerification: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/marketing/senders/{id}/resend_verification" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_senders/v3/update_sender.py b/sendgrid/rest/api/mc_senders/v3/update_sender.py new file mode 100644 index 00000000..b1f837e1 --- /dev/null +++ b/sendgrid/rest/api/mc_senders/v3/update_sender.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Senders API + The Twilio SendGrid Marketing Campaigns Senders API allows you to create a verified sender from which your marketing emails will be sent. To ensure our customers maintain the best possible sender reputations and to uphold legitimate sending behavior, we require customers to verify their Senders. A Sender represents your “From” email address—the address your recipients will see as the sender of your emails. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_senders.v3.models.sender_request import SenderRequest + + +class UpdateSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: int, + on_behalf_of: Optional[str] = None, + sender_request: Optional[SenderRequest] = None, + ): + path = "/v3/marketing/senders/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if sender_request: + data = sender_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/__init__.py b/sendgrid/rest/api/mc_singlesends/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_singlesends/v3/create_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/create_single_send.py new file mode 100644 index 00000000..0f7805ba --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/create_single_send.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request import ( + SinglesendRequest, +) + + +class CreateSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + singlesend_request: Optional[SinglesendRequest] = None, + ): + path = "/v3/marketing/singlesends" + + data = None + if singlesend_request: + data = singlesend_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/delete_scheduled_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/delete_scheduled_single_send.py new file mode 100644 index 00000000..afd2cf8d --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/delete_scheduled_single_send.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteScheduledSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/singlesends/{id}/schedule" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/delete_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/delete_single_send.py new file mode 100644 index 00000000..d5f13d2f --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/delete_single_send.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/singlesends/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/delete_single_sends.py b/sendgrid/rest/api/mc_singlesends/v3/delete_single_sends.py new file mode 100644 index 00000000..0fb3cf8f --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/delete_single_sends.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class DeleteSingleSends: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ids: Optional[List[str]] = None, + ): + path = "/v3/marketing/singlesends" + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/duplicate_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/duplicate_single_send.py new file mode 100644 index 00000000..e143ea62 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/duplicate_single_send.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_singlesends.v3.models.duplicate_single_send_request import ( + DuplicateSingleSendRequest, +) + + +class DuplicateSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + duplicate_single_send_request: Optional[DuplicateSingleSendRequest] = None, + ): + path = "/v3/marketing/singlesends/{id}" + path = path.format( + id=id, + ) + + data = None + if duplicate_single_send_request: + data = duplicate_single_send_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/get_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/get_single_send.py new file mode 100644 index 00000000..6f9aa24f --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/get_single_send.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/marketing/singlesends/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/list_category.py b/sendgrid/rest/api/mc_singlesends/v3/list_category.py new file mode 100644 index 00000000..18d542ab --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/list_category.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListCategory: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/marketing/singlesends/categories" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/list_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/list_single_send.py new file mode 100644 index 00000000..d8ad87bb --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/list_single_send.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + ): + path = "/v3/marketing/singlesends" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/__init__.py b/sendgrid/rest/api/mc_singlesends/v3/models/__init__.py new file mode 100644 index 00000000..297e1ba8 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/__init__.py @@ -0,0 +1,112 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_singlesends.v3.models.ab_test_summary import AbTestSummary +from sendgrid.rest.api.mc_singlesends.v3.models.duplicate_single_send_request import ( + DuplicateSingleSendRequest, +) +from sendgrid.rest.api.mc_singlesends.v3.models.editor import Editor +from sendgrid.rest.api.mc_singlesends.v3.models.editor1 import Editor1 +from sendgrid.rest.api.mc_singlesends.v3.models.items import Items +from sendgrid.rest.api.mc_singlesends.v3.models.list_category200_response import ( + ListCategory200Response, +) +from sendgrid.rest.api.mc_singlesends.v3.models.list_single_send200_response import ( + ListSingleSend200Response, +) +from sendgrid.rest.api.mc_singlesends.v3.models.list_single_send500_response import ( + ListSingleSend500Response, +) +from sendgrid.rest.api.mc_singlesends.v3.models.list_single_send500_response_errors_inner import ( + ListSingleSend500ResponseErrorsInner, +) +from sendgrid.rest.api.mc_singlesends.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_singlesends.v3.models.schedule_single_send201_response import ( + ScheduleSingleSend201Response, +) +from sendgrid.rest.api.mc_singlesends.v3.models.schedule_single_send_request import ( + ScheduleSingleSendRequest, +) +from sendgrid.rest.api.mc_singlesends.v3.models.search_single_send200_response import ( + SearchSingleSend200Response, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request import ( + SinglesendRequest, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request_email_config import ( + SinglesendRequestEmailConfig, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request_send_to import ( + SinglesendRequestSendTo, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response import ( + SinglesendResponse, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_email_config import ( + SinglesendResponseEmailConfig, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_send_to import ( + SinglesendResponseSendTo, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_short import ( + SinglesendResponseShort, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_warnings_inner import ( + SinglesendResponseWarningsInner, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_schedule import ( + SinglesendSchedule, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_search import ( + SinglesendSearch, +) +from sendgrid.rest.api.mc_singlesends.v3.models.status import Status +from sendgrid.rest.api.mc_singlesends.v3.models.status1 import Status1 +from sendgrid.rest.api.mc_singlesends.v3.models.status2 import Status2 +from sendgrid.rest.api.mc_singlesends.v3.models.status3 import Status3 +from sendgrid.rest.api.mc_singlesends.v3.models.type import Type +from sendgrid.rest.api.mc_singlesends.v3.models.winner_criteria import WinnerCriteria + +__all__ = [ + "AbTestSummary", + "DuplicateSingleSendRequest", + "Editor", + "Editor1", + "Items", + "ListCategory200Response", + "ListSingleSend200Response", + "ListSingleSend500Response", + "ListSingleSend500ResponseErrorsInner", + "Metadata", + "ScheduleSingleSend201Response", + "ScheduleSingleSendRequest", + "SearchSingleSend200Response", + "SinglesendRequest", + "SinglesendRequestEmailConfig", + "SinglesendRequestSendTo", + "SinglesendResponse", + "SinglesendResponseEmailConfig", + "SinglesendResponseSendTo", + "SinglesendResponseShort", + "SinglesendResponseWarningsInner", + "SinglesendSchedule", + "SinglesendSearch", + "Status", + "Status1", + "Status2", + "Status3", + "Type", + "WinnerCriteria", +] +# Testing code diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/ab_test_summary.py b/sendgrid/rest/api/mc_singlesends/v3/models/ab_test_summary.py new file mode 100644 index 00000000..4c1eade4 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/ab_test_summary.py @@ -0,0 +1,55 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.type import Type +from sendgrid.rest.api.mc_singlesends.v3.models.winner_criteria import WinnerCriteria + + +class AbTestSummary: + def __init__( + self, + type: Optional[Type] = None, + winner_criteria: Optional[WinnerCriteria] = None, + test_percentage: Optional[int] = None, + duration: Optional[str] = None, + winning_template_id: Optional[str] = None, + winner_selected_at: Optional[str] = None, + expiration_date: Optional[str] = None, + ): + self.type = type + self.winner_criteria = winner_criteria + self.test_percentage = test_percentage + self.duration = duration + self.winning_template_id = winning_template_id + self.winner_selected_at = winner_selected_at + self.expiration_date = expiration_date + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "winner_criteria": self.winner_criteria, + "test_percentage": self.test_percentage, + "duration": self.duration, + "winning_template_id": self.winning_template_id, + "winner_selected_at": self.winner_selected_at, + "expiration_date": self.expiration_date, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AbTestSummary( + type=payload.get("type"), + winner_criteria=payload.get("winner_criteria"), + test_percentage=payload.get("test_percentage"), + duration=payload.get("duration"), + winning_template_id=payload.get("winning_template_id"), + winner_selected_at=payload.get("winner_selected_at"), + expiration_date=payload.get("expiration_date"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/duplicate_single_send_request.py b/sendgrid/rest/api/mc_singlesends/v3/models/duplicate_single_send_request.py new file mode 100644 index 00000000..8a41fbd2 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/duplicate_single_send_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DuplicateSingleSendRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DuplicateSingleSendRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/editor.py b/sendgrid/rest/api/mc_singlesends/v3/models/editor.py new file mode 100644 index 00000000..47b41f47 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/editor.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Editor(Enum): + CODE = "code" + DESIGN = "design" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/editor1.py b/sendgrid/rest/api/mc_singlesends/v3/models/editor1.py new file mode 100644 index 00000000..a50f81cc --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/editor1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Editor1(Enum): + CODE = "code" + DESIGN = "design" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/items.py b/sendgrid/rest/api/mc_singlesends/v3/models/items.py new file mode 100644 index 00000000..ab4d0ae8 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/items.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Items(Enum): + DRAFT = "draft" + SCHEDULED = "scheduled" + TRIGGERED = "triggered" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/list_category200_response.py b/sendgrid/rest/api/mc_singlesends/v3/models/list_category200_response.py new file mode 100644 index 00000000..bfb8d1b4 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/list_category200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListCategory200Response: + def __init__(self, categories: Optional[List[str]] = None): + self.categories = categories + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"categories": self.categories}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListCategory200Response(categories=payload.get("categories")) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send200_response.py b/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send200_response.py new file mode 100644 index 00000000..e34e759f --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send200_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_short import ( + SinglesendResponseShort, +) + + +class ListSingleSend200Response: + def __init__( + self, + result: Optional[List[SinglesendResponseShort]] = None, + metadata: Optional[Metadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSingleSend200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response.py b/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response.py new file mode 100644 index 00000000..926f4f8d --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.list_single_send500_response_errors_inner import ( + ListSingleSend500ResponseErrorsInner, +) + + +class ListSingleSend500Response: + def __init__( + self, errors: Optional[List[ListSingleSend500ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSingleSend500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response_errors_inner.py b/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response_errors_inner.py new file mode 100644 index 00000000..a45d0d89 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/list_single_send500_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListSingleSend500ResponseErrorsInner: + def __init__( + self, + field: Optional[str] = None, + message: Optional[str] = None, + error_id: Optional[str] = None, + ): + self.field = field + self.message = message + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "field": self.field, + "message": self.message, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSingleSend500ResponseErrorsInner( + field=payload.get("field"), + message=payload.get("message"), + error_id=payload.get("error_id"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/metadata.py b/sendgrid/rest/api/mc_singlesends/v3/models/metadata.py new file mode 100644 index 00000000..3281a432 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[int] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send201_response.py b/sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send201_response.py new file mode 100644 index 00000000..287272ef --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send201_response.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.status import Status + + +class ScheduleSingleSend201Response: + def __init__( + self, send_at: Optional[datetime] = None, status: Optional[Status] = None + ): + self.send_at = send_at + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"send_at": self.send_at, "status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ScheduleSingleSend201Response( + send_at=payload.get("send_at"), status=payload.get("status") + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send_request.py b/sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send_request.py new file mode 100644 index 00000000..137a3a80 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/schedule_single_send_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ScheduleSingleSendRequest: + def __init__(self, send_at: Optional[datetime] = None): + self.send_at = send_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"send_at": self.send_at}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ScheduleSingleSendRequest(send_at=payload.get("send_at")) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/search_single_send200_response.py b/sendgrid/rest/api/mc_singlesends/v3/models/search_single_send200_response.py new file mode 100644 index 00000000..63d76a50 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/search_single_send200_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_short import ( + SinglesendResponseShort, +) + + +class SearchSingleSend200Response: + def __init__( + self, + result: Optional[List[SinglesendResponseShort]] = None, + metadata: Optional[Metadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SearchSingleSend200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request.py new file mode 100644 index 00000000..45e70bcb --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request.py @@ -0,0 +1,51 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request_email_config import ( + SinglesendRequestEmailConfig, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request_send_to import ( + SinglesendRequestSendTo, +) + + +class SinglesendRequest: + def __init__( + self, + name: Optional[str] = None, + categories: Optional[List[str]] = None, + send_at: Optional[datetime] = None, + send_to: Optional[SinglesendRequestSendTo] = None, + email_config: Optional[SinglesendRequestEmailConfig] = None, + ): + self.name = name + self.categories = categories + self.send_at = send_at + self.send_to = send_to + self.email_config = email_config + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "categories": self.categories, + "send_at": self.send_at, + "send_to": self.send_to, + "email_config": self.email_config, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendRequest( + name=payload.get("name"), + categories=payload.get("categories"), + send_at=payload.get("send_at"), + send_to=payload.get("send_to"), + email_config=payload.get("email_config"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_email_config.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_email_config.py new file mode 100644 index 00000000..07d0d3b4 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_email_config.py @@ -0,0 +1,66 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.editor import Editor + + +class SinglesendRequestEmailConfig: + def __init__( + self, + subject: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + generate_plain_content: Optional[bool] = None, + design_id: Optional[str] = None, + editor: Optional[Editor] = None, + suppression_group_id: Optional[int] = None, + custom_unsubscribe_url: Optional[str] = None, + sender_id: Optional[int] = None, + ip_pool: Optional[str] = None, + ): + self.subject = subject + self.html_content = html_content + self.plain_content = plain_content + self.generate_plain_content = generate_plain_content + self.design_id = design_id + self.editor = editor + self.suppression_group_id = suppression_group_id + self.custom_unsubscribe_url = custom_unsubscribe_url + self.sender_id = sender_id + self.ip_pool = ip_pool + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "subject": self.subject, + "html_content": self.html_content, + "plain_content": self.plain_content, + "generate_plain_content": self.generate_plain_content, + "design_id": self.design_id, + "editor": self.editor, + "suppression_group_id": self.suppression_group_id, + "custom_unsubscribe_url": self.custom_unsubscribe_url, + "sender_id": self.sender_id, + "ip_pool": self.ip_pool, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendRequestEmailConfig( + subject=payload.get("subject"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + generate_plain_content=payload.get("generate_plain_content"), + design_id=payload.get("design_id"), + editor=payload.get("editor"), + suppression_group_id=payload.get("suppression_group_id"), + custom_unsubscribe_url=payload.get("custom_unsubscribe_url"), + sender_id=payload.get("sender_id"), + ip_pool=payload.get("ip_pool"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_send_to.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_send_to.py new file mode 100644 index 00000000..2669f922 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_request_send_to.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SinglesendRequestSendTo: + def __init__( + self, + list_ids: Optional[List[str]] = None, + segment_ids: Optional[List[str]] = None, + all: Optional[bool] = None, + ): + self.list_ids = list_ids + self.segment_ids = segment_ids + self.all = all + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "all": self.all, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendRequestSendTo( + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + all=payload.get("all"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response.py new file mode 100644 index 00000000..2ec911cb --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response.py @@ -0,0 +1,75 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_email_config import ( + SinglesendResponseEmailConfig, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_send_to import ( + SinglesendResponseSendTo, +) +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_response_warnings_inner import ( + SinglesendResponseWarningsInner, +) +from sendgrid.rest.api.mc_singlesends.v3.models.status2 import Status2 + + +class SinglesendResponse: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[Status2] = None, + categories: Optional[List[str]] = None, + send_at: Optional[datetime] = None, + send_to: Optional[SinglesendResponseSendTo] = None, + updated_at: Optional[datetime] = None, + created_at: Optional[datetime] = None, + email_config: Optional[SinglesendResponseEmailConfig] = None, + warnings: Optional[List[SinglesendResponseWarningsInner]] = None, + ): + self.id = id + self.name = name + self.status = status + self.categories = categories + self.send_at = send_at + self.send_to = send_to + self.updated_at = updated_at + self.created_at = created_at + self.email_config = email_config + self.warnings = warnings + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "status": self.status, + "categories": self.categories, + "send_at": self.send_at, + "send_to": self.send_to, + "updated_at": self.updated_at, + "created_at": self.created_at, + "email_config": self.email_config, + "warnings": self.warnings, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendResponse( + id=payload.get("id"), + name=payload.get("name"), + status=payload.get("status"), + categories=payload.get("categories"), + send_at=payload.get("send_at"), + send_to=payload.get("send_to"), + updated_at=payload.get("updated_at"), + created_at=payload.get("created_at"), + email_config=payload.get("email_config"), + warnings=payload.get("warnings"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_email_config.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_email_config.py new file mode 100644 index 00000000..5896da2d --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_email_config.py @@ -0,0 +1,66 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.editor1 import Editor1 + + +class SinglesendResponseEmailConfig: + def __init__( + self, + subject: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + generate_plain_content: Optional[bool] = None, + design_id: Optional[str] = None, + editor: Optional[Editor1] = None, + suppression_group_id: Optional[int] = None, + custom_unsubscribe_url: Optional[str] = None, + sender_id: Optional[int] = None, + ip_pool: Optional[str] = None, + ): + self.subject = subject + self.html_content = html_content + self.plain_content = plain_content + self.generate_plain_content = generate_plain_content + self.design_id = design_id + self.editor = editor + self.suppression_group_id = suppression_group_id + self.custom_unsubscribe_url = custom_unsubscribe_url + self.sender_id = sender_id + self.ip_pool = ip_pool + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "subject": self.subject, + "html_content": self.html_content, + "plain_content": self.plain_content, + "generate_plain_content": self.generate_plain_content, + "design_id": self.design_id, + "editor": self.editor, + "suppression_group_id": self.suppression_group_id, + "custom_unsubscribe_url": self.custom_unsubscribe_url, + "sender_id": self.sender_id, + "ip_pool": self.ip_pool, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendResponseEmailConfig( + subject=payload.get("subject"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + generate_plain_content=payload.get("generate_plain_content"), + design_id=payload.get("design_id"), + editor=payload.get("editor"), + suppression_group_id=payload.get("suppression_group_id"), + custom_unsubscribe_url=payload.get("custom_unsubscribe_url"), + sender_id=payload.get("sender_id"), + ip_pool=payload.get("ip_pool"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_send_to.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_send_to.py new file mode 100644 index 00000000..c8622cf1 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_send_to.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SinglesendResponseSendTo: + def __init__( + self, + list_ids: Optional[List[str]] = None, + segment_ids: Optional[List[str]] = None, + all: Optional[bool] = None, + ): + self.list_ids = list_ids + self.segment_ids = segment_ids + self.all = all + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "list_ids": self.list_ids, + "segment_ids": self.segment_ids, + "all": self.all, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendResponseSendTo( + list_ids=payload.get("list_ids"), + segment_ids=payload.get("segment_ids"), + all=payload.get("all"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_short.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_short.py new file mode 100644 index 00000000..679e8173 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_short.py @@ -0,0 +1,63 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.ab_test_summary import AbTestSummary +from sendgrid.rest.api.mc_singlesends.v3.models.status3 import Status3 + + +class SinglesendResponseShort: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + abtest: Optional[AbTestSummary] = None, + status: Optional[Status3] = None, + categories: Optional[List[str]] = None, + send_at: Optional[datetime] = None, + is_abtest: Optional[bool] = None, + updated_at: Optional[datetime] = None, + created_at: Optional[datetime] = None, + ): + self.id = id + self.name = name + self.abtest = abtest + self.status = status + self.categories = categories + self.send_at = send_at + self.is_abtest = is_abtest + self.updated_at = updated_at + self.created_at = created_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "abtest": self.abtest, + "status": self.status, + "categories": self.categories, + "send_at": self.send_at, + "is_abtest": self.is_abtest, + "updated_at": self.updated_at, + "created_at": self.created_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendResponseShort( + id=payload.get("id"), + name=payload.get("name"), + abtest=payload.get("abtest"), + status=payload.get("status"), + categories=payload.get("categories"), + send_at=payload.get("send_at"), + is_abtest=payload.get("is_abtest"), + updated_at=payload.get("updated_at"), + created_at=payload.get("created_at"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_warnings_inner.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_warnings_inner.py new file mode 100644 index 00000000..9605dadf --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_response_warnings_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SinglesendResponseWarningsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + warning_id: Optional[str] = None, + ): + self.message = message + self.field = field + self.warning_id = warning_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "warning_id": self.warning_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendResponseWarningsInner( + message=payload.get("message"), + field=payload.get("field"), + warning_id=payload.get("warning_id"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_schedule.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_schedule.py new file mode 100644 index 00000000..7b8d9c9d --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_schedule.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.status1 import Status1 + + +class SinglesendSchedule: + def __init__( + self, send_at: Optional[datetime] = None, status: Optional[Status1] = None + ): + self.send_at = send_at + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"send_at": self.send_at, "status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendSchedule( + send_at=payload.get("send_at"), status=payload.get("status") + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_search.py b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_search.py new file mode 100644 index 00000000..57e55497 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/singlesend_search.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_singlesends.v3.models.items import Items + + +class SinglesendSearch: + def __init__( + self, + name: Optional[str] = None, + status: Optional[List[Items]] = None, + categories: Optional[List[str]] = None, + ): + self.name = name + self.status = status + self.categories = categories + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "status": self.status, + "categories": self.categories, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendSearch( + name=payload.get("name"), + status=payload.get("status"), + categories=payload.get("categories"), + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/status.py b/sendgrid/rest/api/mc_singlesends/v3/models/status.py new file mode 100644 index 00000000..53dcf2b5 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/status.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Status(Enum): + SCHEDULED = "scheduled" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/status1.py b/sendgrid/rest/api/mc_singlesends/v3/models/status1.py new file mode 100644 index 00000000..dcce4640 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/status1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status1(Enum): + DRAFT = "draft" + SCHEDULED = "scheduled" + TRIGGERED = "triggered" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/status2.py b/sendgrid/rest/api/mc_singlesends/v3/models/status2.py new file mode 100644 index 00000000..3386bba9 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/status2.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status2(Enum): + DRAFT = "draft" + SCHEDULED = "scheduled" + TRIGGERED = "triggered" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/status3.py b/sendgrid/rest/api/mc_singlesends/v3/models/status3.py new file mode 100644 index 00000000..8e5e9bb9 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/status3.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Status3(Enum): + DRAFT = "draft" + SCHEDULED = "scheduled" + TRIGGERED = "triggered" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/type.py b/sendgrid/rest/api/mc_singlesends/v3/models/type.py new file mode 100644 index 00000000..7b1db81e --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + SUBJECT = "subject" + CONTENT = "content" diff --git a/sendgrid/rest/api/mc_singlesends/v3/models/winner_criteria.py b/sendgrid/rest/api/mc_singlesends/v3/models/winner_criteria.py new file mode 100644 index 00000000..c459d53b --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/models/winner_criteria.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class WinnerCriteria(Enum): + OPEN = "open" + CLICK = "click" + MANUAL = "manual" diff --git a/sendgrid/rest/api/mc_singlesends/v3/schedule_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/schedule_single_send.py new file mode 100644 index 00000000..796ebbdc --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/schedule_single_send.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_singlesends.v3.models.schedule_single_send_request import ( + ScheduleSingleSendRequest, +) + + +class ScheduleSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + schedule_single_send_request: Optional[ScheduleSingleSendRequest] = None, + ): + path = "/v3/marketing/singlesends/{id}/schedule" + path = path.format( + id=id, + ) + + data = None + if schedule_single_send_request: + data = schedule_single_send_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/search_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/search_single_send.py new file mode 100644 index 00000000..32caaa69 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/search_single_send.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_search import ( + SinglesendSearch, +) + + +class SearchSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + singlesend_search: Optional[SinglesendSearch] = None, + ): + path = "/v3/marketing/singlesends/search" + + data = None + if singlesend_search: + data = singlesend_search.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_singlesends/v3/update_single_send.py b/sendgrid/rest/api/mc_singlesends/v3/update_single_send.py new file mode 100644 index 00000000..ee3e5116 --- /dev/null +++ b/sendgrid/rest/api/mc_singlesends/v3/update_single_send.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Single Sends API + The Twilio SendGrid Single Sends API allows you to create, manage, and send Single Sends. You can also search Single Sends and retrieve statistics about them to help you maintain, alter, and further develop your campaigns. A Single Send is a one-time non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery. Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates. You can also create and manage Single Sends in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/single-sends). The Single Sends API changed on May 6, 2020. See [**Single Sends 2020 Update**](https://docs.sendgrid.com/for-developers/sending-email/single-sends-2020-update) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_singlesends.v3.models.singlesend_request import ( + SinglesendRequest, +) + + +class UpdateSingleSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + singlesend_request: Optional[SinglesendRequest] = None, + ): + path = "/v3/marketing/singlesends/{id}" + path = path.format( + id=id, + ) + + data = None + if singlesend_request: + data = singlesend_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/__init__.py b/sendgrid/rest/api/mc_stats/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_stats/v3/export_automation_stat.py b/sendgrid/rest/api/mc_stats/v3/export_automation_stat.py new file mode 100644 index 00000000..38fc48b5 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/export_automation_stat.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class ExportAutomationStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ids: Optional[List[str]] = None, + timezone: Optional[str] = None, + ): + path = "/v3/marketing/stats/automations/export" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/export_single_send_stat.py b/sendgrid/rest/api/mc_stats/v3/export_single_send_stat.py new file mode 100644 index 00000000..d232a83d --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/export_single_send_stat.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class ExportSingleSendStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ids: Optional[List[str]] = None, + timezone: Optional[str] = None, + ): + path = "/v3/marketing/stats/singlesends/export" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/get_automation_stat.py b/sendgrid/rest/api/mc_stats/v3/get_automation_stat.py new file mode 100644 index 00000000..4690cea8 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/get_automation_stat.py @@ -0,0 +1,66 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from datetime import date +from typing import List, Optional +from sendgrid.rest.api.mc_stats.v3.models.aggregated_by import AggregatedBy +from sendgrid.rest.api.mc_stats.v3.models.items import Items + + +class GetAutomationStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + group_by: Optional[List[Items]] = None, + step_ids: Optional[List[str]] = None, + aggregated_by: Optional[AggregatedBy] = None, + start_date: Optional[date] = None, + end_date: Optional[date] = None, + timezone: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + ): + path = "/v3/marketing/stats/automations/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/get_single_send_stat.py b/sendgrid/rest/api/mc_stats/v3/get_single_send_stat.py new file mode 100644 index 00000000..2e7ad873 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/get_single_send_stat.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from datetime import date +from typing import List, Optional +from sendgrid.rest.api.mc_stats.v3.models.aggregated_by import AggregatedBy +from sendgrid.rest.api.mc_stats.v3.models.items1 import Items1 + + +class GetSingleSendStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + aggregated_by: Optional[AggregatedBy] = None, + start_date: Optional[date] = None, + end_date: Optional[date] = None, + timezone: Optional[str] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + group_by: Optional[List[Items1]] = None, + ): + path = "/v3/marketing/stats/singlesends/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/list_automation_stat.py b/sendgrid/rest/api/mc_stats/v3/list_automation_stat.py new file mode 100644 index 00000000..9f9ba940 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/list_automation_stat.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class ListAutomationStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + automation_ids: Optional[List[str]] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + ): + path = "/v3/marketing/stats/automations" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/list_click_tracking_stat.py b/sendgrid/rest/api/mc_stats/v3/list_click_tracking_stat.py new file mode 100644 index 00000000..600543e9 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/list_click_tracking_stat.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional +from sendgrid.rest.api.mc_stats.v3.models.items import Items + + +class ListClickTrackingStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + group_by: Optional[List[Items]] = None, + step_ids: Optional[List[str]] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + ): + path = "/v3/marketing/stats/automations/{id}/links" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/list_single_send_stat.py b/sendgrid/rest/api/mc_stats/v3/list_single_send_stat.py new file mode 100644 index 00000000..3750f4a4 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/list_single_send_stat.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class ListSingleSendStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + singlesend_ids: Optional[List[str]] = None, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + ): + path = "/v3/marketing/stats/singlesends" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/list_single_send_tracking_stat.py b/sendgrid/rest/api/mc_stats/v3/list_single_send_tracking_stat.py new file mode 100644 index 00000000..d4d0f34a --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/list_single_send_tracking_stat.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional +from sendgrid.rest.api.mc_stats.v3.models.ab_phase_id import AbPhaseId +from sendgrid.rest.api.mc_stats.v3.models.items2 import Items2 + + +class ListSingleSendTrackingStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + page_size: Optional[int] = None, + page_token: Optional[str] = None, + group_by: Optional[List[Items2]] = None, + ab_variation_id: Optional[str] = None, + ab_phase_id: Optional[AbPhaseId] = None, + ): + path = "/v3/marketing/stats/singlesends/{id}/links" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/__init__.py b/sendgrid/rest/api/mc_stats/v3/models/__init__.py new file mode 100644 index 00000000..eb748dbe --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/__init__.py @@ -0,0 +1,78 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Statistics API + The Marketing Campaigns Stats API allows you to retrieve statistics for both Automations and Single Sends. The statistics provided include bounces, clicks, opens, and more. You can export stats in CSV format for use in other applications. You can also retrieve Marketing Campaigns stats in the [Marketing Campaigns application user interface](https://mc.sendgrid.com/). This API provides statistics for Marketing Campaigns only. For stats related to event tracking, please see the [Stats API](https://docs.sendgrid.com/api-reference/stats). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_stats.v3.models.ab_phase import AbPhase +from sendgrid.rest.api.mc_stats.v3.models.ab_phase1 import AbPhase1 +from sendgrid.rest.api.mc_stats.v3.models.ab_phase_id import AbPhaseId +from sendgrid.rest.api.mc_stats.v3.models.aggregated_by import AggregatedBy +from sendgrid.rest.api.mc_stats.v3.models.autmoations_link_stats_response import ( + AutmoationsLinkStatsResponse, +) +from sendgrid.rest.api.mc_stats.v3.models.autmoations_link_stats_response_results_inner import ( + AutmoationsLinkStatsResponseResultsInner, +) +from sendgrid.rest.api.mc_stats.v3.models.automations_response import ( + AutomationsResponse, +) +from sendgrid.rest.api.mc_stats.v3.models.automations_response_results_inner import ( + AutomationsResponseResultsInner, +) +from sendgrid.rest.api.mc_stats.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.mc_stats.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.mc_stats.v3.models.items import Items +from sendgrid.rest.api.mc_stats.v3.models.items1 import Items1 +from sendgrid.rest.api.mc_stats.v3.models.items2 import Items2 +from sendgrid.rest.api.mc_stats.v3.models.link_tracking_metadata import ( + LinkTrackingMetadata, +) +from sendgrid.rest.api.mc_stats.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_stats.v3.models.metrics import Metrics +from sendgrid.rest.api.mc_stats.v3.models.singlesends_link_stats_response import ( + SinglesendsLinkStatsResponse, +) +from sendgrid.rest.api.mc_stats.v3.models.singlesends_link_stats_response_results_inner import ( + SinglesendsLinkStatsResponseResultsInner, +) +from sendgrid.rest.api.mc_stats.v3.models.singlesends_response import ( + SinglesendsResponse, +) +from sendgrid.rest.api.mc_stats.v3.models.singlesends_response_results_inner import ( + SinglesendsResponseResultsInner, +) + +__all__ = [ + "AbPhase", + "AbPhase1", + "AbPhaseId", + "AggregatedBy", + "AutmoationsLinkStatsResponse", + "AutmoationsLinkStatsResponseResultsInner", + "AutomationsResponse", + "AutomationsResponseResultsInner", + "ErrorResponse", + "ErrorResponseErrorsInner", + "Items", + "Items1", + "Items2", + "LinkTrackingMetadata", + "Metadata", + "Metrics", + "SinglesendsLinkStatsResponse", + "SinglesendsLinkStatsResponseResultsInner", + "SinglesendsResponse", + "SinglesendsResponseResultsInner", +] +# Testing code diff --git a/sendgrid/rest/api/mc_stats/v3/models/ab_phase.py b/sendgrid/rest/api/mc_stats/v3/models/ab_phase.py new file mode 100644 index 00000000..c41d10eb --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/ab_phase.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AbPhase(Enum): + SEND = "send" + TEST = "test" + ALL = "all" diff --git a/sendgrid/rest/api/mc_stats/v3/models/ab_phase1.py b/sendgrid/rest/api/mc_stats/v3/models/ab_phase1.py new file mode 100644 index 00000000..07ddc95a --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/ab_phase1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AbPhase1(Enum): + SEND = "send" + TEST = "test" + ALL = "all" diff --git a/sendgrid/rest/api/mc_stats/v3/models/ab_phase_id.py b/sendgrid/rest/api/mc_stats/v3/models/ab_phase_id.py new file mode 100644 index 00000000..c89ee0d7 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/ab_phase_id.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class AbPhaseId(Enum): + TEST = "test" + SEND = "send" diff --git a/sendgrid/rest/api/mc_stats/v3/models/aggregated_by.py b/sendgrid/rest/api/mc_stats/v3/models/aggregated_by.py new file mode 100644 index 00000000..2c1b62eb --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/aggregated_by.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy(Enum): + DAY = "day" + TOTAL = "total" diff --git a/sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response.py b/sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response.py new file mode 100644 index 00000000..76bd1a8c --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.autmoations_link_stats_response_results_inner import ( + AutmoationsLinkStatsResponseResultsInner, +) +from sendgrid.rest.api.mc_stats.v3.models.link_tracking_metadata import ( + LinkTrackingMetadata, +) + + +class AutmoationsLinkStatsResponse: + def __init__( + self, + results: Optional[List[AutmoationsLinkStatsResponseResultsInner]] = None, + total_clicks: Optional[int] = None, + metadata: Optional[LinkTrackingMetadata] = None, + ): + self.results = results + self.total_clicks = total_clicks + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "results": self.results, + "total_clicks": self.total_clicks, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AutmoationsLinkStatsResponse( + results=payload.get("results"), + total_clicks=payload.get("total_clicks"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response_results_inner.py b/sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response_results_inner.py new file mode 100644 index 00000000..4b3b7711 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/autmoations_link_stats_response_results_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AutmoationsLinkStatsResponseResultsInner: + def __init__( + self, + url: Optional[str] = None, + url_location: Optional[int] = None, + step_id: Optional[str] = None, + clicks: Optional[int] = None, + ): + self.url = url + self.url_location = url_location + self.step_id = step_id + self.clicks = clicks + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "url": self.url, + "url_location": self.url_location, + "step_id": self.step_id, + "clicks": self.clicks, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AutmoationsLinkStatsResponseResultsInner( + url=payload.get("url"), + url_location=payload.get("url_location"), + step_id=payload.get("step_id"), + clicks=payload.get("clicks"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/automations_response.py b/sendgrid/rest/api/mc_stats/v3/models/automations_response.py new file mode 100644 index 00000000..850e359b --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/automations_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.automations_response_results_inner import ( + AutomationsResponseResultsInner, +) +from sendgrid.rest.api.mc_stats.v3.models.metadata import Metadata + + +class AutomationsResponse: + def __init__( + self, + results: Optional[List[AutomationsResponseResultsInner]] = None, + metadata: Optional[Metadata] = None, + ): + self.results = results + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "results": self.results, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AutomationsResponse( + results=payload.get("results"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/automations_response_results_inner.py b/sendgrid/rest/api/mc_stats/v3/models/automations_response_results_inner.py new file mode 100644 index 00000000..6d88b4c2 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/automations_response_results_inner.py @@ -0,0 +1,42 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.metrics import Metrics + + +class AutomationsResponseResultsInner: + def __init__( + self, + id: Optional[str] = None, + aggregation: Optional[str] = None, + step_id: Optional[str] = None, + stats: Optional[Metrics] = None, + ): + self.id = id + self.aggregation = aggregation + self.step_id = step_id + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "aggregation": self.aggregation, + "step_id": self.step_id, + "stats": self.stats, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AutomationsResponseResultsInner( + id=payload.get("id"), + aggregation=payload.get("aggregation"), + step_id=payload.get("step_id"), + stats=payload.get("stats"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/error_response.py b/sendgrid/rest/api/mc_stats/v3/models/error_response.py new file mode 100644 index 00000000..aa5ebafe --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/mc_stats/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/mc_stats/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/items.py b/sendgrid/rest/api/mc_stats/v3/models/items.py new file mode 100644 index 00000000..e48df653 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/items.py @@ -0,0 +1,6 @@ +from enum import Enum +from enum import Enum + + +class Items(Enum): + STEP_ID = "step_id" diff --git a/sendgrid/rest/api/mc_stats/v3/models/items1.py b/sendgrid/rest/api/mc_stats/v3/models/items1.py new file mode 100644 index 00000000..ea1e22a3 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/items1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Items1(Enum): + AB_VARIATION = "ab_variation" + AB_PHASE = "ab_phase" diff --git a/sendgrid/rest/api/mc_stats/v3/models/items2.py b/sendgrid/rest/api/mc_stats/v3/models/items2.py new file mode 100644 index 00000000..39abebed --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/items2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Items2(Enum): + AB_VARIATION = "ab_variation" + AB_PHASE = "ab_phase" diff --git a/sendgrid/rest/api/mc_stats/v3/models/link_tracking_metadata.py b/sendgrid/rest/api/mc_stats/v3/models/link_tracking_metadata.py new file mode 100644 index 00000000..8f828634 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/link_tracking_metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class LinkTrackingMetadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[float] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return LinkTrackingMetadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/metadata.py b/sendgrid/rest/api/mc_stats/v3/models/metadata.py new file mode 100644 index 00000000..2d7bf72c --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[float] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/metrics.py b/sendgrid/rest/api/mc_stats/v3/models/metrics.py new file mode 100644 index 00000000..16518466 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/metrics.py @@ -0,0 +1,73 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metrics: + def __init__( + self, + bounce_drops: Optional[int] = None, + bounces: Optional[int] = None, + clicks: Optional[int] = None, + delivered: Optional[int] = None, + invalid_emails: Optional[int] = None, + opens: Optional[int] = None, + requests: Optional[int] = None, + spam_report_drops: Optional[int] = None, + spam_reports: Optional[int] = None, + unique_clicks: Optional[int] = None, + unique_opens: Optional[int] = None, + unsubscribes: Optional[int] = None, + ): + self.bounce_drops = bounce_drops + self.bounces = bounces + self.clicks = clicks + self.delivered = delivered + self.invalid_emails = invalid_emails + self.opens = opens + self.requests = requests + self.spam_report_drops = spam_report_drops + self.spam_reports = spam_reports + self.unique_clicks = unique_clicks + self.unique_opens = unique_opens + self.unsubscribes = unsubscribes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "bounce_drops": self.bounce_drops, + "bounces": self.bounces, + "clicks": self.clicks, + "delivered": self.delivered, + "invalid_emails": self.invalid_emails, + "opens": self.opens, + "requests": self.requests, + "spam_report_drops": self.spam_report_drops, + "spam_reports": self.spam_reports, + "unique_clicks": self.unique_clicks, + "unique_opens": self.unique_opens, + "unsubscribes": self.unsubscribes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metrics( + bounce_drops=payload.get("bounce_drops"), + bounces=payload.get("bounces"), + clicks=payload.get("clicks"), + delivered=payload.get("delivered"), + invalid_emails=payload.get("invalid_emails"), + opens=payload.get("opens"), + requests=payload.get("requests"), + spam_report_drops=payload.get("spam_report_drops"), + spam_reports=payload.get("spam_reports"), + unique_clicks=payload.get("unique_clicks"), + unique_opens=payload.get("unique_opens"), + unsubscribes=payload.get("unsubscribes"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response.py b/sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response.py new file mode 100644 index 00000000..fac0d388 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.link_tracking_metadata import ( + LinkTrackingMetadata, +) +from sendgrid.rest.api.mc_stats.v3.models.singlesends_link_stats_response_results_inner import ( + SinglesendsLinkStatsResponseResultsInner, +) + + +class SinglesendsLinkStatsResponse: + def __init__( + self, + results: Optional[List[SinglesendsLinkStatsResponseResultsInner]] = None, + metadata: Optional[LinkTrackingMetadata] = None, + total_clicks: Optional[int] = None, + ): + self.results = results + self.metadata = metadata + self.total_clicks = total_clicks + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "results": self.results, + "_metadata": self.metadata, + "total_clicks": self.total_clicks, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendsLinkStatsResponse( + results=payload.get("results"), + metadata=payload.get("_metadata"), + total_clicks=payload.get("total_clicks"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response_results_inner.py b/sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response_results_inner.py new file mode 100644 index 00000000..ed66c39b --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/singlesends_link_stats_response_results_inner.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.ab_phase1 import AbPhase1 + + +class SinglesendsLinkStatsResponseResultsInner: + def __init__( + self, + url: Optional[str] = None, + url_location: Optional[int] = None, + ab_variation: Optional[str] = None, + ab_phase: Optional[AbPhase1] = None, + clicks: Optional[int] = None, + ): + self.url = url + self.url_location = url_location + self.ab_variation = ab_variation + self.ab_phase = ab_phase + self.clicks = clicks + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "url": self.url, + "url_location": self.url_location, + "ab_variation": self.ab_variation, + "ab_phase": self.ab_phase, + "clicks": self.clicks, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendsLinkStatsResponseResultsInner( + url=payload.get("url"), + url_location=payload.get("url_location"), + ab_variation=payload.get("ab_variation"), + ab_phase=payload.get("ab_phase"), + clicks=payload.get("clicks"), + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/singlesends_response.py b/sendgrid/rest/api/mc_stats/v3/models/singlesends_response.py new file mode 100644 index 00000000..5f2d17d8 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/singlesends_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.metadata import Metadata +from sendgrid.rest.api.mc_stats.v3.models.singlesends_response_results_inner import ( + SinglesendsResponseResultsInner, +) + + +class SinglesendsResponse: + def __init__( + self, + results: Optional[List[SinglesendsResponseResultsInner]] = None, + metadata: Optional[Metadata] = None, + ): + self.results = results + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "results": self.results, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendsResponse( + results=payload.get("results"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/mc_stats/v3/models/singlesends_response_results_inner.py b/sendgrid/rest/api/mc_stats/v3/models/singlesends_response_results_inner.py new file mode 100644 index 00000000..1b8a4511 --- /dev/null +++ b/sendgrid/rest/api/mc_stats/v3/models/singlesends_response_results_inner.py @@ -0,0 +1,47 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_stats.v3.models.ab_phase import AbPhase +from sendgrid.rest.api.mc_stats.v3.models.metrics import Metrics + + +class SinglesendsResponseResultsInner: + def __init__( + self, + id: Optional[str] = None, + ab_variation: Optional[str] = None, + ab_phase: Optional[AbPhase] = None, + aggregation: Optional[str] = None, + stats: Optional[Metrics] = None, + ): + self.id = id + self.ab_variation = ab_variation + self.ab_phase = ab_phase + self.aggregation = aggregation + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "ab_variation": self.ab_variation, + "ab_phase": self.ab_phase, + "aggregation": self.aggregation, + "stats": self.stats, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SinglesendsResponseResultsInner( + id=payload.get("id"), + ab_variation=payload.get("ab_variation"), + ab_phase=payload.get("ab_phase"), + aggregation=payload.get("aggregation"), + stats=payload.get("stats"), + ) diff --git a/sendgrid/rest/api/mc_test/v3/__init__.py b/sendgrid/rest/api/mc_test/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/mc_test/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/mc_test/v3/models/__init__.py b/sendgrid/rest/api/mc_test/v3/models/__init__.py new file mode 100644 index 00000000..ee72e356 --- /dev/null +++ b/sendgrid/rest/api/mc_test/v3/models/__init__.py @@ -0,0 +1,24 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Send Test Email API + The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.mc_test.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.mc_test.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.mc_test.v3.models.send_test_marketing_email_request import ( + SendTestMarketingEmailRequest, +) + +__all__ = ["ErrorResponse", "ErrorResponseErrorsInner", "SendTestMarketingEmailRequest"] +# Testing code diff --git a/sendgrid/rest/api/mc_test/v3/models/error_response.py b/sendgrid/rest/api/mc_test/v3/models/error_response.py new file mode 100644 index 00000000..6584fff1 --- /dev/null +++ b/sendgrid/rest/api/mc_test/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.mc_test.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/mc_test/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/mc_test/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/mc_test/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/mc_test/v3/models/send_test_marketing_email_request.py b/sendgrid/rest/api/mc_test/v3/models/send_test_marketing_email_request.py new file mode 100644 index 00000000..d0eea073 --- /dev/null +++ b/sendgrid/rest/api/mc_test/v3/models/send_test_marketing_email_request.py @@ -0,0 +1,53 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SendTestMarketingEmailRequest: + def __init__( + self, + template_id: Optional[str] = None, + version_id_override: Optional[str] = None, + sender_id: Optional[int] = None, + custom_unsubscribe_url: Optional[str] = None, + suppression_group_id: Optional[int] = None, + emails: Optional[List[str]] = None, + from_address: Optional[str] = None, + ): + self.template_id = template_id + self.version_id_override = version_id_override + self.sender_id = sender_id + self.custom_unsubscribe_url = custom_unsubscribe_url + self.suppression_group_id = suppression_group_id + self.emails = emails + self.from_address = from_address + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "template_id": self.template_id, + "version_id_override": self.version_id_override, + "sender_id": self.sender_id, + "custom_unsubscribe_url": self.custom_unsubscribe_url, + "suppression_group_id": self.suppression_group_id, + "emails": self.emails, + "from_address": self.from_address, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SendTestMarketingEmailRequest( + template_id=payload.get("template_id"), + version_id_override=payload.get("version_id_override"), + sender_id=payload.get("sender_id"), + custom_unsubscribe_url=payload.get("custom_unsubscribe_url"), + suppression_group_id=payload.get("suppression_group_id"), + emails=payload.get("emails"), + from_address=payload.get("from_address"), + ) diff --git a/sendgrid/rest/api/mc_test/v3/send_test_marketing_email.py b/sendgrid/rest/api/mc_test/v3/send_test_marketing_email.py new file mode 100644 index 00000000..1e85114b --- /dev/null +++ b/sendgrid/rest/api/mc_test/v3/send_test_marketing_email.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Marketing Campaigns Send Test Email API + The Twilio SendGrid Test Email API allows you to test a marketing email by first sending it to a list of up to 10 email addresses before pushing to a contact list or segment. With this feature, you can test the layout and content of your message in multiple email clients and with multiple recipients to see how it will function in a real-world scenario. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.mc_test.v3.models.send_test_marketing_email_request import ( + SendTestMarketingEmailRequest, +) + + +class SendTestMarketingEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + send_test_marketing_email_request: Optional[ + SendTestMarketingEmailRequest + ] = None, + ): + path = "/v3/marketing/test/send_email" + + data = None + if send_test_marketing_email_request: + data = send_test_marketing_email_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/partner/v3/__init__.py b/sendgrid/rest/api/partner/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/partner/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/partner/v3/list_partner_setting.py b/sendgrid/rest/api/partner/v3/list_partner_setting.py new file mode 100644 index 00000000..83ca5242 --- /dev/null +++ b/sendgrid/rest/api/partner/v3/list_partner_setting.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Partner API + The Twilio SendGrid Partner Settings API allows you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners and how you can begin integrating with them, please visit our [Partners page](https://sendgrid.com/partners/marketplace/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListPartnerSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/partner_settings" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/partner/v3/models/__init__.py b/sendgrid/rest/api/partner/v3/models/__init__.py new file mode 100644 index 00000000..7ffa853a --- /dev/null +++ b/sendgrid/rest/api/partner/v3/models/__init__.py @@ -0,0 +1,23 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Partner API + The Twilio SendGrid Partner Settings API allows you to integrate your SendGrid account with our partners to increase your SendGrid experience and functionality. For more information about our partners and how you can begin integrating with them, please visit our [Partners page](https://sendgrid.com/partners/marketplace/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.partner.v3.models.list_partner_setting200_response import ( + ListPartnerSetting200Response, +) +from sendgrid.rest.api.partner.v3.models.list_partner_setting200_response_result_inner import ( + ListPartnerSetting200ResponseResultInner, +) + +__all__ = ["ListPartnerSetting200Response", "ListPartnerSetting200ResponseResultInner"] +# Testing code diff --git a/sendgrid/rest/api/partner/v3/models/list_partner_setting200_response.py b/sendgrid/rest/api/partner/v3/models/list_partner_setting200_response.py new file mode 100644 index 00000000..896c9695 --- /dev/null +++ b/sendgrid/rest/api/partner/v3/models/list_partner_setting200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.partner.v3.models.list_partner_setting200_response_result_inner import ( + ListPartnerSetting200ResponseResultInner, +) + + +class ListPartnerSetting200Response: + def __init__( + self, result: Optional[List[ListPartnerSetting200ResponseResultInner]] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListPartnerSetting200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/partner/v3/models/list_partner_setting200_response_result_inner.py b/sendgrid/rest/api/partner/v3/models/list_partner_setting200_response_result_inner.py new file mode 100644 index 00000000..2cf9c489 --- /dev/null +++ b/sendgrid/rest/api/partner/v3/models/list_partner_setting200_response_result_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListPartnerSetting200ResponseResultInner: + def __init__( + self, + title: Optional[str] = None, + enabled: Optional[bool] = None, + name: Optional[str] = None, + description: Optional[str] = None, + ): + self.title = title + self.enabled = enabled + self.name = name + self.description = description + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "title": self.title, + "enabled": self.enabled, + "name": self.name, + "description": self.description, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListPartnerSetting200ResponseResultInner( + title=payload.get("title"), + enabled=payload.get("enabled"), + name=payload.get("name"), + description=payload.get("description"), + ) diff --git a/sendgrid/rest/api/recipients_data_erasure/v3/__init__.py b/sendgrid/rest/api/recipients_data_erasure/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/recipients_data_erasure/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/recipients_data_erasure/v3/erase_recipient_email_data.py b/sendgrid/rest/api/recipients_data_erasure/v3/erase_recipient_email_data.py new file mode 100644 index 00000000..baa1bd73 --- /dev/null +++ b/sendgrid/rest/api/recipients_data_erasure/v3/erase_recipient_email_data.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Recipients' Data Erasure API + The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' personal data from the Twilio SendGrid Platform. The use of this API facilitates the self-service removal of email personal data from the Twilio SendGrid platform and will enable customers to comply with various obligatory data privacy regulations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.recipients_data_erasure.v3.models.recipients_data_erasure_erase_recipients_request import ( + RecipientsDataErasureEraseRecipientsRequest, +) + + +class EraseRecipientEmailData: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + recipients_data_erasure_erase_recipients_request: Optional[ + RecipientsDataErasureEraseRecipientsRequest + ] = None, + ): + path = "/v3/recipients/erasejob" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if recipients_data_erasure_erase_recipients_request: + data = recipients_data_erasure_erase_recipients_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/recipients_data_erasure/v3/models/__init__.py b/sendgrid/rest/api/recipients_data_erasure/v3/models/__init__.py new file mode 100644 index 00000000..5c40d63d --- /dev/null +++ b/sendgrid/rest/api/recipients_data_erasure/v3/models/__init__.py @@ -0,0 +1,30 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Recipients' Data Erasure API + The Recipients' Data Erasure API allows Twilio SendGrid customers to delete their own customers' personal data from the Twilio SendGrid Platform. The use of this API facilitates the self-service removal of email personal data from the Twilio SendGrid platform and will enable customers to comply with various obligatory data privacy regulations. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.recipients_data_erasure.v3.models.recipients_data_erasure_erase_recipients_request import ( + RecipientsDataErasureEraseRecipientsRequest, +) +from sendgrid.rest.api.recipients_data_erasure.v3.models.recipients_data_erasure_error_v1 import ( + RecipientsDataErasureErrorV1, +) +from sendgrid.rest.api.recipients_data_erasure.v3.models.recipients_data_erasure_job_id import ( + RecipientsDataErasureJobId, +) + +__all__ = [ + "RecipientsDataErasureEraseRecipientsRequest", + "RecipientsDataErasureErrorV1", + "RecipientsDataErasureJobId", +] +# Testing code diff --git a/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_erase_recipients_request.py b/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_erase_recipients_request.py new file mode 100644 index 00000000..7923dc6f --- /dev/null +++ b/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_erase_recipients_request.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class RecipientsDataErasureEraseRecipientsRequest: + def __init__(self, email_addresses: Optional[List[str]] = None): + self.email_addresses = email_addresses + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email_addresses": self.email_addresses}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return RecipientsDataErasureEraseRecipientsRequest( + email_addresses=payload.get("email_addresses") + ) diff --git a/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_error_v1.py b/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_error_v1.py new file mode 100644 index 00000000..9841373b --- /dev/null +++ b/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_error_v1.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class RecipientsDataErasureErrorV1: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return RecipientsDataErasureErrorV1( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_job_id.py b/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_job_id.py new file mode 100644 index 00000000..4ab14388 --- /dev/null +++ b/sendgrid/rest/api/recipients_data_erasure/v3/models/recipients_data_erasure_job_id.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class RecipientsDataErasureJobId: + def __init__(self, job_id: Optional[str] = None): + self.job_id = job_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"job_id": self.job_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return RecipientsDataErasureJobId(job_id=payload.get("job_id")) diff --git a/sendgrid/rest/api/reverse_dns/v3/__init__.py b/sendgrid/rest/api/reverse_dns/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/reverse_dns/v3/delete_reverse_dns.py b/sendgrid/rest/api/reverse_dns/v3/delete_reverse_dns.py new file mode 100644 index 00000000..60af46c8 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/delete_reverse_dns.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Reverse DNS API + The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteReverseDns: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/ips/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/get_reverse_dns.py b/sendgrid/rest/api/reverse_dns/v3/get_reverse_dns.py new file mode 100644 index 00000000..1d2ad9b6 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/get_reverse_dns.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Reverse DNS API + The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetReverseDns: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/ips/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/list_reverse_dns.py b/sendgrid/rest/api/reverse_dns/v3/list_reverse_dns.py new file mode 100644 index 00000000..4b1bbef1 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/list_reverse_dns.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Reverse DNS API + The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListReverseDns: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ip: Optional[str] = None, + ): + path = "/v3/whitelabel/ips" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/__init__.py b/sendgrid/rest/api/reverse_dns/v3/models/__init__.py new file mode 100644 index 00000000..e82850ce --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/__init__.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Reverse DNS API + The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.reverse_dns.v3.models.reverse_dns import ReverseDns +from sendgrid.rest.api.reverse_dns.v3.models.reverse_dns_a_record import ( + ReverseDnsARecord, +) +from sendgrid.rest.api.reverse_dns.v3.models.reverse_dns_users_inner import ( + ReverseDnsUsersInner, +) +from sendgrid.rest.api.reverse_dns.v3.models.set_up_reverse_dns_request import ( + SetUpReverseDnsRequest, +) +from sendgrid.rest.api.reverse_dns.v3.models.valid import Valid +from sendgrid.rest.api.reverse_dns.v3.models.valid1 import Valid1 +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns200_response import ( + ValidateReverseDns200Response, +) +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns200_response_validation_results import ( + ValidateReverseDns200ResponseValidationResults, +) +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns200_response_validation_results_a_record import ( + ValidateReverseDns200ResponseValidationResultsARecord, +) +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns404_response import ( + ValidateReverseDns404Response, +) +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns404_response_errors_inner import ( + ValidateReverseDns404ResponseErrorsInner, +) +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns500_response import ( + ValidateReverseDns500Response, +) +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns500_response_errors_inner import ( + ValidateReverseDns500ResponseErrorsInner, +) + +__all__ = [ + "ReverseDns", + "ReverseDnsARecord", + "ReverseDnsUsersInner", + "SetUpReverseDnsRequest", + "Valid", + "Valid1", + "ValidateReverseDns200Response", + "ValidateReverseDns200ResponseValidationResults", + "ValidateReverseDns200ResponseValidationResultsARecord", + "ValidateReverseDns404Response", + "ValidateReverseDns404ResponseErrorsInner", + "ValidateReverseDns500Response", + "ValidateReverseDns500ResponseErrorsInner", +] +# Testing code diff --git a/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns.py b/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns.py new file mode 100644 index 00000000..198fc2e9 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns.py @@ -0,0 +1,71 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.reverse_dns.v3.models.reverse_dns_a_record import ( + ReverseDnsARecord, +) +from sendgrid.rest.api.reverse_dns.v3.models.reverse_dns_users_inner import ( + ReverseDnsUsersInner, +) + + +class ReverseDns: + def __init__( + self, + id: Optional[int] = None, + ip: Optional[str] = None, + rdns: Optional[str] = None, + users: Optional[List[ReverseDnsUsersInner]] = None, + subdomain: Optional[str] = None, + domain: Optional[str] = None, + valid: Optional[bool] = None, + legacy: Optional[bool] = None, + last_validation_attempt_at: Optional[int] = None, + a_record: Optional[ReverseDnsARecord] = None, + ): + self.id = id + self.ip = ip + self.rdns = rdns + self.users = users + self.subdomain = subdomain + self.domain = domain + self.valid = valid + self.legacy = legacy + self.last_validation_attempt_at = last_validation_attempt_at + self.a_record = a_record + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "ip": self.ip, + "rdns": self.rdns, + "users": self.users, + "subdomain": self.subdomain, + "domain": self.domain, + "valid": self.valid, + "legacy": self.legacy, + "last_validation_attempt_at": self.last_validation_attempt_at, + "a_record": self.a_record, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ReverseDns( + id=payload.get("id"), + ip=payload.get("ip"), + rdns=payload.get("rdns"), + users=payload.get("users"), + subdomain=payload.get("subdomain"), + domain=payload.get("domain"), + valid=payload.get("valid"), + legacy=payload.get("legacy"), + last_validation_attempt_at=payload.get("last_validation_attempt_at"), + a_record=payload.get("a_record"), + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_a_record.py b/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_a_record.py new file mode 100644 index 00000000..1bfee5da --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_a_record.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ReverseDnsARecord: + def __init__( + self, + valid: Optional[bool] = None, + type: Optional[str] = None, + host: Optional[str] = None, + data: Optional[str] = None, + ): + self.valid = valid + self.type = type + self.host = host + self.data = data + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "valid": self.valid, + "type": self.type, + "host": self.host, + "data": self.data, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ReverseDnsARecord( + valid=payload.get("valid"), + type=payload.get("type"), + host=payload.get("host"), + data=payload.get("data"), + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_users_inner.py b/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_users_inner.py new file mode 100644 index 00000000..962fca06 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/reverse_dns_users_inner.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ReverseDnsUsersInner: + def __init__(self, username: Optional[str] = None, user_id: Optional[int] = None): + self.username = username + self.user_id = user_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "user_id": self.user_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ReverseDnsUsersInner( + username=payload.get("username"), user_id=payload.get("user_id") + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/set_up_reverse_dns_request.py b/sendgrid/rest/api/reverse_dns/v3/models/set_up_reverse_dns_request.py new file mode 100644 index 00000000..b8a552ec --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/set_up_reverse_dns_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SetUpReverseDnsRequest: + def __init__( + self, + ip: Optional[str] = None, + subdomain: Optional[str] = None, + domain: Optional[str] = None, + ): + self.ip = ip + self.subdomain = subdomain + self.domain = domain + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "ip": self.ip, + "subdomain": self.subdomain, + "domain": self.domain, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SetUpReverseDnsRequest( + ip=payload.get("ip"), + subdomain=payload.get("subdomain"), + domain=payload.get("domain"), + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/valid.py b/sendgrid/rest/api/reverse_dns/v3/models/valid.py new file mode 100644 index 00000000..570b350b --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/valid.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/reverse_dns/v3/models/valid1.py b/sendgrid/rest/api/reverse_dns/v3/models/valid1.py new file mode 100644 index 00000000..60adc23f --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/valid1.py @@ -0,0 +1,11 @@ +from enum import Enum +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from enum import Enum + + + +class Valid1(Enum): + NUMBER_'true'='true' + NUMBER_'false'='false' + diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response.py new file mode 100644 index 00000000..b9da37a5 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response.py @@ -0,0 +1,43 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.reverse_dns.v3.models.valid import Valid +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns200_response_validation_results import ( + ValidateReverseDns200ResponseValidationResults, +) + + +class ValidateReverseDns200Response: + def __init__( + self, + id: Optional[int] = None, + valid: Optional[Valid] = None, + validation_results: Optional[ + ValidateReverseDns200ResponseValidationResults + ] = None, + ): + self.id = id + self.valid = valid + self.validation_results = validation_results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "valid": self.valid, + "validation_results": self.validation_results, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns200Response( + id=payload.get("id"), + valid=payload.get("valid"), + validation_results=payload.get("validation_results"), + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results.py new file mode 100644 index 00000000..c4b5ac99 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns200_response_validation_results_a_record import ( + ValidateReverseDns200ResponseValidationResultsARecord, +) + + +class ValidateReverseDns200ResponseValidationResults: + def __init__( + self, + a_record: Optional[ + ValidateReverseDns200ResponseValidationResultsARecord + ] = None, + ): + self.a_record = a_record + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"a_record": self.a_record}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns200ResponseValidationResults( + a_record=payload.get("a_record") + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results_a_record.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results_a_record.py new file mode 100644 index 00000000..0e50c18b --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns200_response_validation_results_a_record.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.reverse_dns.v3.models.valid1 import Valid1 + + +class ValidateReverseDns200ResponseValidationResultsARecord: + def __init__(self, valid: Optional[Valid1] = None, reason: Optional[str] = None): + self.valid = valid + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"valid": self.valid, "reason": self.reason}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns200ResponseValidationResultsARecord( + valid=payload.get("valid"), reason=payload.get("reason") + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response.py new file mode 100644 index 00000000..df9bb43a --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns404_response_errors_inner import ( + ValidateReverseDns404ResponseErrorsInner, +) + + +class ValidateReverseDns404Response: + def __init__( + self, errors: Optional[List[ValidateReverseDns404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response_errors_inner.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response_errors_inner.py new file mode 100644 index 00000000..459ed760 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns404_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateReverseDns404ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns404ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response.py new file mode 100644 index 00000000..a2b80732 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.reverse_dns.v3.models.validate_reverse_dns500_response_errors_inner import ( + ValidateReverseDns500ResponseErrorsInner, +) + + +class ValidateReverseDns500Response: + def __init__( + self, errors: Optional[List[ValidateReverseDns500ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns500Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response_errors_inner.py b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response_errors_inner.py new file mode 100644 index 00000000..73ff71dd --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/models/validate_reverse_dns500_response_errors_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ValidateReverseDns500ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ValidateReverseDns500ResponseErrorsInner(message=payload.get("message")) diff --git a/sendgrid/rest/api/reverse_dns/v3/set_up_reverse_dns.py b/sendgrid/rest/api/reverse_dns/v3/set_up_reverse_dns.py new file mode 100644 index 00000000..12cf8b49 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/set_up_reverse_dns.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Reverse DNS API + The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.reverse_dns.v3.models.set_up_reverse_dns_request import ( + SetUpReverseDnsRequest, +) + + +class SetUpReverseDns: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + set_up_reverse_dns_request: Optional[SetUpReverseDnsRequest] = None, + ): + path = "/v3/whitelabel/ips" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if set_up_reverse_dns_request: + data = set_up_reverse_dns_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/reverse_dns/v3/validate_reverse_dns.py b/sendgrid/rest/api/reverse_dns/v3/validate_reverse_dns.py new file mode 100644 index 00000000..f21442e1 --- /dev/null +++ b/sendgrid/rest/api/reverse_dns/v3/validate_reverse_dns.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Reverse DNS API + The Twilio SendGrid Reverse DNS API (formerly IP Whitelabel) allows you to configure reverse DNS settings for your account. Mailbox providers verify the sender of your emails by performing a reverse DNS lookup. When setting up Reverse DNS, Twilio SendGrid will provide an A Record (address record) for you to add to the DNS records of your sending domain. The A record maps your sending domain to a dedicated Twilio SendGrid IP address. Once Twilio SendGrid has verified that the appropriate A record for the IP address has been created, the appropriate reverse DNS record for the IP address is generated. Reverse DNS is available for [dedicated IP addresses](https://sendgrid.com/docs/ui/account-and-settings/dedicated-ip-addresses/) only. You can also manage your reverse DNS settings in the Sender Authentication setion of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**How to Set Up Reverse DNS**](https://sendgrid.com/docs/ui/account-and-settings/how-to-set-up-reverse-dns/) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ValidateReverseDns: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/whitelabel/ips/{id}/validate" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/__init__.py b/sendgrid/rest/api/scheduled_sends/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/scheduled_sends/v3/create_scheduled_send.py b/sendgrid/rest/api/scheduled_sends/v3/create_scheduled_send.py new file mode 100644 index 00000000..e5beed8c --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/create_scheduled_send.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scheduled Sends API + The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.scheduled_sends.v3.models.cancel_or_pause_a_scheduled_send_request import ( + CancelOrPauseAScheduledSendRequest, +) + + +class CreateScheduledSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + cancel_or_pause_a_scheduled_send_request: Optional[ + CancelOrPauseAScheduledSendRequest + ] = None, + ): + path = "/v3/user/scheduled_sends" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if cancel_or_pause_a_scheduled_send_request: + data = cancel_or_pause_a_scheduled_send_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/delete_scheduled_send.py b/sendgrid/rest/api/scheduled_sends/v3/delete_scheduled_send.py new file mode 100644 index 00000000..4127722c --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/delete_scheduled_send.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scheduled Sends API + The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteScheduledSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + batch_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/scheduled_sends/{batch_id}" + path = path.format( + batch_id=batch_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/get_scheduled_send.py b/sendgrid/rest/api/scheduled_sends/v3/get_scheduled_send.py new file mode 100644 index 00000000..21e8a47a --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/get_scheduled_send.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scheduled Sends API + The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetScheduledSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + batch_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/scheduled_sends/{batch_id}" + path = path.format( + batch_id=batch_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/list_scheduled_send.py b/sendgrid/rest/api/scheduled_sends/v3/list_scheduled_send.py new file mode 100644 index 00000000..b01e75e1 --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/list_scheduled_send.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scheduled Sends API + The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListScheduledSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/scheduled_sends" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/__init__.py b/sendgrid/rest/api/scheduled_sends/v3/models/__init__.py new file mode 100644 index 00000000..d89f7e04 --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/__init__.py @@ -0,0 +1,44 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scheduled Sends API + The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.scheduled_sends.v3.models.cancel_or_pause_a_scheduled_send_request import ( + CancelOrPauseAScheduledSendRequest, +) +from sendgrid.rest.api.scheduled_sends.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.scheduled_sends.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.scheduled_sends.v3.models.mail_batch_id import MailBatchId +from sendgrid.rest.api.scheduled_sends.v3.models.scheduled_send_status import ( + ScheduledSendStatus, +) +from sendgrid.rest.api.scheduled_sends.v3.models.status import Status +from sendgrid.rest.api.scheduled_sends.v3.models.status1 import Status1 +from sendgrid.rest.api.scheduled_sends.v3.models.status2 import Status2 +from sendgrid.rest.api.scheduled_sends.v3.models.update_scheduled_send_request import ( + UpdateScheduledSendRequest, +) + +__all__ = [ + "CancelOrPauseAScheduledSendRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "MailBatchId", + "ScheduledSendStatus", + "Status", + "Status1", + "Status2", + "UpdateScheduledSendRequest", +] +# Testing code diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/cancel_or_pause_a_scheduled_send_request.py b/sendgrid/rest/api/scheduled_sends/v3/models/cancel_or_pause_a_scheduled_send_request.py new file mode 100644 index 00000000..bd13b66a --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/cancel_or_pause_a_scheduled_send_request.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scheduled_sends.v3.models.status import Status + + +class CancelOrPauseAScheduledSendRequest: + def __init__(self, batch_id: Optional[str] = None, status: Optional[Status] = None): + self.batch_id = batch_id + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"batch_id": self.batch_id, "status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CancelOrPauseAScheduledSendRequest( + batch_id=payload.get("batch_id"), status=payload.get("status") + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/error_response.py b/sendgrid/rest/api/scheduled_sends/v3/models/error_response.py new file mode 100644 index 00000000..3a4efebc --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scheduled_sends.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/scheduled_sends/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/mail_batch_id.py b/sendgrid/rest/api/scheduled_sends/v3/models/mail_batch_id.py new file mode 100644 index 00000000..350826f8 --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/mail_batch_id.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class MailBatchId: + def __init__(self, batch_id: Optional[str] = None): + self.batch_id = batch_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"batch_id": self.batch_id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return MailBatchId(batch_id=payload.get("batch_id")) diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/scheduled_send_status.py b/sendgrid/rest/api/scheduled_sends/v3/models/scheduled_send_status.py new file mode 100644 index 00000000..4a8c32ca --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/scheduled_send_status.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scheduled_sends.v3.models.status2 import Status2 + + +class ScheduledSendStatus: + def __init__( + self, batch_id: Optional[str] = None, status: Optional[Status2] = None + ): + self.batch_id = batch_id + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"batch_id": self.batch_id, "status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ScheduledSendStatus( + batch_id=payload.get("batch_id"), status=payload.get("status") + ) diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/status.py b/sendgrid/rest/api/scheduled_sends/v3/models/status.py new file mode 100644 index 00000000..140a2a10 --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/status.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Status(Enum): + PAUSE = "pause" + CANCEL = "cancel" diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/status1.py b/sendgrid/rest/api/scheduled_sends/v3/models/status1.py new file mode 100644 index 00000000..2dd755fe --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/status1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Status1(Enum): + CANCEL = "cancel" + PAUSE = "pause" diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/status2.py b/sendgrid/rest/api/scheduled_sends/v3/models/status2.py new file mode 100644 index 00000000..8fa7674b --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/status2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Status2(Enum): + CANCEL = "cancel" + PAUSE = "pause" diff --git a/sendgrid/rest/api/scheduled_sends/v3/models/update_scheduled_send_request.py b/sendgrid/rest/api/scheduled_sends/v3/models/update_scheduled_send_request.py new file mode 100644 index 00000000..49ed44d7 --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/models/update_scheduled_send_request.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scheduled_sends.v3.models.status1 import Status1 + + +class UpdateScheduledSendRequest: + def __init__(self, status: Optional[Status1] = None): + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"status": self.status}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateScheduledSendRequest(status=payload.get("status")) diff --git a/sendgrid/rest/api/scheduled_sends/v3/update_scheduled_send.py b/sendgrid/rest/api/scheduled_sends/v3/update_scheduled_send.py new file mode 100644 index 00000000..a26567ce --- /dev/null +++ b/sendgrid/rest/api/scheduled_sends/v3/update_scheduled_send.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scheduled Sends API + The Twilio SendGrid Scheduled Sends API allows you to cancel or pause the send of one or more emails using a batch ID. A `batch_id` groups multiple scheduled mail send requests together with the same ID. You can cancel or pause all of the requests associated with a batch ID up to 10 minutes before the scheduled send time. See [**Canceling a Scheduled Send**](https://docs.sendgrid.com/for-developers/sending-email/stopping-a-scheduled-send) for a guide on creating a `batch_id`, assigning it to a scheduled send, and modifying the send. See the Mail API's batching operations to validate a `batch_id` and retrieve all scheduled sends as an array. When a batch is canceled, all messages associated with that batch will stay in your sending queue. When their `send_at` value is reached, they will be discarded. When a batch is paused, all messages associated with that batch will stay in your sending queue, even after their `send_at` value has passed. This means you can remove a pause status, and your scheduled send will be delivered once the pause is removed. Any messages left with a pause status that are more than 72 hours old will be discarded as Expired. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.scheduled_sends.v3.models.update_scheduled_send_request import ( + UpdateScheduledSendRequest, +) + + +class UpdateScheduledSend: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + batch_id: str, + on_behalf_of: Optional[str] = None, + update_scheduled_send_request: Optional[UpdateScheduledSendRequest] = None, + ): + path = "/v3/user/scheduled_sends/{batch_id}" + path = path.format( + batch_id=batch_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_scheduled_send_request: + data = update_scheduled_send_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scopes/v3/__init__.py b/sendgrid/rest/api/scopes/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/scopes/v3/approve_scope_request.py b/sendgrid/rest/api/scopes/v3/approve_scope_request.py new file mode 100644 index 00000000..441d0ada --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/approve_scope_request.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scopes API + The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ApproveScopeRequest: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + request_id: str, + ): + path = "/v3/scopes/requests/{request_id}/approve" + path = path.format( + request_id=request_id, + ) + + data = None + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scopes/v3/deny_scope_request.py b/sendgrid/rest/api/scopes/v3/deny_scope_request.py new file mode 100644 index 00000000..702f5f3d --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/deny_scope_request.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scopes API + The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DenyScopeRequest: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + request_id: str, + ): + path = "/v3/scopes/requests/{request_id}" + path = path.format( + request_id=request_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scopes/v3/list_scope.py b/sendgrid/rest/api/scopes/v3/list_scope.py new file mode 100644 index 00000000..b2adbcc1 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/list_scope.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scopes API + The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListScope: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/scopes" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scopes/v3/list_scope_request.py b/sendgrid/rest/api/scopes/v3/list_scope_request.py new file mode 100644 index 00000000..aac12222 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/list_scope_request.py @@ -0,0 +1,53 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scopes API + The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListScopeRequest: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/scopes/requests" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/scopes/v3/models/__init__.py b/sendgrid/rest/api/scopes/v3/models/__init__.py new file mode 100644 index 00000000..832161e1 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/__init__.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Scopes API + The Twilio SendGrid Scopes API allows you to retrieve the scopes or permissions available to a user, see the user's attempts to access your SendGrid account, and, if necessary, deny an access request. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.scopes.v3.models.approve_scope_request200_response import ( + ApproveScopeRequest200Response, +) +from sendgrid.rest.api.scopes.v3.models.deny_scope_request404_response import ( + DenyScopeRequest404Response, +) +from sendgrid.rest.api.scopes.v3.models.deny_scope_request404_response_errors_inner import ( + DenyScopeRequest404ResponseErrorsInner, +) +from sendgrid.rest.api.scopes.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.scopes.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.scopes.v3.models.list_scope200_response import ( + ListScope200Response, +) +from sendgrid.rest.api.scopes.v3.models.list_scope401_response import ( + ListScope401Response, +) +from sendgrid.rest.api.scopes.v3.models.list_scope401_response_errors_inner import ( + ListScope401ResponseErrorsInner, +) +from sendgrid.rest.api.scopes.v3.models.list_scope_request200_response_inner import ( + ListScopeRequest200ResponseInner, +) + +__all__ = [ + "ApproveScopeRequest200Response", + "DenyScopeRequest404Response", + "DenyScopeRequest404ResponseErrorsInner", + "ErrorResponse", + "ErrorResponseErrorsInner", + "ListScope200Response", + "ListScope401Response", + "ListScope401ResponseErrorsInner", + "ListScopeRequest200ResponseInner", +] +# Testing code diff --git a/sendgrid/rest/api/scopes/v3/models/approve_scope_request200_response.py b/sendgrid/rest/api/scopes/v3/models/approve_scope_request200_response.py new file mode 100644 index 00000000..b9c822d1 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/approve_scope_request200_response.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ApproveScopeRequest200Response: + def __init__(self, scope_group_name: Optional[str] = None): + self.scope_group_name = scope_group_name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"scope_group_name": self.scope_group_name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ApproveScopeRequest200Response( + scope_group_name=payload.get("scope_group_name") + ) diff --git a/sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response.py b/sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response.py new file mode 100644 index 00000000..8e2ff9ba --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scopes.v3.models.deny_scope_request404_response_errors_inner import ( + DenyScopeRequest404ResponseErrorsInner, +) + + +class DenyScopeRequest404Response: + def __init__( + self, errors: Optional[List[DenyScopeRequest404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DenyScopeRequest404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response_errors_inner.py b/sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response_errors_inner.py new file mode 100644 index 00000000..4865c12e --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/deny_scope_request404_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DenyScopeRequest404ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DenyScopeRequest404ResponseErrorsInner( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/scopes/v3/models/error_response.py b/sendgrid/rest/api/scopes/v3/models/error_response.py new file mode 100644 index 00000000..cbbfd0f1 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scopes.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/scopes/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/scopes/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/scopes/v3/models/list_scope200_response.py b/sendgrid/rest/api/scopes/v3/models/list_scope200_response.py new file mode 100644 index 00000000..64ff65a7 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/list_scope200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListScope200Response: + def __init__(self, scopes: Optional[List[str]] = None): + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"scopes": self.scopes}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListScope200Response(scopes=payload.get("scopes")) diff --git a/sendgrid/rest/api/scopes/v3/models/list_scope401_response.py b/sendgrid/rest/api/scopes/v3/models/list_scope401_response.py new file mode 100644 index 00000000..eec5ffd9 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/list_scope401_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.scopes.v3.models.list_scope401_response_errors_inner import ( + ListScope401ResponseErrorsInner, +) + + +class ListScope401Response: + def __init__(self, errors: Optional[List[ListScope401ResponseErrorsInner]] = None): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListScope401Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/scopes/v3/models/list_scope401_response_errors_inner.py b/sendgrid/rest/api/scopes/v3/models/list_scope401_response_errors_inner.py new file mode 100644 index 00000000..e4368e54 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/list_scope401_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListScope401ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListScope401ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/scopes/v3/models/list_scope_request200_response_inner.py b/sendgrid/rest/api/scopes/v3/models/list_scope_request200_response_inner.py new file mode 100644 index 00000000..be3b62c5 --- /dev/null +++ b/sendgrid/rest/api/scopes/v3/models/list_scope_request200_response_inner.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListScopeRequest200ResponseInner: + def __init__( + self, + id: Optional[int] = None, + scope_group_name: Optional[str] = None, + username: Optional[str] = None, + email: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + ): + self.id = id + self.scope_group_name = scope_group_name + self.username = username + self.email = email + self.first_name = first_name + self.last_name = last_name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "scope_group_name": self.scope_group_name, + "username": self.username, + "email": self.email, + "first_name": self.first_name, + "last_name": self.last_name, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListScopeRequest200ResponseInner( + id=payload.get("id"), + scope_group_name=payload.get("scope_group_name"), + username=payload.get("username"), + email=payload.get("email"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + ) diff --git a/sendgrid/rest/api/seq/v3/__init__.py b/sendgrid/rest/api/seq/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/seq/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/seq/v3/list_engagement_quality_score.py b/sendgrid/rest/api/seq/v3/list_engagement_quality_score.py new file mode 100644 index 00000000..7857ab9b --- /dev/null +++ b/sendgrid/rest/api/seq/v3/list_engagement_quality_score.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Engagement Quality API + The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from datetime import date +from typing import Optional + + +class ListEngagementQualityScore: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + var_from: Optional[date] = None, + to: Optional[date] = None, + ): + path = "/v3/engagementquality/scores" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/seq/v3/list_subuser_engagement_quality_score.py b/sendgrid/rest/api/seq/v3/list_subuser_engagement_quality_score.py new file mode 100644 index 00000000..76b269e3 --- /dev/null +++ b/sendgrid/rest/api/seq/v3/list_subuser_engagement_quality_score.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Engagement Quality API + The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from datetime import date +from typing import Optional + + +class ListSubuserEngagementQualityScore: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + var_date: Optional[date] = None, + after_key: Optional[int] = None, + ): + path = "/v3/engagementquality/subusers/scores" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/seq/v3/models/__init__.py b/sendgrid/rest/api/seq/v3/models/__init__.py new file mode 100644 index 00000000..cdaa354f --- /dev/null +++ b/sendgrid/rest/api/seq/v3/models/__init__.py @@ -0,0 +1,24 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Engagement Quality API + The SendGrid Engagement Quality (SEQ) API allows you to retrieve metrics that define the quality of your email program. An SEQ score is correlated with: - The quality of the data in a sender’s program. - How “wanted” the sender's email is by their recipients. Because “wanted” email and deliverability are closely related, a higher SEQ metric is correlated with greater deliverability. This means the higher your SEQ score, the more likely you are to land in your recipients' inboxes. See the SEQ Overview page to understand SEQ, how it's calculated, and how you can address your score. The SEQ endpoints allow you to retrieve your scores and scores for your Subusers. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.seq.v3.models.seq_error import SeqError +from sendgrid.rest.api.seq.v3.models.seq_metadata import SeqMetadata +from sendgrid.rest.api.seq.v3.models.seq_metadata_next_params import ( + SeqMetadataNextParams, +) +from sendgrid.rest.api.seq.v3.models.seq_metrics import SeqMetrics +from sendgrid.rest.api.seq.v3.models.seq_score import SeqScore + +__all__ = ["SeqError", "SeqMetadata", "SeqMetadataNextParams", "SeqMetrics", "SeqScore"] +# Testing code diff --git a/sendgrid/rest/api/seq/v3/models/seq_error.py b/sendgrid/rest/api/seq/v3/models/seq_error.py new file mode 100644 index 00000000..99a4da74 --- /dev/null +++ b/sendgrid/rest/api/seq/v3/models/seq_error.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SeqError: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SeqError(field=payload.get("field"), message=payload.get("message")) diff --git a/sendgrid/rest/api/seq/v3/models/seq_metadata.py b/sendgrid/rest/api/seq/v3/models/seq_metadata.py new file mode 100644 index 00000000..2e0a80f7 --- /dev/null +++ b/sendgrid/rest/api/seq/v3/models/seq_metadata.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.seq.v3.models.seq_metadata_next_params import ( + SeqMetadataNextParams, +) + + +class SeqMetadata: + def __init__(self, next_params: Optional[SeqMetadataNextParams] = None): + self.next_params = next_params + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"next_params": self.next_params}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SeqMetadata(next_params=payload.get("next_params")) diff --git a/sendgrid/rest/api/seq/v3/models/seq_metadata_next_params.py b/sendgrid/rest/api/seq/v3/models/seq_metadata_next_params.py new file mode 100644 index 00000000..3688fcd8 --- /dev/null +++ b/sendgrid/rest/api/seq/v3/models/seq_metadata_next_params.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SeqMetadataNextParams: + def __init__(self, after_key: Optional[str] = None): + self.after_key = after_key + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"after_key": self.after_key}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SeqMetadataNextParams(after_key=payload.get("after_key")) diff --git a/sendgrid/rest/api/seq/v3/models/seq_metrics.py b/sendgrid/rest/api/seq/v3/models/seq_metrics.py new file mode 100644 index 00000000..1a4dc111 --- /dev/null +++ b/sendgrid/rest/api/seq/v3/models/seq_metrics.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SeqMetrics: + def __init__( + self, + engagement_recency: Optional[float] = None, + open_rate: Optional[float] = None, + bounce_classification: Optional[float] = None, + bounce_rate: Optional[float] = None, + spam_rate: Optional[float] = None, + ): + self.engagement_recency = engagement_recency + self.open_rate = open_rate + self.bounce_classification = bounce_classification + self.bounce_rate = bounce_rate + self.spam_rate = spam_rate + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "engagement_recency": self.engagement_recency, + "open_rate": self.open_rate, + "bounce_classification": self.bounce_classification, + "bounce_rate": self.bounce_rate, + "spam_rate": self.spam_rate, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SeqMetrics( + engagement_recency=payload.get("engagement_recency"), + open_rate=payload.get("open_rate"), + bounce_classification=payload.get("bounce_classification"), + bounce_rate=payload.get("bounce_rate"), + spam_rate=payload.get("spam_rate"), + ) diff --git a/sendgrid/rest/api/seq/v3/models/seq_score.py b/sendgrid/rest/api/seq/v3/models/seq_score.py new file mode 100644 index 00000000..b51e3eed --- /dev/null +++ b/sendgrid/rest/api/seq/v3/models/seq_score.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.seq.v3.models.seq_metrics import SeqMetrics + + +class SeqScore: + def __init__( + self, + user_id: Optional[str] = None, + username: Optional[str] = None, + var_date: Optional[date] = None, + score: Optional[float] = None, + metrics: Optional[SeqMetrics] = None, + ): + self.user_id = user_id + self.username = username + self.var_date = var_date + self.score = score + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "user_id": self.user_id, + "username": self.username, + "date": self.var_date, + "score": self.score, + "metrics": self.metrics, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SeqScore( + user_id=payload.get("user_id"), + username=payload.get("username"), + var_date=payload.get("date"), + score=payload.get("score"), + metrics=payload.get("metrics"), + ) diff --git a/sendgrid/rest/api/sso/v3/__init__.py b/sendgrid/rest/api/sso/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/sso/v3/create_sso_certificate.py b/sendgrid/rest/api/sso/v3/create_sso_certificate.py new file mode 100644 index 00000000..cb38af94 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/create_sso_certificate.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.sso.v3.models.create_sso_certificate_request import ( + CreateSsoCertificateRequest, +) + + +class CreateSsoCertificate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + create_sso_certificate_request: Optional[CreateSsoCertificateRequest] = None, + ): + path = "/v3/sso/certificates" + + data = None + if create_sso_certificate_request: + data = create_sso_certificate_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/create_sso_integration.py b/sendgrid/rest/api/sso/v3/create_sso_integration.py new file mode 100644 index 00000000..99ba3356 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/create_sso_integration.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.sso.v3.models.post_patch_integration_request import ( + PostPatchIntegrationRequest, +) + + +class CreateSsoIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + post_patch_integration_request: Optional[PostPatchIntegrationRequest] = None, + ): + path = "/v3/sso/integrations" + + data = None + if post_patch_integration_request: + data = post_patch_integration_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/create_sso_teammate.py b/sendgrid/rest/api/sso/v3/create_sso_teammate.py new file mode 100644 index 00000000..7a0beb08 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/create_sso_teammate.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.sso.v3.models.post_sso_teammates_request import ( + PostSsoTeammatesRequest, +) + + +class CreateSsoTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + post_sso_teammates_request: Optional[PostSsoTeammatesRequest] = None, + ): + path = "/v3/sso/teammates" + + data = None + if post_sso_teammates_request: + data = post_sso_teammates_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/delete_sso_certificate.py b/sendgrid/rest/api/sso/v3/delete_sso_certificate.py new file mode 100644 index 00000000..b5a5d381 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/delete_sso_certificate.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteSsoCertificate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + cert_id: str, + ): + path = "/v3/sso/certificates/{cert_id}" + path = path.format( + cert_id=cert_id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/delete_sso_integration.py b/sendgrid/rest/api/sso/v3/delete_sso_integration.py new file mode 100644 index 00000000..7a4ced34 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/delete_sso_integration.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteSsoIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/sso/integrations/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/get_sso_certificate.py b/sendgrid/rest/api/sso/v3/get_sso_certificate.py new file mode 100644 index 00000000..edd59adb --- /dev/null +++ b/sendgrid/rest/api/sso/v3/get_sso_certificate.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetSsoCertificate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + cert_id: str, + ): + path = "/v3/sso/certificates/{cert_id}" + path = path.format( + cert_id=cert_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/get_sso_integration.py b/sendgrid/rest/api/sso/v3/get_sso_integration.py new file mode 100644 index 00000000..9217b39c --- /dev/null +++ b/sendgrid/rest/api/sso/v3/get_sso_integration.py @@ -0,0 +1,56 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSsoIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + si: Optional[bool] = None, + ): + path = "/v3/sso/integrations/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/list_sso_integration.py b/sendgrid/rest/api/sso/v3/list_sso_integration.py new file mode 100644 index 00000000..9f43967d --- /dev/null +++ b/sendgrid/rest/api/sso/v3/list_sso_integration.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSsoIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + si: Optional[bool] = None, + ): + path = "/v3/sso/integrations" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/list_sso_integration_certificate.py b/sendgrid/rest/api/sso/v3/list_sso_integration_certificate.py new file mode 100644 index 00000000..07cc660e --- /dev/null +++ b/sendgrid/rest/api/sso/v3/list_sso_integration_certificate.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListSsoIntegrationCertificate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + integration_id: str, + ): + path = "/v3/sso/integrations/{integration_id}/certificates" + path = path.format( + integration_id=integration_id, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/models/__init__.py b/sendgrid/rest/api/sso/v3/models/__init__.py new file mode 100644 index 00000000..218c5fef --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/__init__.py @@ -0,0 +1,74 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.sso.v3.models.create_sso_certificate_request import ( + CreateSsoCertificateRequest, +) +from sendgrid.rest.api.sso.v3.models.patch_sso_teammates200 import PatchSsoTeammates200 +from sendgrid.rest.api.sso.v3.models.permission_type import PermissionType +from sendgrid.rest.api.sso.v3.models.permission_type1 import PermissionType1 +from sendgrid.rest.api.sso.v3.models.persona import Persona +from sendgrid.rest.api.sso.v3.models.post_patch_integration_request import ( + PostPatchIntegrationRequest, +) +from sendgrid.rest.api.sso.v3.models.post_sso_teammates201 import PostSsoTeammates201 +from sendgrid.rest.api.sso.v3.models.post_sso_teammates_request import ( + PostSsoTeammatesRequest, +) +from sendgrid.rest.api.sso.v3.models.sso_certificate_body import SsoCertificateBody +from sendgrid.rest.api.sso.v3.models.sso_error_response_inner import ( + SsoErrorResponseInner, +) +from sendgrid.rest.api.sso.v3.models.sso_integration import SsoIntegration +from sendgrid.rest.api.sso.v3.models.sso_teammates_base_request_props import ( + SsoTeammatesBaseRequestProps, +) +from sendgrid.rest.api.sso.v3.models.sso_teammates_base_request_props_subuser_access_inner import ( + SsoTeammatesBaseRequestPropsSubuserAccessInner, +) +from sendgrid.rest.api.sso.v3.models.sso_teammates_base_response_props import ( + SsoTeammatesBaseResponseProps, +) +from sendgrid.rest.api.sso.v3.models.sso_teammates_restricted_subuser_response_props import ( + SsoTeammatesRestrictedSubuserResponseProps, +) +from sendgrid.rest.api.sso.v3.models.sso_teammates_restricted_subuser_response_props_subuser_access_inner import ( + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner, +) +from sendgrid.rest.api.sso.v3.models.update_sso_certificate_request import ( + UpdateSsoCertificateRequest, +) +from sendgrid.rest.api.sso.v3.models.user_type import UserType + +__all__ = [ + "CreateSsoCertificateRequest", + "PatchSsoTeammates200", + "PermissionType", + "PermissionType1", + "Persona", + "PostPatchIntegrationRequest", + "PostSsoTeammates201", + "PostSsoTeammatesRequest", + "SsoCertificateBody", + "SsoErrorResponseInner", + "SsoIntegration", + "SsoTeammatesBaseRequestProps", + "SsoTeammatesBaseRequestPropsSubuserAccessInner", + "SsoTeammatesBaseResponseProps", + "SsoTeammatesRestrictedSubuserResponseProps", + "SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner", + "UpdateSsoCertificateRequest", + "UserType", +] +# Testing code diff --git a/sendgrid/rest/api/sso/v3/models/create_sso_certificate_request.py b/sendgrid/rest/api/sso/v3/models/create_sso_certificate_request.py new file mode 100644 index 00000000..28a144e1 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/create_sso_certificate_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateSsoCertificateRequest: + def __init__( + self, + public_certificate: Optional[str] = None, + enabled: Optional[bool] = None, + integration_id: Optional[str] = None, + ): + self.public_certificate = public_certificate + self.enabled = enabled + self.integration_id = integration_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "public_certificate": self.public_certificate, + "enabled": self.enabled, + "integration_id": self.integration_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSsoCertificateRequest( + public_certificate=payload.get("public_certificate"), + enabled=payload.get("enabled"), + integration_id=payload.get("integration_id"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/patch_sso_teammates200.py b/sendgrid/rest/api/sso/v3/models/patch_sso_teammates200.py new file mode 100644 index 00000000..9b6d733e --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/patch_sso_teammates200.py @@ -0,0 +1,107 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.sso_teammates_restricted_subuser_response_props_subuser_access_inner import ( + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner, +) +from sendgrid.rest.api.sso.v3.models.user_type import UserType + + +class PatchSsoTeammates200: + def __init__( + self, + address: Optional[str] = None, + address2: Optional[str] = None, + city: Optional[str] = None, + company: Optional[str] = None, + country: Optional[str] = None, + username: Optional[str] = None, + phone: Optional[str] = None, + state: Optional[str] = None, + user_type: Optional[UserType] = None, + website: Optional[str] = None, + zip: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email: Optional[str] = None, + is_admin: Optional[bool] = None, + is_sso: Optional[bool] = None, + scopes: Optional[List[str]] = None, + has_restricted_subuser_access: Optional[bool] = None, + subuser_access: Optional[ + List[SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner] + ] = None, + ): + self.address = address + self.address2 = address2 + self.city = city + self.company = company + self.country = country + self.username = username + self.phone = phone + self.state = state + self.user_type = user_type + self.website = website + self.zip = zip + self.first_name = first_name + self.last_name = last_name + self.email = email + self.is_admin = is_admin + self.is_sso = is_sso + self.scopes = scopes + self.has_restricted_subuser_access = has_restricted_subuser_access + self.subuser_access = subuser_access + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "address": self.address, + "address2": self.address2, + "city": self.city, + "company": self.company, + "country": self.country, + "username": self.username, + "phone": self.phone, + "state": self.state, + "user_type": self.user_type, + "website": self.website, + "zip": self.zip, + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, + "is_admin": self.is_admin, + "is_sso": self.is_sso, + "scopes": self.scopes, + "has_restricted_subuser_access": self.has_restricted_subuser_access, + "subuser_access": self.subuser_access, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PatchSsoTeammates200( + address=payload.get("address"), + address2=payload.get("address2"), + city=payload.get("city"), + company=payload.get("company"), + country=payload.get("country"), + username=payload.get("username"), + phone=payload.get("phone"), + state=payload.get("state"), + user_type=payload.get("user_type"), + website=payload.get("website"), + zip=payload.get("zip"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + email=payload.get("email"), + is_admin=payload.get("is_admin"), + is_sso=payload.get("is_sso"), + scopes=payload.get("scopes"), + has_restricted_subuser_access=payload.get("has_restricted_subuser_access"), + subuser_access=payload.get("subuser_access"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/permission_type.py b/sendgrid/rest/api/sso/v3/models/permission_type.py new file mode 100644 index 00000000..14aced3d --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/permission_type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class PermissionType(Enum): + ADMIN = "admin" + RESTRICTED = "restricted" diff --git a/sendgrid/rest/api/sso/v3/models/permission_type1.py b/sendgrid/rest/api/sso/v3/models/permission_type1.py new file mode 100644 index 00000000..d03e913e --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/permission_type1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class PermissionType1(Enum): + ADMIN = "admin" + RESTRICTED = "restricted" diff --git a/sendgrid/rest/api/sso/v3/models/persona.py b/sendgrid/rest/api/sso/v3/models/persona.py new file mode 100644 index 00000000..e48f0b3a --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/persona.py @@ -0,0 +1,9 @@ +from enum import Enum +from enum import Enum + + +class Persona(Enum): + ACCOUNTANT = "accountant" + DEVELOPER = "developer" + MARKETER = "marketer" + OBSERVER = "observer" diff --git a/sendgrid/rest/api/sso/v3/models/post_patch_integration_request.py b/sendgrid/rest/api/sso/v3/models/post_patch_integration_request.py new file mode 100644 index 00000000..4c079d28 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/post_patch_integration_request.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class PostPatchIntegrationRequest: + def __init__( + self, + name: Optional[str] = None, + enabled: Optional[bool] = None, + signin_url: Optional[str] = None, + signout_url: Optional[str] = None, + entity_id: Optional[str] = None, + completed_integration: Optional[bool] = None, + ): + self.name = name + self.enabled = enabled + self.signin_url = signin_url + self.signout_url = signout_url + self.entity_id = entity_id + self.completed_integration = completed_integration + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "enabled": self.enabled, + "signin_url": self.signin_url, + "signout_url": self.signout_url, + "entity_id": self.entity_id, + "completed_integration": self.completed_integration, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PostPatchIntegrationRequest( + name=payload.get("name"), + enabled=payload.get("enabled"), + signin_url=payload.get("signin_url"), + signout_url=payload.get("signout_url"), + entity_id=payload.get("entity_id"), + completed_integration=payload.get("completed_integration"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/post_sso_teammates201.py b/sendgrid/rest/api/sso/v3/models/post_sso_teammates201.py new file mode 100644 index 00000000..93e35dbf --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/post_sso_teammates201.py @@ -0,0 +1,62 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.sso_teammates_restricted_subuser_response_props_subuser_access_inner import ( + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner, +) + + +class PostSsoTeammates201: + def __init__( + self, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email: Optional[str] = None, + is_admin: Optional[bool] = None, + is_sso: Optional[bool] = None, + scopes: Optional[List[str]] = None, + has_restricted_subuser_access: Optional[bool] = None, + subuser_access: Optional[ + List[SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner] + ] = None, + ): + self.first_name = first_name + self.last_name = last_name + self.email = email + self.is_admin = is_admin + self.is_sso = is_sso + self.scopes = scopes + self.has_restricted_subuser_access = has_restricted_subuser_access + self.subuser_access = subuser_access + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, + "is_admin": self.is_admin, + "is_sso": self.is_sso, + "scopes": self.scopes, + "has_restricted_subuser_access": self.has_restricted_subuser_access, + "subuser_access": self.subuser_access, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PostSsoTeammates201( + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + email=payload.get("email"), + is_admin=payload.get("is_admin"), + is_sso=payload.get("is_sso"), + scopes=payload.get("scopes"), + has_restricted_subuser_access=payload.get("has_restricted_subuser_access"), + subuser_access=payload.get("subuser_access"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/post_sso_teammates_request.py b/sendgrid/rest/api/sso/v3/models/post_sso_teammates_request.py new file mode 100644 index 00000000..7d8a1384 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/post_sso_teammates_request.py @@ -0,0 +1,63 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.persona import Persona +from sendgrid.rest.api.sso.v3.models.sso_teammates_base_request_props_subuser_access_inner import ( + SsoTeammatesBaseRequestPropsSubuserAccessInner, +) + + +class PostSsoTeammatesRequest: + def __init__( + self, + email: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + is_admin: Optional[bool] = None, + persona: Optional[Persona] = None, + scopes: Optional[List[str]] = None, + has_restricted_subuser_access: Optional[bool] = None, + subuser_access: Optional[ + List[SsoTeammatesBaseRequestPropsSubuserAccessInner] + ] = None, + ): + self.email = email + self.first_name = first_name + self.last_name = last_name + self.is_admin = is_admin + self.persona = persona + self.scopes = scopes + self.has_restricted_subuser_access = has_restricted_subuser_access + self.subuser_access = subuser_access + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "first_name": self.first_name, + "last_name": self.last_name, + "is_admin": self.is_admin, + "persona": self.persona, + "scopes": self.scopes, + "has_restricted_subuser_access": self.has_restricted_subuser_access, + "subuser_access": self.subuser_access, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return PostSsoTeammatesRequest( + email=payload.get("email"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + is_admin=payload.get("is_admin"), + persona=payload.get("persona"), + scopes=payload.get("scopes"), + has_restricted_subuser_access=payload.get("has_restricted_subuser_access"), + subuser_access=payload.get("subuser_access"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_certificate_body.py b/sendgrid/rest/api/sso/v3/models/sso_certificate_body.py new file mode 100644 index 00000000..6523e2fd --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_certificate_body.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SsoCertificateBody: + def __init__( + self, + public_certificate: Optional[str] = None, + id: Optional[float] = None, + not_before: Optional[float] = None, + not_after: Optional[float] = None, + intergration_id: Optional[str] = None, + ): + self.public_certificate = public_certificate + self.id = id + self.not_before = not_before + self.not_after = not_after + self.intergration_id = intergration_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "public_certificate": self.public_certificate, + "id": self.id, + "not_before": self.not_before, + "not_after": self.not_after, + "intergration_id": self.intergration_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoCertificateBody( + public_certificate=payload.get("public_certificate"), + id=payload.get("id"), + not_before=payload.get("not_before"), + not_after=payload.get("not_after"), + intergration_id=payload.get("intergration_id"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_error_response_inner.py b/sendgrid/rest/api/sso/v3/models/sso_error_response_inner.py new file mode 100644 index 00000000..11f5ed1c --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_error_response_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SsoErrorResponseInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + error_id: Optional[str] = None, + ): + self.message = message + self.field = field + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoErrorResponseInner( + message=payload.get("message"), + field=payload.get("field"), + error_id=payload.get("error_id"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_integration.py b/sendgrid/rest/api/sso/v3/models/sso_integration.py new file mode 100644 index 00000000..5d81a9da --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_integration.py @@ -0,0 +1,65 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SsoIntegration: + def __init__( + self, + name: Optional[str] = None, + enabled: Optional[bool] = None, + signin_url: Optional[str] = None, + signout_url: Optional[str] = None, + entity_id: Optional[str] = None, + completed_integration: Optional[bool] = None, + last_updated: Optional[float] = None, + id: Optional[str] = None, + single_signon_url: Optional[str] = None, + audience_url: Optional[str] = None, + ): + self.name = name + self.enabled = enabled + self.signin_url = signin_url + self.signout_url = signout_url + self.entity_id = entity_id + self.completed_integration = completed_integration + self.last_updated = last_updated + self.id = id + self.single_signon_url = single_signon_url + self.audience_url = audience_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "enabled": self.enabled, + "signin_url": self.signin_url, + "signout_url": self.signout_url, + "entity_id": self.entity_id, + "completed_integration": self.completed_integration, + "last_updated": self.last_updated, + "id": self.id, + "single_signon_url": self.single_signon_url, + "audience_url": self.audience_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoIntegration( + name=payload.get("name"), + enabled=payload.get("enabled"), + signin_url=payload.get("signin_url"), + signout_url=payload.get("signout_url"), + entity_id=payload.get("entity_id"), + completed_integration=payload.get("completed_integration"), + last_updated=payload.get("last_updated"), + id=payload.get("id"), + single_signon_url=payload.get("single_signon_url"), + audience_url=payload.get("audience_url"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props.py b/sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props.py new file mode 100644 index 00000000..9045bd8b --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props.py @@ -0,0 +1,59 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.persona import Persona +from sendgrid.rest.api.sso.v3.models.sso_teammates_base_request_props_subuser_access_inner import ( + SsoTeammatesBaseRequestPropsSubuserAccessInner, +) + + +class SsoTeammatesBaseRequestProps: + def __init__( + self, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + is_admin: Optional[bool] = None, + persona: Optional[Persona] = None, + scopes: Optional[List[str]] = None, + has_restricted_subuser_access: Optional[bool] = None, + subuser_access: Optional[ + List[SsoTeammatesBaseRequestPropsSubuserAccessInner] + ] = None, + ): + self.first_name = first_name + self.last_name = last_name + self.is_admin = is_admin + self.persona = persona + self.scopes = scopes + self.has_restricted_subuser_access = has_restricted_subuser_access + self.subuser_access = subuser_access + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "first_name": self.first_name, + "last_name": self.last_name, + "is_admin": self.is_admin, + "persona": self.persona, + "scopes": self.scopes, + "has_restricted_subuser_access": self.has_restricted_subuser_access, + "subuser_access": self.subuser_access, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoTeammatesBaseRequestProps( + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + is_admin=payload.get("is_admin"), + persona=payload.get("persona"), + scopes=payload.get("scopes"), + has_restricted_subuser_access=payload.get("has_restricted_subuser_access"), + subuser_access=payload.get("subuser_access"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props_subuser_access_inner.py b/sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props_subuser_access_inner.py new file mode 100644 index 00000000..27e54b8b --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_teammates_base_request_props_subuser_access_inner.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.permission_type import PermissionType + + +class SsoTeammatesBaseRequestPropsSubuserAccessInner: + def __init__( + self, + id: Optional[int] = None, + permission_type: Optional[PermissionType] = None, + scopes: Optional[List[str]] = None, + ): + self.id = id + self.permission_type = permission_type + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "permission_type": self.permission_type, + "scopes": self.scopes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoTeammatesBaseRequestPropsSubuserAccessInner( + id=payload.get("id"), + permission_type=payload.get("permission_type"), + scopes=payload.get("scopes"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_teammates_base_response_props.py b/sendgrid/rest/api/sso/v3/models/sso_teammates_base_response_props.py new file mode 100644 index 00000000..bebc34f5 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_teammates_base_response_props.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SsoTeammatesBaseResponseProps: + def __init__( + self, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email: Optional[str] = None, + is_admin: Optional[bool] = None, + is_sso: Optional[bool] = None, + scopes: Optional[List[str]] = None, + ): + self.first_name = first_name + self.last_name = last_name + self.email = email + self.is_admin = is_admin + self.is_sso = is_sso + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, + "is_admin": self.is_admin, + "is_sso": self.is_sso, + "scopes": self.scopes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoTeammatesBaseResponseProps( + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + email=payload.get("email"), + is_admin=payload.get("is_admin"), + is_sso=payload.get("is_sso"), + scopes=payload.get("scopes"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props.py b/sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props.py new file mode 100644 index 00000000..18d28d3a --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.sso_teammates_restricted_subuser_response_props_subuser_access_inner import ( + SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner, +) + + +class SsoTeammatesRestrictedSubuserResponseProps: + def __init__( + self, + has_restricted_subuser_access: Optional[bool] = None, + subuser_access: Optional[ + List[SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner] + ] = None, + ): + self.has_restricted_subuser_access = has_restricted_subuser_access + self.subuser_access = subuser_access + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "has_restricted_subuser_access": self.has_restricted_subuser_access, + "subuser_access": self.subuser_access, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoTeammatesRestrictedSubuserResponseProps( + has_restricted_subuser_access=payload.get("has_restricted_subuser_access"), + subuser_access=payload.get("subuser_access"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props_subuser_access_inner.py b/sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props_subuser_access_inner.py new file mode 100644 index 00000000..f30bb340 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/sso_teammates_restricted_subuser_response_props_subuser_access_inner.py @@ -0,0 +1,50 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.sso.v3.models.permission_type1 import PermissionType1 + + +class SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner: + def __init__( + self, + id: Optional[int] = None, + username: Optional[str] = None, + email: Optional[str] = None, + disabled: Optional[bool] = None, + permission_type: Optional[PermissionType1] = None, + scopes: Optional[List[str]] = None, + ): + self.id = id + self.username = username + self.email = email + self.disabled = disabled + self.permission_type = permission_type + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "username": self.username, + "email": self.email, + "disabled": self.disabled, + "permission_type": self.permission_type, + "scopes": self.scopes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SsoTeammatesRestrictedSubuserResponsePropsSubuserAccessInner( + id=payload.get("id"), + username=payload.get("username"), + email=payload.get("email"), + disabled=payload.get("disabled"), + permission_type=payload.get("permission_type"), + scopes=payload.get("scopes"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/update_sso_certificate_request.py b/sendgrid/rest/api/sso/v3/models/update_sso_certificate_request.py new file mode 100644 index 00000000..101dc681 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/update_sso_certificate_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateSsoCertificateRequest: + def __init__( + self, + public_certificate: Optional[str] = None, + enabled: Optional[bool] = None, + integration_id: Optional[str] = None, + ): + self.public_certificate = public_certificate + self.enabled = enabled + self.integration_id = integration_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "public_certificate": self.public_certificate, + "enabled": self.enabled, + "integration_id": self.integration_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSsoCertificateRequest( + public_certificate=payload.get("public_certificate"), + enabled=payload.get("enabled"), + integration_id=payload.get("integration_id"), + ) diff --git a/sendgrid/rest/api/sso/v3/models/user_type.py b/sendgrid/rest/api/sso/v3/models/user_type.py new file mode 100644 index 00000000..c57452aa --- /dev/null +++ b/sendgrid/rest/api/sso/v3/models/user_type.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class UserType(Enum): + ADMIN = "admin" + OWNER = "owner" + TEAMMATE = "teammate" diff --git a/sendgrid/rest/api/sso/v3/update_sso_certificate.py b/sendgrid/rest/api/sso/v3/update_sso_certificate.py new file mode 100644 index 00000000..65119428 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/update_sso_certificate.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.sso.v3.models.update_sso_certificate_request import ( + UpdateSsoCertificateRequest, +) + + +class UpdateSsoCertificate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + cert_id: str, + update_sso_certificate_request: Optional[UpdateSsoCertificateRequest] = None, + ): + path = "/v3/sso/certificates/{cert_id}" + path = path.format( + cert_id=cert_id, + ) + + data = None + if update_sso_certificate_request: + data = update_sso_certificate_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/update_sso_integration.py b/sendgrid/rest/api/sso/v3/update_sso_integration.py new file mode 100644 index 00000000..348cb15e --- /dev/null +++ b/sendgrid/rest/api/sso/v3/update_sso_integration.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.sso.v3.models.post_patch_integration_request import ( + PostPatchIntegrationRequest, +) + + +class UpdateSsoIntegration: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + si: Optional[bool] = None, + post_patch_integration_request: Optional[PostPatchIntegrationRequest] = None, + ): + path = "/v3/sso/integrations/{id}" + path = path.format( + id=id, + ) + + data = None + if post_patch_integration_request: + data = post_patch_integration_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/sso/v3/update_sso_teammate.py b/sendgrid/rest/api/sso/v3/update_sso_teammate.py new file mode 100644 index 00000000..60f55415 --- /dev/null +++ b/sendgrid/rest/api/sso/v3/update_sso_teammate.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Single Sign-On API + The Single Sign-On API allows you to manage your SAML 2.0 SSO configurations. You can also work with your SSO integrations using the SSO section of the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/sso). The Single Sign-On Settings operations allow you to create, retrieve, modify, and delete SSO integrations for your Twilio SendGrid account. Each integration will correspond to a specific IdP such as Okta, Duo, or Microsoft Azure Active Directory. The Single Sign-On Certificates operations allow you to create, modify, and delete SSO certificates. A SAML certificate allows your IdP and Twilio SendGrid to verify requests are coming from one another using the `public_certificate` and `integration_id` parameters. The Single Sign-On Teammates operations allow you to add and modify SSO Teammates. SSO Teammates are the individual user accounts who will access your Twilio SendGrid account with SSO credentials. To retrieve or delete an SSO Teammate, you will use the separate [Teammates API](https://docs.sendgrid.com/api-reference/teammates/). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.sso.v3.models.sso_teammates_base_request_props import ( + SsoTeammatesBaseRequestProps, +) + + +class UpdateSsoTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: str, + body: Optional[SsoTeammatesBaseRequestProps] = None, + ): + path = "/v3/sso/teammates/{username}" + path = path.format( + username=username, + ) + + data = None + if body: + data = body.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/__init__.py b/sendgrid/rest/api/stats/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/stats/v3/get_client_stat.py b/sendgrid/rest/api/stats/v3/get_client_stat.py new file mode 100644 index 00000000..6c52d32f --- /dev/null +++ b/sendgrid/rest/api/stats/v3/get_client_stat.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by2 import AggregatedBy2 +from sendgrid.rest.api.stats.v3.models.client_type import ClientType + + +class GetClientStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + client_type: ClientType, + on_behalf_of: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + aggregated_by: Optional[AggregatedBy2] = None, + ): + path = "/v3/clients/{client_type}/stats" + path = path.format( + client_type=client_type, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_browser_stat.py b/sendgrid/rest/api/stats/v3/list_browser_stat.py new file mode 100644 index 00000000..27739703 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_browser_stat.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by3 import AggregatedBy3 + + +class ListBrowserStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + browsers: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy3] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/browsers/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_category.py b/sendgrid/rest/api/stats/v3/list_category.py new file mode 100644 index 00000000..780f9bd5 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_category.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListCategory: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + category: Optional[str] = None, + offset: Optional[int] = None, + ): + path = "/v3/categories" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_category_stat.py b/sendgrid/rest/api/stats/v3/list_category_stat.py new file mode 100644 index 00000000..7e67abd8 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_category_stat.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by import AggregatedBy + + +class ListCategoryStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + categories: Optional[str] = None, + aggregated_by: Optional[AggregatedBy] = None, + ): + path = "/v3/categories/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_category_stat_sum.py b/sendgrid/rest/api/stats/v3/list_category_stat_sum.py new file mode 100644 index 00000000..5e2716d2 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_category_stat_sum.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by1 import AggregatedBy1 +from sendgrid.rest.api.stats.v3.models.sort_by_direction import SortByDirection + + +class ListCategoryStatSum: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + sort_by_metric: Optional[str] = None, + sort_by_direction: Optional[SortByDirection] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy1] = None, + ): + path = "/v3/categories/stats/sums" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_client_stat.py b/sendgrid/rest/api/stats/v3/list_client_stat.py new file mode 100644 index 00000000..16533a33 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_client_stat.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by2 import AggregatedBy2 + + +class ListClientStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + aggregated_by: Optional[AggregatedBy2] = None, + ): + path = "/v3/clients/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_device_stat.py b/sendgrid/rest/api/stats/v3/list_device_stat.py new file mode 100644 index 00000000..d7397878 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_device_stat.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by3 import AggregatedBy3 + + +class ListDeviceStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy3] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/devices/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_geo_stat.py b/sendgrid/rest/api/stats/v3/list_geo_stat.py new file mode 100644 index 00000000..05771180 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_geo_stat.py @@ -0,0 +1,66 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by3 import AggregatedBy3 +from sendgrid.rest.api.stats.v3.models.country import Country + + +class ListGeoStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + country: Optional[Country] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy3] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/geo/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_mailbox_provider_stat.py b/sendgrid/rest/api/stats/v3/list_mailbox_provider_stat.py new file mode 100644 index 00000000..3c1d2af8 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_mailbox_provider_stat.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by3 import AggregatedBy3 + + +class ListMailboxProviderStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + mailbox_providers: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy3] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/mailbox_providers/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/list_stat.py b/sendgrid/rest/api/stats/v3/list_stat.py new file mode 100644 index 00000000..e091ff2c --- /dev/null +++ b/sendgrid/rest/api/stats/v3/list_stat.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.stats.v3.models.aggregated_by3 import AggregatedBy3 + + +class ListStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy3] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/stats/v3/models/__init__.py b/sendgrid/rest/api/stats/v3/models/__init__.py new file mode 100644 index 00000000..36051aa7 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/__init__.py @@ -0,0 +1,110 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Statistics API + The Twilio SendGrid Statistics API allows you to retrieve the various statistics related to your email program. Tracking your emails is an important part of being a good sender and learning about how your users interact with your email. This includes everything from clicks and opens to looking at which browsers and mailbox providers your customers use. SendGrid has broken up statistics in specific ways so that you can get at-a-glance data, as well as the details of how your email is being used. Category statistics are available for the previous thirteen months only. See [**Statistics Overview**](https://docs.sendgrid.com/ui/analytics-and-reporting/stats-overview) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.stats.v3.models.advanced_stats_clicks import AdvancedStatsClicks +from sendgrid.rest.api.stats.v3.models.advanced_stats_clicks_opens import ( + AdvancedStatsClicksOpens, +) +from sendgrid.rest.api.stats.v3.models.advanced_stats_mailbox_provider import ( + AdvancedStatsMailboxProvider, +) +from sendgrid.rest.api.stats.v3.models.advanced_stats_opens import AdvancedStatsOpens +from sendgrid.rest.api.stats.v3.models.aggregated_by import AggregatedBy +from sendgrid.rest.api.stats.v3.models.aggregated_by1 import AggregatedBy1 +from sendgrid.rest.api.stats.v3.models.aggregated_by2 import AggregatedBy2 +from sendgrid.rest.api.stats.v3.models.aggregated_by3 import AggregatedBy3 +from sendgrid.rest.api.stats.v3.models.category_stats import CategoryStats +from sendgrid.rest.api.stats.v3.models.category_stats_stats_inner import ( + CategoryStatsStatsInner, +) +from sendgrid.rest.api.stats.v3.models.category_stats_stats_inner_metrics import ( + CategoryStatsStatsInnerMetrics, +) +from sendgrid.rest.api.stats.v3.models.client_type import ClientType +from sendgrid.rest.api.stats.v3.models.country import Country +from sendgrid.rest.api.stats.v3.models.list_browser_stat200_response_inner import ( + ListBrowserStat200ResponseInner, +) +from sendgrid.rest.api.stats.v3.models.list_browser_stat200_response_inner_stats_inner import ( + ListBrowserStat200ResponseInnerStatsInner, +) +from sendgrid.rest.api.stats.v3.models.list_category200_response_inner import ( + ListCategory200ResponseInner, +) +from sendgrid.rest.api.stats.v3.models.list_category400_response import ( + ListCategory400Response, +) +from sendgrid.rest.api.stats.v3.models.list_category400_response_errors_inner import ( + ListCategory400ResponseErrorsInner, +) +from sendgrid.rest.api.stats.v3.models.list_client_stat200_response_inner import ( + ListClientStat200ResponseInner, +) +from sendgrid.rest.api.stats.v3.models.list_client_stat200_response_inner_stats_inner import ( + ListClientStat200ResponseInnerStatsInner, +) +from sendgrid.rest.api.stats.v3.models.list_geo_stat200_response_inner import ( + ListGeoStat200ResponseInner, +) +from sendgrid.rest.api.stats.v3.models.list_geo_stat200_response_inner_stats_inner import ( + ListGeoStat200ResponseInnerStatsInner, +) +from sendgrid.rest.api.stats.v3.models.list_mailbox_provider_stat200_response_inner import ( + ListMailboxProviderStat200ResponseInner, +) +from sendgrid.rest.api.stats.v3.models.list_mailbox_provider_stat200_response_inner_stats_inner import ( + ListMailboxProviderStat200ResponseInnerStatsInner, +) +from sendgrid.rest.api.stats.v3.models.list_stat200_response_inner import ( + ListStat200ResponseInner, +) +from sendgrid.rest.api.stats.v3.models.list_stat200_response_inner_stats_inner import ( + ListStat200ResponseInnerStatsInner, +) +from sendgrid.rest.api.stats.v3.models.sort_by_direction import SortByDirection +from sendgrid.rest.api.stats.v3.models.stats_advanced_global_stats import ( + StatsAdvancedGlobalStats, +) + +__all__ = [ + "AdvancedStatsClicks", + "AdvancedStatsClicksOpens", + "AdvancedStatsMailboxProvider", + "AdvancedStatsOpens", + "AggregatedBy", + "AggregatedBy1", + "AggregatedBy2", + "AggregatedBy3", + "CategoryStats", + "CategoryStatsStatsInner", + "CategoryStatsStatsInnerMetrics", + "ClientType", + "Country", + "ListBrowserStat200ResponseInner", + "ListBrowserStat200ResponseInnerStatsInner", + "ListCategory200ResponseInner", + "ListCategory400Response", + "ListCategory400ResponseErrorsInner", + "ListClientStat200ResponseInner", + "ListClientStat200ResponseInnerStatsInner", + "ListGeoStat200ResponseInner", + "ListGeoStat200ResponseInnerStatsInner", + "ListMailboxProviderStat200ResponseInner", + "ListMailboxProviderStat200ResponseInnerStatsInner", + "ListStat200ResponseInner", + "ListStat200ResponseInnerStatsInner", + "SortByDirection", + "StatsAdvancedGlobalStats", +] +# Testing code diff --git a/sendgrid/rest/api/stats/v3/models/advanced_stats_clicks.py b/sendgrid/rest/api/stats/v3/models/advanced_stats_clicks.py new file mode 100644 index 00000000..47b77182 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/advanced_stats_clicks.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AdvancedStatsClicks: + def __init__( + self, clicks: Optional[int] = None, unique_clicks: Optional[int] = None + ): + self.clicks = clicks + self.unique_clicks = unique_clicks + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "clicks": self.clicks, + "unique_clicks": self.unique_clicks, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AdvancedStatsClicks( + clicks=payload.get("clicks"), unique_clicks=payload.get("unique_clicks") + ) diff --git a/sendgrid/rest/api/stats/v3/models/advanced_stats_clicks_opens.py b/sendgrid/rest/api/stats/v3/models/advanced_stats_clicks_opens.py new file mode 100644 index 00000000..decb96df --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/advanced_stats_clicks_opens.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AdvancedStatsClicksOpens: + def __init__( + self, + clicks: Optional[int] = None, + unique_clicks: Optional[int] = None, + opens: Optional[int] = None, + unique_opens: Optional[int] = None, + ): + self.clicks = clicks + self.unique_clicks = unique_clicks + self.opens = opens + self.unique_opens = unique_opens + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "clicks": self.clicks, + "unique_clicks": self.unique_clicks, + "opens": self.opens, + "unique_opens": self.unique_opens, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AdvancedStatsClicksOpens( + clicks=payload.get("clicks"), + unique_clicks=payload.get("unique_clicks"), + opens=payload.get("opens"), + unique_opens=payload.get("unique_opens"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/advanced_stats_mailbox_provider.py b/sendgrid/rest/api/stats/v3/models/advanced_stats_mailbox_provider.py new file mode 100644 index 00000000..8f42345c --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/advanced_stats_mailbox_provider.py @@ -0,0 +1,57 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AdvancedStatsMailboxProvider: + def __init__( + self, + blocks: Optional[int] = None, + bounces: Optional[int] = None, + deferred: Optional[int] = None, + delivered: Optional[int] = None, + drops: Optional[int] = None, + requests: Optional[int] = None, + processed: Optional[int] = None, + spam_reports: Optional[int] = None, + ): + self.blocks = blocks + self.bounces = bounces + self.deferred = deferred + self.delivered = delivered + self.drops = drops + self.requests = requests + self.processed = processed + self.spam_reports = spam_reports + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "blocks": self.blocks, + "bounces": self.bounces, + "deferred": self.deferred, + "delivered": self.delivered, + "drops": self.drops, + "requests": self.requests, + "processed": self.processed, + "spam_reports": self.spam_reports, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AdvancedStatsMailboxProvider( + blocks=payload.get("blocks"), + bounces=payload.get("bounces"), + deferred=payload.get("deferred"), + delivered=payload.get("delivered"), + drops=payload.get("drops"), + requests=payload.get("requests"), + processed=payload.get("processed"), + spam_reports=payload.get("spam_reports"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/advanced_stats_opens.py b/sendgrid/rest/api/stats/v3/models/advanced_stats_opens.py new file mode 100644 index 00000000..eb8971f4 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/advanced_stats_opens.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AdvancedStatsOpens: + def __init__(self, opens: Optional[int] = None, unique_opens: Optional[int] = None): + self.opens = opens + self.unique_opens = unique_opens + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "opens": self.opens, + "unique_opens": self.unique_opens, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AdvancedStatsOpens( + opens=payload.get("opens"), unique_opens=payload.get("unique_opens") + ) diff --git a/sendgrid/rest/api/stats/v3/models/aggregated_by.py b/sendgrid/rest/api/stats/v3/models/aggregated_by.py new file mode 100644 index 00000000..8139656a --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/aggregated_by.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy(Enum): + DAY = "day" + WEEK = "week" + MONTH = "month" diff --git a/sendgrid/rest/api/stats/v3/models/aggregated_by1.py b/sendgrid/rest/api/stats/v3/models/aggregated_by1.py new file mode 100644 index 00000000..909b31b7 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/aggregated_by1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy1(Enum): + DAY = "day" + WEEK = "week" + MONTH = "month" diff --git a/sendgrid/rest/api/stats/v3/models/aggregated_by2.py b/sendgrid/rest/api/stats/v3/models/aggregated_by2.py new file mode 100644 index 00000000..1441663e --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/aggregated_by2.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy2(Enum): + DAY = "day" + WEEK = "week" + MONTH = "month" diff --git a/sendgrid/rest/api/stats/v3/models/aggregated_by3.py b/sendgrid/rest/api/stats/v3/models/aggregated_by3.py new file mode 100644 index 00000000..344f6d9a --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/aggregated_by3.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy3(Enum): + DAY = "day" + WEEK = "week" + MONTH = "month" diff --git a/sendgrid/rest/api/stats/v3/models/category_stats.py b/sendgrid/rest/api/stats/v3/models/category_stats.py new file mode 100644 index 00000000..f4ec5f01 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/category_stats.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.category_stats_stats_inner import ( + CategoryStatsStatsInner, +) + + +class CategoryStats: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[CategoryStatsStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CategoryStats(var_date=payload.get("date"), stats=payload.get("stats")) diff --git a/sendgrid/rest/api/stats/v3/models/category_stats_stats_inner.py b/sendgrid/rest/api/stats/v3/models/category_stats_stats_inner.py new file mode 100644 index 00000000..b729be64 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/category_stats_stats_inner.py @@ -0,0 +1,40 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.category_stats_stats_inner_metrics import ( + CategoryStatsStatsInnerMetrics, +) + + +class CategoryStatsStatsInner: + def __init__( + self, + metrics: Optional[CategoryStatsStatsInnerMetrics] = None, + name: Optional[str] = None, + type: Optional[str] = None, + ): + self.metrics = metrics + self.name = name + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "metrics": self.metrics, + "name": self.name, + "type": self.type, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CategoryStatsStatsInner( + metrics=payload.get("metrics"), + name=payload.get("name"), + type=payload.get("type"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/category_stats_stats_inner_metrics.py b/sendgrid/rest/api/stats/v3/models/category_stats_stats_inner_metrics.py new file mode 100644 index 00000000..e0fda7ef --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/category_stats_stats_inner_metrics.py @@ -0,0 +1,89 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CategoryStatsStatsInnerMetrics: + def __init__( + self, + blocks: Optional[int] = None, + bounce_drops: Optional[int] = None, + bounces: Optional[int] = None, + clicks: Optional[int] = None, + deferred: Optional[int] = None, + delivered: Optional[int] = None, + invalid_emails: Optional[int] = None, + opens: Optional[int] = None, + processed: Optional[int] = None, + requests: Optional[int] = None, + spam_report_drops: Optional[int] = None, + spam_reports: Optional[int] = None, + unique_clicks: Optional[int] = None, + unique_opens: Optional[int] = None, + unsubscribe_drops: Optional[int] = None, + unsubscribes: Optional[int] = None, + ): + self.blocks = blocks + self.bounce_drops = bounce_drops + self.bounces = bounces + self.clicks = clicks + self.deferred = deferred + self.delivered = delivered + self.invalid_emails = invalid_emails + self.opens = opens + self.processed = processed + self.requests = requests + self.spam_report_drops = spam_report_drops + self.spam_reports = spam_reports + self.unique_clicks = unique_clicks + self.unique_opens = unique_opens + self.unsubscribe_drops = unsubscribe_drops + self.unsubscribes = unsubscribes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "blocks": self.blocks, + "bounce_drops": self.bounce_drops, + "bounces": self.bounces, + "clicks": self.clicks, + "deferred": self.deferred, + "delivered": self.delivered, + "invalid_emails": self.invalid_emails, + "opens": self.opens, + "processed": self.processed, + "requests": self.requests, + "spam_report_drops": self.spam_report_drops, + "spam_reports": self.spam_reports, + "unique_clicks": self.unique_clicks, + "unique_opens": self.unique_opens, + "unsubscribe_drops": self.unsubscribe_drops, + "unsubscribes": self.unsubscribes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CategoryStatsStatsInnerMetrics( + blocks=payload.get("blocks"), + bounce_drops=payload.get("bounce_drops"), + bounces=payload.get("bounces"), + clicks=payload.get("clicks"), + deferred=payload.get("deferred"), + delivered=payload.get("delivered"), + invalid_emails=payload.get("invalid_emails"), + opens=payload.get("opens"), + processed=payload.get("processed"), + requests=payload.get("requests"), + spam_report_drops=payload.get("spam_report_drops"), + spam_reports=payload.get("spam_reports"), + unique_clicks=payload.get("unique_clicks"), + unique_opens=payload.get("unique_opens"), + unsubscribe_drops=payload.get("unsubscribe_drops"), + unsubscribes=payload.get("unsubscribes"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/client_type.py b/sendgrid/rest/api/stats/v3/models/client_type.py new file mode 100644 index 00000000..a5f6e100 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/client_type.py @@ -0,0 +1,9 @@ +from enum import Enum +from enum import Enum + + +class ClientType(Enum): + PHONE = "phone" + TABLET = "tablet" + WEBMAIL = "webmail" + DESKTOP = "desktop" diff --git a/sendgrid/rest/api/stats/v3/models/country.py b/sendgrid/rest/api/stats/v3/models/country.py new file mode 100644 index 00000000..2e9c1038 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/country.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Country(Enum): + US = "US" + CA = "CA" diff --git a/sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner.py b/sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner.py new file mode 100644 index 00000000..1f880401 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.list_browser_stat200_response_inner_stats_inner import ( + ListBrowserStat200ResponseInnerStatsInner, +) + + +class ListBrowserStat200ResponseInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[ListBrowserStat200ResponseInnerStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListBrowserStat200ResponseInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner_stats_inner.py b/sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner_stats_inner.py new file mode 100644 index 00000000..1bd3569b --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_browser_stat200_response_inner_stats_inner.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.advanced_stats_clicks import AdvancedStatsClicks + + +class ListBrowserStat200ResponseInnerStatsInner: + def __init__( + self, + type: Optional[str] = None, + name: Optional[str] = None, + metrics: Optional[AdvancedStatsClicks] = None, + ): + self.type = type + self.name = name + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "name": self.name, + "metrics": self.metrics, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListBrowserStat200ResponseInnerStatsInner( + type=payload.get("type"), + name=payload.get("name"), + metrics=payload.get("metrics"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_category200_response_inner.py b/sendgrid/rest/api/stats/v3/models/list_category200_response_inner.py new file mode 100644 index 00000000..234f21c2 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_category200_response_inner.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListCategory200ResponseInner: + def __init__(self, category: Optional[str] = None): + self.category = category + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"category": self.category}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListCategory200ResponseInner(category=payload.get("category")) diff --git a/sendgrid/rest/api/stats/v3/models/list_category400_response.py b/sendgrid/rest/api/stats/v3/models/list_category400_response.py new file mode 100644 index 00000000..a543a569 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_category400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.list_category400_response_errors_inner import ( + ListCategory400ResponseErrorsInner, +) + + +class ListCategory400Response: + def __init__( + self, errors: Optional[List[ListCategory400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListCategory400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/stats/v3/models/list_category400_response_errors_inner.py b/sendgrid/rest/api/stats/v3/models/list_category400_response_errors_inner.py new file mode 100644 index 00000000..d39409ea --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_category400_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListCategory400ResponseErrorsInner: + def __init__(self, field: Optional[str] = None, message: Optional[str] = None): + self.field = field + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"field": self.field, "message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListCategory400ResponseErrorsInner( + field=payload.get("field"), message=payload.get("message") + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner.py b/sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner.py new file mode 100644 index 00000000..656c5449 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.list_client_stat200_response_inner_stats_inner import ( + ListClientStat200ResponseInnerStatsInner, +) + + +class ListClientStat200ResponseInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[ListClientStat200ResponseInnerStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListClientStat200ResponseInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner_stats_inner.py b/sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner_stats_inner.py new file mode 100644 index 00000000..d2e77a5e --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_client_stat200_response_inner_stats_inner.py @@ -0,0 +1,38 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.advanced_stats_opens import AdvancedStatsOpens + + +class ListClientStat200ResponseInnerStatsInner: + def __init__( + self, + type: Optional[str] = None, + name: Optional[str] = None, + metrics: Optional[AdvancedStatsOpens] = None, + ): + self.type = type + self.name = name + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "name": self.name, + "metrics": self.metrics, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListClientStat200ResponseInnerStatsInner( + type=payload.get("type"), + name=payload.get("name"), + metrics=payload.get("metrics"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner.py b/sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner.py new file mode 100644 index 00000000..273f0e0d --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.list_geo_stat200_response_inner_stats_inner import ( + ListGeoStat200ResponseInnerStatsInner, +) + + +class ListGeoStat200ResponseInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[ListGeoStat200ResponseInnerStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListGeoStat200ResponseInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner_stats_inner.py b/sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner_stats_inner.py new file mode 100644 index 00000000..97c2e18b --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_geo_stat200_response_inner_stats_inner.py @@ -0,0 +1,40 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.advanced_stats_clicks_opens import ( + AdvancedStatsClicksOpens, +) + + +class ListGeoStat200ResponseInnerStatsInner: + def __init__( + self, + type: Optional[str] = None, + name: Optional[str] = None, + metrics: Optional[AdvancedStatsClicksOpens] = None, + ): + self.type = type + self.name = name + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "name": self.name, + "metrics": self.metrics, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListGeoStat200ResponseInnerStatsInner( + type=payload.get("type"), + name=payload.get("name"), + metrics=payload.get("metrics"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner.py b/sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner.py new file mode 100644 index 00000000..bedd162b --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.list_mailbox_provider_stat200_response_inner_stats_inner import ( + ListMailboxProviderStat200ResponseInnerStatsInner, +) + + +class ListMailboxProviderStat200ResponseInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[ListMailboxProviderStat200ResponseInnerStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMailboxProviderStat200ResponseInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner_stats_inner.py b/sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner_stats_inner.py new file mode 100644 index 00000000..30a71a26 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_mailbox_provider_stat200_response_inner_stats_inner.py @@ -0,0 +1,40 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.advanced_stats_mailbox_provider import ( + AdvancedStatsMailboxProvider, +) + + +class ListMailboxProviderStat200ResponseInnerStatsInner: + def __init__( + self, + type: Optional[str] = None, + name: Optional[str] = None, + metrics: Optional[AdvancedStatsMailboxProvider] = None, + ): + self.type = type + self.name = name + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "name": self.name, + "metrics": self.metrics, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListMailboxProviderStat200ResponseInnerStatsInner( + type=payload.get("type"), + name=payload.get("name"), + metrics=payload.get("metrics"), + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_stat200_response_inner.py b/sendgrid/rest/api/stats/v3/models/list_stat200_response_inner.py new file mode 100644 index 00000000..d05bd4af --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_stat200_response_inner.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.list_stat200_response_inner_stats_inner import ( + ListStat200ResponseInnerStatsInner, +) + + +class ListStat200ResponseInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[ListStat200ResponseInnerStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListStat200ResponseInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/stats/v3/models/list_stat200_response_inner_stats_inner.py b/sendgrid/rest/api/stats/v3/models/list_stat200_response_inner_stats_inner.py new file mode 100644 index 00000000..532b6ce1 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/list_stat200_response_inner_stats_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.stats.v3.models.stats_advanced_global_stats import ( + StatsAdvancedGlobalStats, +) + + +class ListStat200ResponseInnerStatsInner: + def __init__(self, metrics: Optional[StatsAdvancedGlobalStats] = None): + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"metrics": self.metrics}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListStat200ResponseInnerStatsInner(metrics=payload.get("metrics")) diff --git a/sendgrid/rest/api/stats/v3/models/sort_by_direction.py b/sendgrid/rest/api/stats/v3/models/sort_by_direction.py new file mode 100644 index 00000000..b544b184 --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/sort_by_direction.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class SortByDirection(Enum): + DESC = "desc" + ASC = "asc" diff --git a/sendgrid/rest/api/stats/v3/models/stats_advanced_global_stats.py b/sendgrid/rest/api/stats/v3/models/stats_advanced_global_stats.py new file mode 100644 index 00000000..00e8aceb --- /dev/null +++ b/sendgrid/rest/api/stats/v3/models/stats_advanced_global_stats.py @@ -0,0 +1,89 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class StatsAdvancedGlobalStats: + def __init__( + self, + clicks: Optional[int] = None, + unique_clicks: Optional[int] = None, + opens: Optional[int] = None, + unique_opens: Optional[int] = None, + blocks: Optional[int] = None, + bounce_drops: Optional[int] = None, + bounces: Optional[int] = None, + deferred: Optional[int] = None, + delivered: Optional[int] = None, + invalid_emails: Optional[int] = None, + processed: Optional[int] = None, + requests: Optional[int] = None, + spam_report_drops: Optional[int] = None, + spam_reports: Optional[int] = None, + unsubscribe_drops: Optional[int] = None, + unsubscribes: Optional[int] = None, + ): + self.clicks = clicks + self.unique_clicks = unique_clicks + self.opens = opens + self.unique_opens = unique_opens + self.blocks = blocks + self.bounce_drops = bounce_drops + self.bounces = bounces + self.deferred = deferred + self.delivered = delivered + self.invalid_emails = invalid_emails + self.processed = processed + self.requests = requests + self.spam_report_drops = spam_report_drops + self.spam_reports = spam_reports + self.unsubscribe_drops = unsubscribe_drops + self.unsubscribes = unsubscribes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "clicks": self.clicks, + "unique_clicks": self.unique_clicks, + "opens": self.opens, + "unique_opens": self.unique_opens, + "blocks": self.blocks, + "bounce_drops": self.bounce_drops, + "bounces": self.bounces, + "deferred": self.deferred, + "delivered": self.delivered, + "invalid_emails": self.invalid_emails, + "processed": self.processed, + "requests": self.requests, + "spam_report_drops": self.spam_report_drops, + "spam_reports": self.spam_reports, + "unsubscribe_drops": self.unsubscribe_drops, + "unsubscribes": self.unsubscribes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return StatsAdvancedGlobalStats( + clicks=payload.get("clicks"), + unique_clicks=payload.get("unique_clicks"), + opens=payload.get("opens"), + unique_opens=payload.get("unique_opens"), + blocks=payload.get("blocks"), + bounce_drops=payload.get("bounce_drops"), + bounces=payload.get("bounces"), + deferred=payload.get("deferred"), + delivered=payload.get("delivered"), + invalid_emails=payload.get("invalid_emails"), + processed=payload.get("processed"), + requests=payload.get("requests"), + spam_report_drops=payload.get("spam_report_drops"), + spam_reports=payload.get("spam_reports"), + unsubscribe_drops=payload.get("unsubscribe_drops"), + unsubscribes=payload.get("unsubscribes"), + ) diff --git a/sendgrid/rest/api/subusers/v3/__init__.py b/sendgrid/rest/api/subusers/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/subusers/v3/create_subuser.py b/sendgrid/rest/api/subusers/v3/create_subuser.py new file mode 100644 index 00000000..74611f55 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/create_subuser.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.create_subuser_request import ( + CreateSubuserRequest, +) + + +class CreateSubuser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + create_subuser_request: Optional[CreateSubuserRequest] = None, + ): + path = "/v3/subusers" + + data = None + if create_subuser_request: + data = create_subuser_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/delete_subuser.py b/sendgrid/rest/api/subusers/v3/delete_subuser.py new file mode 100644 index 00000000..bde1d0f1 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/delete_subuser.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteSubuser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + ): + path = "/v3/subusers/{subuser_name}" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/get_subuser_credit.py b/sendgrid/rest/api/subusers/v3/get_subuser_credit.py new file mode 100644 index 00000000..9702c21a --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/get_subuser_credit.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class GetSubuserCredit: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + ): + path = "/v3/subusers/{subuser_name}/credits" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/list_monthly_stat.py b/sendgrid/rest/api/subusers/v3/list_monthly_stat.py new file mode 100644 index 00000000..9a44c1ba --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/list_monthly_stat.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.sort_by_direction1 import SortByDirection1 +from sendgrid.rest.api.subusers.v3.models.sort_by_metric import SortByMetric + + +class ListMonthlyStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + var_date: Optional[str] = None, + subuser: Optional[str] = None, + sort_by_metric: Optional[SortByMetric] = None, + sort_by_direction: Optional[SortByDirection1] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/subusers/stats/monthly" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/list_reputation.py b/sendgrid/rest/api/subusers/v3/list_reputation.py new file mode 100644 index 00000000..ed46f1de --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/list_reputation.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListReputation: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + usernames: Optional[str] = None, + ): + path = "/v3/subusers/reputations" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/list_stat.py b/sendgrid/rest/api/subusers/v3/list_stat.py new file mode 100644 index 00000000..7c52676a --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/list_stat.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.aggregated_by import AggregatedBy + + +class ListStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[AggregatedBy] = None, + subusers: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/subusers/stats" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/list_stat_sum.py b/sendgrid/rest/api/subusers/v3/list_stat_sum.py new file mode 100644 index 00000000..77d68eeb --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/list_stat_sum.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.sort_by_direction2 import SortByDirection2 + + +class ListStatSum: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + sort_by_direction: Optional[SortByDirection2] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + aggregated_by: Optional[str] = None, + sort_by_metric: Optional[str] = None, + ): + path = "/v3/subusers/stats/sums" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/list_subuser.py b/sendgrid/rest/api/subusers/v3/list_subuser.py new file mode 100644 index 00000000..ddf93767 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/list_subuser.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.region import Region + + +class ListSubuser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: Optional[str] = None, + limit: Optional[int] = None, + region: Optional[Region] = None, + include_region: Optional[bool] = None, + offset: Optional[int] = None, + ): + path = "/v3/subusers" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/list_subuser_monthly_stat.py b/sendgrid/rest/api/subusers/v3/list_subuser_monthly_stat.py new file mode 100644 index 00000000..9bec5757 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/list_subuser_monthly_stat.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.sort_by_direction import SortByDirection + + +class ListSubuserMonthlyStat: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + var_date: Optional[str] = None, + sort_by_metric: Optional[str] = None, + sort_by_direction: Optional[SortByDirection] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/subusers/{subuser_name}/stats/monthly" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/models/__init__.py b/sendgrid/rest/api/subusers/v3/models/__init__.py new file mode 100644 index 00000000..2c035ef0 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/__init__.py @@ -0,0 +1,108 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.subusers.v3.models.aggregated_by import AggregatedBy +from sendgrid.rest.api.subusers.v3.models.category_stats import CategoryStats +from sendgrid.rest.api.subusers.v3.models.category_stats_stats_inner import ( + CategoryStatsStatsInner, +) +from sendgrid.rest.api.subusers.v3.models.category_stats_stats_inner_metrics import ( + CategoryStatsStatsInnerMetrics, +) +from sendgrid.rest.api.subusers.v3.models.create_subuser_request import ( + CreateSubuserRequest, +) +from sendgrid.rest.api.subusers.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.subusers.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.subusers.v3.models.list_reputation200_response_inner import ( + ListReputation200ResponseInner, +) +from sendgrid.rest.api.subusers.v3.models.region import Region +from sendgrid.rest.api.subusers.v3.models.region1 import Region1 +from sendgrid.rest.api.subusers.v3.models.region2 import Region2 +from sendgrid.rest.api.subusers.v3.models.region3 import Region3 +from sendgrid.rest.api.subusers.v3.models.reset_frequency import ResetFrequency +from sendgrid.rest.api.subusers.v3.models.reset_frequency1 import ResetFrequency1 +from sendgrid.rest.api.subusers.v3.models.sort_by_direction import SortByDirection +from sendgrid.rest.api.subusers.v3.models.sort_by_direction1 import SortByDirection1 +from sendgrid.rest.api.subusers.v3.models.sort_by_direction2 import SortByDirection2 +from sendgrid.rest.api.subusers.v3.models.sort_by_metric import SortByMetric +from sendgrid.rest.api.subusers.v3.models.subuser import Subuser +from sendgrid.rest.api.subusers.v3.models.subuser_credits import SubuserCredits +from sendgrid.rest.api.subusers.v3.models.subuser_credits_request import ( + SubuserCreditsRequest, +) +from sendgrid.rest.api.subusers.v3.models.subuser_post import SubuserPost +from sendgrid.rest.api.subusers.v3.models.subuser_post_credit_allocation import ( + SubuserPostCreditAllocation, +) +from sendgrid.rest.api.subusers.v3.models.subuser_stats import SubuserStats +from sendgrid.rest.api.subusers.v3.models.subuser_stats_stats_inner import ( + SubuserStatsStatsInner, +) +from sendgrid.rest.api.subusers.v3.models.subuser_stats_stats_inner_metrics import ( + SubuserStatsStatsInnerMetrics, +) +from sendgrid.rest.api.subusers.v3.models.type import Type +from sendgrid.rest.api.subusers.v3.models.type1 import Type1 +from sendgrid.rest.api.subusers.v3.models.update_subuser_ip200_response import ( + UpdateSubuserIp200Response, +) +from sendgrid.rest.api.subusers.v3.models.update_subuser_remaining_credit_request import ( + UpdateSubuserRemainingCreditRequest, +) +from sendgrid.rest.api.subusers.v3.models.update_subuser_request import ( + UpdateSubuserRequest, +) +from sendgrid.rest.api.subusers.v3.models.update_subuser_website_access_request import ( + UpdateSubuserWebsiteAccessRequest, +) + +__all__ = [ + "AggregatedBy", + "CategoryStats", + "CategoryStatsStatsInner", + "CategoryStatsStatsInnerMetrics", + "CreateSubuserRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "ListReputation200ResponseInner", + "Region", + "Region1", + "Region2", + "Region3", + "ResetFrequency", + "ResetFrequency1", + "SortByDirection", + "SortByDirection1", + "SortByDirection2", + "SortByMetric", + "Subuser", + "SubuserCredits", + "SubuserCreditsRequest", + "SubuserPost", + "SubuserPostCreditAllocation", + "SubuserStats", + "SubuserStatsStatsInner", + "SubuserStatsStatsInnerMetrics", + "Type", + "Type1", + "UpdateSubuserIp200Response", + "UpdateSubuserRemainingCreditRequest", + "UpdateSubuserRequest", + "UpdateSubuserWebsiteAccessRequest", +] +# Testing code diff --git a/sendgrid/rest/api/subusers/v3/models/aggregated_by.py b/sendgrid/rest/api/subusers/v3/models/aggregated_by.py new file mode 100644 index 00000000..8139656a --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/aggregated_by.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy(Enum): + DAY = "day" + WEEK = "week" + MONTH = "month" diff --git a/sendgrid/rest/api/subusers/v3/models/category_stats.py b/sendgrid/rest/api/subusers/v3/models/category_stats.py new file mode 100644 index 00000000..4b76b372 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/category_stats.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.category_stats_stats_inner import ( + CategoryStatsStatsInner, +) + + +class CategoryStats: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[CategoryStatsStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CategoryStats(var_date=payload.get("date"), stats=payload.get("stats")) diff --git a/sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner.py b/sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner.py new file mode 100644 index 00000000..9b3ebc05 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner.py @@ -0,0 +1,40 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.category_stats_stats_inner_metrics import ( + CategoryStatsStatsInnerMetrics, +) + + +class CategoryStatsStatsInner: + def __init__( + self, + metrics: Optional[CategoryStatsStatsInnerMetrics] = None, + name: Optional[str] = None, + type: Optional[str] = None, + ): + self.metrics = metrics + self.name = name + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "metrics": self.metrics, + "name": self.name, + "type": self.type, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CategoryStatsStatsInner( + metrics=payload.get("metrics"), + name=payload.get("name"), + type=payload.get("type"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner_metrics.py b/sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner_metrics.py new file mode 100644 index 00000000..e0fda7ef --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/category_stats_stats_inner_metrics.py @@ -0,0 +1,89 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CategoryStatsStatsInnerMetrics: + def __init__( + self, + blocks: Optional[int] = None, + bounce_drops: Optional[int] = None, + bounces: Optional[int] = None, + clicks: Optional[int] = None, + deferred: Optional[int] = None, + delivered: Optional[int] = None, + invalid_emails: Optional[int] = None, + opens: Optional[int] = None, + processed: Optional[int] = None, + requests: Optional[int] = None, + spam_report_drops: Optional[int] = None, + spam_reports: Optional[int] = None, + unique_clicks: Optional[int] = None, + unique_opens: Optional[int] = None, + unsubscribe_drops: Optional[int] = None, + unsubscribes: Optional[int] = None, + ): + self.blocks = blocks + self.bounce_drops = bounce_drops + self.bounces = bounces + self.clicks = clicks + self.deferred = deferred + self.delivered = delivered + self.invalid_emails = invalid_emails + self.opens = opens + self.processed = processed + self.requests = requests + self.spam_report_drops = spam_report_drops + self.spam_reports = spam_reports + self.unique_clicks = unique_clicks + self.unique_opens = unique_opens + self.unsubscribe_drops = unsubscribe_drops + self.unsubscribes = unsubscribes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "blocks": self.blocks, + "bounce_drops": self.bounce_drops, + "bounces": self.bounces, + "clicks": self.clicks, + "deferred": self.deferred, + "delivered": self.delivered, + "invalid_emails": self.invalid_emails, + "opens": self.opens, + "processed": self.processed, + "requests": self.requests, + "spam_report_drops": self.spam_report_drops, + "spam_reports": self.spam_reports, + "unique_clicks": self.unique_clicks, + "unique_opens": self.unique_opens, + "unsubscribe_drops": self.unsubscribe_drops, + "unsubscribes": self.unsubscribes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CategoryStatsStatsInnerMetrics( + blocks=payload.get("blocks"), + bounce_drops=payload.get("bounce_drops"), + bounces=payload.get("bounces"), + clicks=payload.get("clicks"), + deferred=payload.get("deferred"), + delivered=payload.get("delivered"), + invalid_emails=payload.get("invalid_emails"), + opens=payload.get("opens"), + processed=payload.get("processed"), + requests=payload.get("requests"), + spam_report_drops=payload.get("spam_report_drops"), + spam_reports=payload.get("spam_reports"), + unique_clicks=payload.get("unique_clicks"), + unique_opens=payload.get("unique_opens"), + unsubscribe_drops=payload.get("unsubscribe_drops"), + unsubscribes=payload.get("unsubscribes"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/create_subuser_request.py b/sendgrid/rest/api/subusers/v3/models/create_subuser_request.py new file mode 100644 index 00000000..092297a8 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/create_subuser_request.py @@ -0,0 +1,50 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.region1 import Region1 + + +class CreateSubuserRequest: + def __init__( + self, + username: Optional[str] = None, + email: Optional[str] = None, + password: Optional[str] = None, + ips: Optional[List[str]] = None, + region: Optional[Region1] = None, + include_region: Optional[bool] = None, + ): + self.username = username + self.email = email + self.password = password + self.ips = ips + self.region = region + self.include_region = include_region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "email": self.email, + "password": self.password, + "ips": self.ips, + "region": self.region, + "include_region": self.include_region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateSubuserRequest( + username=payload.get("username"), + email=payload.get("email"), + password=payload.get("password"), + ips=payload.get("ips"), + region=payload.get("region"), + include_region=payload.get("include_region"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/error_response.py b/sendgrid/rest/api/subusers/v3/models/error_response.py new file mode 100644 index 00000000..ff833b62 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/subusers/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/subusers/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/list_reputation200_response_inner.py b/sendgrid/rest/api/subusers/v3/models/list_reputation200_response_inner.py new file mode 100644 index 00000000..343153db --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/list_reputation200_response_inner.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListReputation200ResponseInner: + def __init__( + self, reputation: Optional[float] = None, username: Optional[str] = None + ): + self.reputation = reputation + self.username = username + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "reputation": self.reputation, + "username": self.username, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListReputation200ResponseInner( + reputation=payload.get("reputation"), username=payload.get("username") + ) diff --git a/sendgrid/rest/api/subusers/v3/models/region.py b/sendgrid/rest/api/subusers/v3/models/region.py new file mode 100644 index 00000000..b945d019 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/region.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Region(Enum): + ALL = "all" + GLOBAL = "global" + EU = "eu" diff --git a/sendgrid/rest/api/subusers/v3/models/region1.py b/sendgrid/rest/api/subusers/v3/models/region1.py new file mode 100644 index 00000000..7d52f3be --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/region1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region1(Enum): + GLOBAL = "global" + EU = "eu" diff --git a/sendgrid/rest/api/subusers/v3/models/region2.py b/sendgrid/rest/api/subusers/v3/models/region2.py new file mode 100644 index 00000000..3d4e02a3 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/region2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region2(Enum): + GLOBAL = "global" + EU = "eu" diff --git a/sendgrid/rest/api/subusers/v3/models/region3.py b/sendgrid/rest/api/subusers/v3/models/region3.py new file mode 100644 index 00000000..ca8097fc --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/region3.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Region3(Enum): + GLOBAL = "global" + EU = "eu" diff --git a/sendgrid/rest/api/subusers/v3/models/reset_frequency.py b/sendgrid/rest/api/subusers/v3/models/reset_frequency.py new file mode 100644 index 00000000..b9eeebd1 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/reset_frequency.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class ResetFrequency(Enum): + MONTHLY = "monthly" + WEEKLY = "weekly" + DAILY = "daily" diff --git a/sendgrid/rest/api/subusers/v3/models/reset_frequency1.py b/sendgrid/rest/api/subusers/v3/models/reset_frequency1.py new file mode 100644 index 00000000..cf6847a2 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/reset_frequency1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class ResetFrequency1(Enum): + MONTHLY = "monthly" + WEEKLY = "weekly" + DAILY = "daily" diff --git a/sendgrid/rest/api/subusers/v3/models/sort_by_direction.py b/sendgrid/rest/api/subusers/v3/models/sort_by_direction.py new file mode 100644 index 00000000..b544b184 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/sort_by_direction.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class SortByDirection(Enum): + DESC = "desc" + ASC = "asc" diff --git a/sendgrid/rest/api/subusers/v3/models/sort_by_direction1.py b/sendgrid/rest/api/subusers/v3/models/sort_by_direction1.py new file mode 100644 index 00000000..5a2d4075 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/sort_by_direction1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class SortByDirection1(Enum): + DESC = "desc" + ASC = "asc" diff --git a/sendgrid/rest/api/subusers/v3/models/sort_by_direction2.py b/sendgrid/rest/api/subusers/v3/models/sort_by_direction2.py new file mode 100644 index 00000000..6fd0319f --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/sort_by_direction2.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class SortByDirection2(Enum): + DESC = "desc" + ASC = "asc" diff --git a/sendgrid/rest/api/subusers/v3/models/sort_by_metric.py b/sendgrid/rest/api/subusers/v3/models/sort_by_metric.py new file mode 100644 index 00000000..2280cdd6 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/sort_by_metric.py @@ -0,0 +1,14 @@ +from enum import Enum +from enum import Enum + + +class SortByMetric(Enum): + BLOCKS = "blocks" + BOUNCES = "bounces" + CLICKS = "clicks" + DELIVERED = "delivered" + OPENS = "opens" + REQUESTS = "requests" + UNIQUE_CLICKS = "unique_clicks" + UNIQUE_OPENS = "unique_opens" + UNSUBSCRIBES = "unsubscribes" diff --git a/sendgrid/rest/api/subusers/v3/models/subuser.py b/sendgrid/rest/api/subusers/v3/models/subuser.py new file mode 100644 index 00000000..44c1e9db --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser.py @@ -0,0 +1,46 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.region2 import Region2 + + +class Subuser: + def __init__( + self, + disabled: Optional[bool] = None, + id: Optional[float] = None, + username: Optional[str] = None, + email: Optional[str] = None, + region: Optional[Region2] = None, + ): + self.disabled = disabled + self.id = id + self.username = username + self.email = email + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "disabled": self.disabled, + "id": self.id, + "username": self.username, + "email": self.email, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Subuser( + disabled=payload.get("disabled"), + id=payload.get("id"), + username=payload.get("username"), + email=payload.get("email"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_credits.py b/sendgrid/rest/api/subusers/v3/models/subuser_credits.py new file mode 100644 index 00000000..a11a7721 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_credits.py @@ -0,0 +1,47 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.reset_frequency import ResetFrequency +from sendgrid.rest.api.subusers.v3.models.type import Type + + +class SubuserCredits: + def __init__( + self, + type: Optional[Type] = None, + reset_frequency: Optional[ResetFrequency] = None, + remain: Optional[int] = None, + total: Optional[int] = None, + used: Optional[int] = None, + ): + self.type = type + self.reset_frequency = reset_frequency + self.remain = remain + self.total = total + self.used = used + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "reset_frequency": self.reset_frequency, + "remain": self.remain, + "total": self.total, + "used": self.used, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserCredits( + type=payload.get("type"), + reset_frequency=payload.get("reset_frequency"), + remain=payload.get("remain"), + total=payload.get("total"), + used=payload.get("used"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_credits_request.py b/sendgrid/rest/api/subusers/v3/models/subuser_credits_request.py new file mode 100644 index 00000000..5558fd0f --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_credits_request.py @@ -0,0 +1,39 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.reset_frequency1 import ResetFrequency1 +from sendgrid.rest.api.subusers.v3.models.type1 import Type1 + + +class SubuserCreditsRequest: + def __init__( + self, + type: Optional[Type1] = None, + reset_frequency: Optional[ResetFrequency1] = None, + total: Optional[int] = None, + ): + self.type = type + self.reset_frequency = reset_frequency + self.total = total + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "type": self.type, + "reset_frequency": self.reset_frequency, + "total": self.total, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserCreditsRequest( + type=payload.get("type"), + reset_frequency=payload.get("reset_frequency"), + total=payload.get("total"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_post.py b/sendgrid/rest/api/subusers/v3/models/subuser_post.py new file mode 100644 index 00000000..cb56fe85 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_post.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.region3 import Region3 +from sendgrid.rest.api.subusers.v3.models.subuser_post_credit_allocation import ( + SubuserPostCreditAllocation, +) + + +class SubuserPost: + def __init__( + self, + username: Optional[str] = None, + user_id: Optional[float] = None, + email: Optional[str] = None, + credit_allocation: Optional[SubuserPostCreditAllocation] = None, + region: Optional[Region3] = None, + ): + self.username = username + self.user_id = user_id + self.email = email + self.credit_allocation = credit_allocation + self.region = region + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "user_id": self.user_id, + "email": self.email, + "credit_allocation": self.credit_allocation, + "region": self.region, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserPost( + username=payload.get("username"), + user_id=payload.get("user_id"), + email=payload.get("email"), + credit_allocation=payload.get("credit_allocation"), + region=payload.get("region"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_post_credit_allocation.py b/sendgrid/rest/api/subusers/v3/models/subuser_post_credit_allocation.py new file mode 100644 index 00000000..cb07a046 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_post_credit_allocation.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SubuserPostCreditAllocation: + def __init__(self, type: Optional[str] = None): + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"type": self.type}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserPostCreditAllocation(type=payload.get("type")) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_stats.py b/sendgrid/rest/api/subusers/v3/models/subuser_stats.py new file mode 100644 index 00000000..0ba8c39b --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_stats.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.subuser_stats_stats_inner import ( + SubuserStatsStatsInner, +) + + +class SubuserStats: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[SubuserStatsStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserStats(var_date=payload.get("date"), stats=payload.get("stats")) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner.py b/sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner.py new file mode 100644 index 00000000..c6f69c3d --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner.py @@ -0,0 +1,48 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.subusers.v3.models.subuser_stats_stats_inner_metrics import ( + SubuserStatsStatsInnerMetrics, +) + + +class SubuserStatsStatsInner: + def __init__( + self, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + metrics: Optional[SubuserStatsStatsInnerMetrics] = None, + name: Optional[str] = None, + type: Optional[str] = None, + ): + self.first_name = first_name + self.last_name = last_name + self.metrics = metrics + self.name = name + self.type = type + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "first_name": self.first_name, + "last_name": self.last_name, + "metrics": self.metrics, + "name": self.name, + "type": self.type, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserStatsStatsInner( + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + metrics=payload.get("metrics"), + name=payload.get("name"), + type=payload.get("type"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner_metrics.py b/sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner_metrics.py new file mode 100644 index 00000000..c8df613f --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/subuser_stats_stats_inner_metrics.py @@ -0,0 +1,89 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SubuserStatsStatsInnerMetrics: + def __init__( + self, + blocks: Optional[int] = None, + bounce_drops: Optional[int] = None, + bounces: Optional[int] = None, + clicks: Optional[int] = None, + deferred: Optional[int] = None, + delivered: Optional[int] = None, + invalid_emails: Optional[int] = None, + opens: Optional[int] = None, + processed: Optional[int] = None, + requests: Optional[int] = None, + spam_report_drops: Optional[int] = None, + spam_reports: Optional[int] = None, + unique_clicks: Optional[int] = None, + unique_opens: Optional[int] = None, + unsubscribe_drops: Optional[int] = None, + unsubscribes: Optional[int] = None, + ): + self.blocks = blocks + self.bounce_drops = bounce_drops + self.bounces = bounces + self.clicks = clicks + self.deferred = deferred + self.delivered = delivered + self.invalid_emails = invalid_emails + self.opens = opens + self.processed = processed + self.requests = requests + self.spam_report_drops = spam_report_drops + self.spam_reports = spam_reports + self.unique_clicks = unique_clicks + self.unique_opens = unique_opens + self.unsubscribe_drops = unsubscribe_drops + self.unsubscribes = unsubscribes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "blocks": self.blocks, + "bounce_drops": self.bounce_drops, + "bounces": self.bounces, + "clicks": self.clicks, + "deferred": self.deferred, + "delivered": self.delivered, + "invalid_emails": self.invalid_emails, + "opens": self.opens, + "processed": self.processed, + "requests": self.requests, + "spam_report_drops": self.spam_report_drops, + "spam_reports": self.spam_reports, + "unique_clicks": self.unique_clicks, + "unique_opens": self.unique_opens, + "unsubscribe_drops": self.unsubscribe_drops, + "unsubscribes": self.unsubscribes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubuserStatsStatsInnerMetrics( + blocks=payload.get("blocks"), + bounce_drops=payload.get("bounce_drops"), + bounces=payload.get("bounces"), + clicks=payload.get("clicks"), + deferred=payload.get("deferred"), + delivered=payload.get("delivered"), + invalid_emails=payload.get("invalid_emails"), + opens=payload.get("opens"), + processed=payload.get("processed"), + requests=payload.get("requests"), + spam_report_drops=payload.get("spam_report_drops"), + spam_reports=payload.get("spam_reports"), + unique_clicks=payload.get("unique_clicks"), + unique_opens=payload.get("unique_opens"), + unsubscribe_drops=payload.get("unsubscribe_drops"), + unsubscribes=payload.get("unsubscribes"), + ) diff --git a/sendgrid/rest/api/subusers/v3/models/type.py b/sendgrid/rest/api/subusers/v3/models/type.py new file mode 100644 index 00000000..a9130bef --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/type.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + UNLIMITED = "unlimited" + RECURRING = "recurring" + NONRECURRING = "nonrecurring" diff --git a/sendgrid/rest/api/subusers/v3/models/type1.py b/sendgrid/rest/api/subusers/v3/models/type1.py new file mode 100644 index 00000000..3eb5a2aa --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/type1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Type1(Enum): + UNLIMITED = "unlimited" + RECURRING = "recurring" + NONRECURRING = "nonrecurring" diff --git a/sendgrid/rest/api/subusers/v3/models/update_subuser_ip200_response.py b/sendgrid/rest/api/subusers/v3/models/update_subuser_ip200_response.py new file mode 100644 index 00000000..9b76c97b --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/update_subuser_ip200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateSubuserIp200Response: + def __init__(self, ips: Optional[List[str]] = None): + self.ips = ips + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"ips": self.ips}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSubuserIp200Response(ips=payload.get("ips")) diff --git a/sendgrid/rest/api/subusers/v3/models/update_subuser_remaining_credit_request.py b/sendgrid/rest/api/subusers/v3/models/update_subuser_remaining_credit_request.py new file mode 100644 index 00000000..0bdaf23d --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/update_subuser_remaining_credit_request.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateSubuserRemainingCreditRequest: + def __init__(self, allocation_update: Optional[int] = None): + self.allocation_update = allocation_update + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"allocation_update": self.allocation_update}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSubuserRemainingCreditRequest( + allocation_update=payload.get("allocation_update") + ) diff --git a/sendgrid/rest/api/subusers/v3/models/update_subuser_request.py b/sendgrid/rest/api/subusers/v3/models/update_subuser_request.py new file mode 100644 index 00000000..982a3b72 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/update_subuser_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateSubuserRequest: + def __init__(self, disabled: Optional[bool] = None): + self.disabled = disabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"disabled": self.disabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSubuserRequest(disabled=payload.get("disabled")) diff --git a/sendgrid/rest/api/subusers/v3/models/update_subuser_website_access_request.py b/sendgrid/rest/api/subusers/v3/models/update_subuser_website_access_request.py new file mode 100644 index 00000000..8f3ff0d9 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/models/update_subuser_website_access_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateSubuserWebsiteAccessRequest: + def __init__(self, disabled: Optional[bool] = None): + self.disabled = disabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"disabled": self.disabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSubuserWebsiteAccessRequest(disabled=payload.get("disabled")) diff --git a/sendgrid/rest/api/subusers/v3/update_subuser.py b/sendgrid/rest/api/subusers/v3/update_subuser.py new file mode 100644 index 00000000..89720ad9 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/update_subuser.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.update_subuser_request import ( + UpdateSubuserRequest, +) + + +class UpdateSubuser: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + update_subuser_request: Optional[UpdateSubuserRequest] = None, + ): + path = "/v3/subusers/{subuser_name}" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + if update_subuser_request: + data = update_subuser_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/update_subuser_credit.py b/sendgrid/rest/api/subusers/v3/update_subuser_credit.py new file mode 100644 index 00000000..d3f95802 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/update_subuser_credit.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.subusers.v3.models.subuser_credits_request import ( + SubuserCreditsRequest, +) + + +class UpdateSubuserCredit: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + subuser_credits_request: Optional[SubuserCreditsRequest] = None, + ): + path = "/v3/subusers/{subuser_name}/credits" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + if subuser_credits_request: + data = subuser_credits_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/update_subuser_ip.py b/sendgrid/rest/api/subusers/v3/update_subuser_ip.py new file mode 100644 index 00000000..d9d18442 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/update_subuser_ip.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import List, Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import List, Optional + + +class UpdateSubuserIp: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + request_body: Optional[List[str]] = None, + ): + path = "/v3/subusers/{subuser_name}/ips" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + if request_body: + data = request_body.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/update_subuser_remaining_credit.py b/sendgrid/rest/api/subusers/v3/update_subuser_remaining_credit.py new file mode 100644 index 00000000..e4d386e7 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/update_subuser_remaining_credit.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from sendgrid.rest.api.subusers.v3.models.update_subuser_remaining_credit_request import ( + UpdateSubuserRemainingCreditRequest, +) + + +class UpdateSubuserRemainingCredit: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + update_subuser_remaining_credit_request: Optional[ + UpdateSubuserRemainingCreditRequest + ] = None, + ): + path = "/v3/subusers/{subuser_name}/credits/remaining" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + if update_subuser_remaining_credit_request: + data = update_subuser_remaining_credit_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/subusers/v3/update_subuser_website_access.py b/sendgrid/rest/api/subusers/v3/update_subuser_website_access.py new file mode 100644 index 00000000..602c2058 --- /dev/null +++ b/sendgrid/rest/api/subusers/v3/update_subuser_website_access.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Subusers + The Twilio SendGrid Subusers API allows you to create and manage your Subuser accounts. Subusers are available on [Pro and Premier plans](https://sendgrid.com/pricing), and you can think of them as sub-accounts. Each Subuser can have its own sending domains, IP addresses, and reporting. SendGrid recommends creating Subusers for each of the different types of emails you send—one Subuser for transactional emails and another for marketing emails. Independent Software Vendor (ISV) customers may also create Subusers for each of their customers. You can also manage Subusers in the [Twilio SendGrid application user interface](https://app.sendgrid.com/settings/subusers). See [**Subusers**](https://docs.sendgrid.com/ui/account-and-settings/subusers) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.subusers.v3.models.update_subuser_website_access_request import ( + UpdateSubuserWebsiteAccessRequest, +) + + +class UpdateSubuserWebsiteAccess: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + subuser_name: str, + update_subuser_website_access_request: Optional[ + UpdateSubuserWebsiteAccessRequest + ] = None, + ): + path = "/v3/subusers/{subuser_name}/website_access" + path = path.format( + subuser_name=subuser_name, + ) + + data = None + if update_subuser_website_access_request: + data = update_subuser_website_access_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/__init__.py b/sendgrid/rest/api/suppressions/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/suppressions/v3/add_suppression_to_asm_group.py b/sendgrid/rest/api/suppressions/v3/add_suppression_to_asm_group.py new file mode 100644 index 00000000..c6c05cad --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/add_suppression_to_asm_group.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.suppressions_request import ( + SuppressionsRequest, +) + + +class AddSuppressionToAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + on_behalf_of: Optional[str] = None, + suppressions_request: Optional[SuppressionsRequest] = None, + ): + path = "/v3/asm/groups/{group_id}/suppressions" + path = path.format( + group_id=group_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if suppressions_request: + data = suppressions_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/creat_asm_group.py b/sendgrid/rest/api/suppressions/v3/creat_asm_group.py new file mode 100644 index 00000000..6419005d --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/creat_asm_group.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.suppression_group_request_base_props import ( + SuppressionGroupRequestBaseProps, +) + + +class CreatAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + suppression_group_request_base_props: Optional[ + SuppressionGroupRequestBaseProps + ] = None, + ): + path = "/v3/asm/groups" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if suppression_group_request_base_props: + data = suppression_group_request_base_props.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/create_global_suppression.py b/sendgrid/rest/api/suppressions/v3/create_global_suppression.py new file mode 100644 index 00000000..acb2df6b --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/create_global_suppression.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.suppressions_request import ( + SuppressionsRequest, +) + + +class CreateGlobalSuppression: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + suppressions_request: Optional[SuppressionsRequest] = None, + ): + path = "/v3/asm/suppressions/global" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if suppressions_request: + data = suppressions_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_asm_group.py b/sendgrid/rest/api/suppressions/v3/delete_asm_group.py new file mode 100644 index 00000000..af65ba7c --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_asm_group.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/groups/{group_id}" + path = path.format( + group_id=group_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_global_suppression.py b/sendgrid/rest/api/suppressions/v3/delete_global_suppression.py new file mode 100644 index 00000000..77c1ac79 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_global_suppression.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteGlobalSuppression: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/suppressions/global/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_invalid_email.py b/sendgrid/rest/api/suppressions/v3/delete_invalid_email.py new file mode 100644 index 00000000..cbac5d9f --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_invalid_email.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteInvalidEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/invalid_emails/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_invalid_emails.py b/sendgrid/rest/api/suppressions/v3/delete_invalid_emails.py new file mode 100644 index 00000000..685f2cfd --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_invalid_emails.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.delete_invalid_emails_request import ( + DeleteInvalidEmailsRequest, +) + + +class DeleteInvalidEmails: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + delete_invalid_emails_request: Optional[DeleteInvalidEmailsRequest] = None, + ): + path = "/v3/suppression/invalid_emails" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if delete_invalid_emails_request: + data = delete_invalid_emails_request.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_spam_report.py b/sendgrid/rest/api/suppressions/v3/delete_spam_report.py new file mode 100644 index 00000000..f0a07d7b --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_spam_report.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSpamReport: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/spam_reports/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_spam_reports.py b/sendgrid/rest/api/suppressions/v3/delete_spam_reports.py new file mode 100644 index 00000000..f5c40461 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_spam_reports.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.delete_spam_reports_request import ( + DeleteSpamReportsRequest, +) + + +class DeleteSpamReports: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + delete_spam_reports_request: Optional[DeleteSpamReportsRequest] = None, + ): + path = "/v3/suppression/spam_reports" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if delete_spam_reports_request: + data = delete_spam_reports_request.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_suppression_block.py b/sendgrid/rest/api/suppressions/v3/delete_suppression_block.py new file mode 100644 index 00000000..c598d4b2 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_suppression_block.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSuppressionBlock: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/blocks/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_suppression_blocks.py b/sendgrid/rest/api/suppressions/v3/delete_suppression_blocks.py new file mode 100644 index 00000000..7692fbf4 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_suppression_blocks.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.delete_suppression_blocks_request import ( + DeleteSuppressionBlocksRequest, +) + + +class DeleteSuppressionBlocks: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + delete_suppression_blocks_request: Optional[ + DeleteSuppressionBlocksRequest + ] = None, + ): + path = "/v3/suppression/blocks" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if delete_suppression_blocks_request: + data = delete_suppression_blocks_request.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_suppression_bounce.py b/sendgrid/rest/api/suppressions/v3/delete_suppression_bounce.py new file mode 100644 index 00000000..f68874c6 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_suppression_bounce.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSuppressionBounce: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/bounces/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_suppression_bounces.py b/sendgrid/rest/api/suppressions/v3/delete_suppression_bounces.py new file mode 100644 index 00000000..efee93ad --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_suppression_bounces.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.delete_suppression_bounces_request import ( + DeleteSuppressionBouncesRequest, +) + + +class DeleteSuppressionBounces: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + delete_suppression_bounces_request: Optional[ + DeleteSuppressionBouncesRequest + ] = None, + ): + path = "/v3/suppression/bounces" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if delete_suppression_bounces_request: + data = delete_suppression_bounces_request.to_dict() + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/delete_suppression_from_asm_group.py b/sendgrid/rest/api/suppressions/v3/delete_suppression_from_asm_group.py new file mode 100644 index 00000000..cff47619 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/delete_suppression_from_asm_group.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteSuppressionFromAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/groups/{group_id}/suppressions/{email}" + path = path.format( + group_id=group_id, + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_asm_group.py b/sendgrid/rest/api/suppressions/v3/get_asm_group.py new file mode 100644 index 00000000..8aa511cb --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_asm_group.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/groups/{group_id}" + path = path.format( + group_id=group_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_asm_suppression.py b/sendgrid/rest/api/suppressions/v3/get_asm_suppression.py new file mode 100644 index 00000000..4e87cffe --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_asm_suppression.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetAsmSuppression: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/suppressions/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_global_suppression.py b/sendgrid/rest/api/suppressions/v3/get_global_suppression.py new file mode 100644 index 00000000..e31f194a --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_global_suppression.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetGlobalSuppression: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/suppressions/global/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_invalid_email.py b/sendgrid/rest/api/suppressions/v3/get_invalid_email.py new file mode 100644 index 00000000..8bf6d88b --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_invalid_email.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetInvalidEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/invalid_emails/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_spam_report.py b/sendgrid/rest/api/suppressions/v3/get_spam_report.py new file mode 100644 index 00000000..837eb1ab --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_spam_report.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSpamReport: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/spam_reports/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_suppression_block.py b/sendgrid/rest/api/suppressions/v3/get_suppression_block.py new file mode 100644 index 00000000..ffc6fa88 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_suppression_block.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSuppressionBlock: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/blocks/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_suppression_bounces.py b/sendgrid/rest/api/suppressions/v3/get_suppression_bounces.py new file mode 100644 index 00000000..d5c5f957 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_suppression_bounces.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSuppressionBounces: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + email: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/suppression/bounces/{email}" + path = path.format( + email=email, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/get_suppression_bounces_classifications.py b/sendgrid/rest/api/suppressions/v3/get_suppression_bounces_classifications.py new file mode 100644 index 00000000..cf3d52f8 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/get_suppression_bounces_classifications.py @@ -0,0 +1,68 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.accept1 import Accept1 +from sendgrid.rest.api.suppressions.v3.models.classification1 import Classification1 + + +class GetSuppressionBouncesClassifications: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + classification: Classification1, + accept: Optional[Accept1] = None, + on_behalf_of: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/suppression/bounces/classifications/{classification}" + path = path.format( + classification=classification, + ) + + headers = values.of( + { + "Accept": accept, + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_asm_group.py b/sendgrid/rest/api/suppressions/v3/list_asm_group.py new file mode 100644 index 00000000..daa2faf6 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_asm_group.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + id: Optional[int] = None, + ): + path = "/v3/asm/groups" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_asm_suppression.py b/sendgrid/rest/api/suppressions/v3/list_asm_suppression.py new file mode 100644 index 00000000..a06fab62 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_asm_suppression.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAsmSuppression: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/suppressions" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_global_suppression.py b/sendgrid/rest/api/suppressions/v3/list_global_suppression.py new file mode 100644 index 00000000..4beb29d9 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_global_suppression.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListGlobalSuppression: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + email: Optional[str] = None, + ): + path = "/v3/suppression/unsubscribes" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_invalid_email.py b/sendgrid/rest/api/suppressions/v3/list_invalid_email.py new file mode 100644 index 00000000..0afa43b9 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_invalid_email.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListInvalidEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + email: Optional[str] = None, + ): + path = "/v3/suppression/invalid_emails" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_spam_report.py b/sendgrid/rest/api/suppressions/v3/list_spam_report.py new file mode 100644 index 00000000..4ca3a828 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_spam_report.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSpamReport: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + email: Optional[str] = None, + ): + path = "/v3/suppression/spam_reports" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_suppression_block.py b/sendgrid/rest/api/suppressions/v3/list_suppression_block.py new file mode 100644 index 00000000..5ff80179 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_suppression_block.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSuppressionBlock: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + email: Optional[str] = None, + ): + path = "/v3/suppression/blocks" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_suppression_bounces.py b/sendgrid/rest/api/suppressions/v3/list_suppression_bounces.py new file mode 100644 index 00000000..94e471a0 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_suppression_bounces.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSuppressionBounces: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + accept: Optional[str] = None, + on_behalf_of: Optional[str] = None, + start_time: Optional[int] = None, + end_time: Optional[int] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + email: Optional[str] = None, + ): + path = "/v3/suppression/bounces" + + headers = values.of( + { + "Accept": accept, + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_suppression_bounces_classifications.py b/sendgrid/rest/api/suppressions/v3/list_suppression_bounces_classifications.py new file mode 100644 index 00000000..5cbd9f42 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_suppression_bounces_classifications.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.accept import Accept + + +class ListSuppressionBouncesClassifications: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + accept: Optional[Accept] = None, + on_behalf_of: Optional[str] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/suppression/bounces/classifications" + + headers = values.of( + { + "Accept": accept, + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/list_suppression_from_asm_group.py b/sendgrid/rest/api/suppressions/v3/list_suppression_from_asm_group.py new file mode 100644 index 00000000..b8605edf --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/list_suppression_from_asm_group.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSuppressionFromAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/asm/groups/{group_id}/suppressions" + path = path.format( + group_id=group_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/__init__.py b/sendgrid/rest/api/suppressions/v3/models/__init__.py new file mode 100644 index 00000000..b86040e3 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/__init__.py @@ -0,0 +1,134 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.suppressions.v3.models.accept import Accept +from sendgrid.rest.api.suppressions.v3.models.accept1 import Accept1 +from sendgrid.rest.api.suppressions.v3.models.add_suppression_to_asm_group201_response import ( + AddSuppressionToAsmGroup201Response, +) +from sendgrid.rest.api.suppressions.v3.models.blocks_response_inner import ( + BlocksResponseInner, +) +from sendgrid.rest.api.suppressions.v3.models.bounce_response import BounceResponse +from sendgrid.rest.api.suppressions.v3.models.classification import Classification +from sendgrid.rest.api.suppressions.v3.models.classification1 import Classification1 +from sendgrid.rest.api.suppressions.v3.models.creat_asm_group201_response import ( + CreatAsmGroup201Response, +) +from sendgrid.rest.api.suppressions.v3.models.create_global_suppression201_response import ( + CreateGlobalSuppression201Response, +) +from sendgrid.rest.api.suppressions.v3.models.delete_invalid_emails_request import ( + DeleteInvalidEmailsRequest, +) +from sendgrid.rest.api.suppressions.v3.models.delete_spam_reports_request import ( + DeleteSpamReportsRequest, +) +from sendgrid.rest.api.suppressions.v3.models.delete_suppression_blocks_request import ( + DeleteSuppressionBlocksRequest, +) +from sendgrid.rest.api.suppressions.v3.models.delete_suppression_bounces_request import ( + DeleteSuppressionBouncesRequest, +) +from sendgrid.rest.api.suppressions.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.suppressions.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.suppressions.v3.models.get_asm_group200_response import ( + GetAsmGroup200Response, +) +from sendgrid.rest.api.suppressions.v3.models.get_asm_suppression200_response import ( + GetAsmSuppression200Response, +) +from sendgrid.rest.api.suppressions.v3.models.get_asm_suppression200_response_suppressions_inner import ( + GetAsmSuppression200ResponseSuppressionsInner, +) +from sendgrid.rest.api.suppressions.v3.models.get_suppression_bounces_classifications200_response import ( + GetSuppressionBouncesClassifications200Response, +) +from sendgrid.rest.api.suppressions.v3.models.get_suppression_bounces_classifications200_response_result_inner import ( + GetSuppressionBouncesClassifications200ResponseResultInner, +) +from sendgrid.rest.api.suppressions.v3.models.get_suppression_bounces_classifications200_response_result_inner_stats_inner import ( + GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner, +) +from sendgrid.rest.api.suppressions.v3.models.invalid_email import InvalidEmail +from sendgrid.rest.api.suppressions.v3.models.list_asm_suppression200_response_inner import ( + ListAsmSuppression200ResponseInner, +) +from sendgrid.rest.api.suppressions.v3.models.list_global_suppression200_response_inner import ( + ListGlobalSuppression200ResponseInner, +) +from sendgrid.rest.api.suppressions.v3.models.list_suppression_bounces_classifications200_response import ( + ListSuppressionBouncesClassifications200Response, +) +from sendgrid.rest.api.suppressions.v3.models.list_suppression_bounces_classifications200_response_result_inner import ( + ListSuppressionBouncesClassifications200ResponseResultInner, +) +from sendgrid.rest.api.suppressions.v3.models.list_suppression_bounces_classifications200_response_result_inner_stats_inner import ( + ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner, +) +from sendgrid.rest.api.suppressions.v3.models.retrieve_a_global_suppression_response import ( + RetrieveAGlobalSuppressionResponse, +) +from sendgrid.rest.api.suppressions.v3.models.spam_reports_response_inner import ( + SpamReportsResponseInner, +) +from sendgrid.rest.api.suppressions.v3.models.suppression_group import SuppressionGroup +from sendgrid.rest.api.suppressions.v3.models.suppression_group_request_base_props import ( + SuppressionGroupRequestBaseProps, +) +from sendgrid.rest.api.suppressions.v3.models.suppressions_request import ( + SuppressionsRequest, +) +from sendgrid.rest.api.suppressions.v3.models.update_asm_group_request import ( + UpdateAsmGroupRequest, +) + +__all__ = [ + "Accept", + "Accept1", + "AddSuppressionToAsmGroup201Response", + "BlocksResponseInner", + "BounceResponse", + "Classification", + "Classification1", + "CreatAsmGroup201Response", + "CreateGlobalSuppression201Response", + "DeleteInvalidEmailsRequest", + "DeleteSpamReportsRequest", + "DeleteSuppressionBlocksRequest", + "DeleteSuppressionBouncesRequest", + "ErrorResponse", + "ErrorResponseErrorsInner", + "GetAsmGroup200Response", + "GetAsmSuppression200Response", + "GetAsmSuppression200ResponseSuppressionsInner", + "GetSuppressionBouncesClassifications200Response", + "GetSuppressionBouncesClassifications200ResponseResultInner", + "GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner", + "InvalidEmail", + "ListAsmSuppression200ResponseInner", + "ListGlobalSuppression200ResponseInner", + "ListSuppressionBouncesClassifications200Response", + "ListSuppressionBouncesClassifications200ResponseResultInner", + "ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner", + "RetrieveAGlobalSuppressionResponse", + "SpamReportsResponseInner", + "SuppressionGroup", + "SuppressionGroupRequestBaseProps", + "SuppressionsRequest", + "UpdateAsmGroupRequest", +] +# Testing code diff --git a/sendgrid/rest/api/suppressions/v3/models/accept.py b/sendgrid/rest/api/suppressions/v3/models/accept.py new file mode 100644 index 00000000..a6f78784 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/accept.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Accept(Enum): + APPLICATION_SLASH_JSON = "application/json" + TEXT_SLASH_CSV = "text/csv" diff --git a/sendgrid/rest/api/suppressions/v3/models/accept1.py b/sendgrid/rest/api/suppressions/v3/models/accept1.py new file mode 100644 index 00000000..d0e6ff97 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/accept1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Accept1(Enum): + APPLICATION_SLASH_JSON = "application/json" + TEXT_SLASH_CSV = "text/csv" diff --git a/sendgrid/rest/api/suppressions/v3/models/add_suppression_to_asm_group201_response.py b/sendgrid/rest/api/suppressions/v3/models/add_suppression_to_asm_group201_response.py new file mode 100644 index 00000000..8b007fdb --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/add_suppression_to_asm_group201_response.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class AddSuppressionToAsmGroup201Response: + def __init__(self, recipient_emails: Optional[List[str]] = None): + self.recipient_emails = recipient_emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipient_emails": self.recipient_emails}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return AddSuppressionToAsmGroup201Response( + recipient_emails=payload.get("recipient_emails") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/blocks_response_inner.py b/sendgrid/rest/api/suppressions/v3/models/blocks_response_inner.py new file mode 100644 index 00000000..f1cbb579 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/blocks_response_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class BlocksResponseInner: + def __init__( + self, + created: Optional[int] = None, + email: Optional[str] = None, + reason: Optional[str] = None, + status: Optional[str] = None, + ): + self.created = created + self.email = email + self.reason = reason + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created": self.created, + "email": self.email, + "reason": self.reason, + "status": self.status, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return BlocksResponseInner( + created=payload.get("created"), + email=payload.get("email"), + reason=payload.get("reason"), + status=payload.get("status"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/bounce_response.py b/sendgrid/rest/api/suppressions/v3/models/bounce_response.py new file mode 100644 index 00000000..2f70cade --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/bounce_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class BounceResponse: + def __init__( + self, + created: Optional[float] = None, + email: Optional[str] = None, + reason: Optional[str] = None, + status: Optional[str] = None, + ): + self.created = created + self.email = email + self.reason = reason + self.status = status + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created": self.created, + "email": self.email, + "reason": self.reason, + "status": self.status, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return BounceResponse( + created=payload.get("created"), + email=payload.get("email"), + reason=payload.get("reason"), + status=payload.get("status"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/classification.py b/sendgrid/rest/api/suppressions/v3/models/classification.py new file mode 100644 index 00000000..2577d2cd --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/classification.py @@ -0,0 +1,12 @@ +from enum import Enum +from enum import Enum + + +class Classification(Enum): + CONTENT = "Content" + FREQUENCY_OR_VOLUME_TOO_HIGH = "Frequency or Volume Too High" + INVALID_ADDRESS = "Invalid Address" + MAILBOX_UNAVAILABLE = "Mailbox Unavailable" + REPUTATION = "Reputation" + TECHNICAL_FAILURE = "Technical Failure" + UNCLASSIFIED = "Unclassified" diff --git a/sendgrid/rest/api/suppressions/v3/models/classification1.py b/sendgrid/rest/api/suppressions/v3/models/classification1.py new file mode 100644 index 00000000..0dbc3499 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/classification1.py @@ -0,0 +1,12 @@ +from enum import Enum +from enum import Enum + + +class Classification1(Enum): + CONTENT = "Content" + FREQUENCY_OR_VOLUME_TOO_HIGH = "Frequency or Volume Too High" + INVALID_ADDRESS = "Invalid Address" + MAILBOX_UNAVAILABLE = "Mailbox Unavailable" + REPUTATION = "Reputation" + TECHNICAL_FAILURE = "Technical Failure" + UNCLASSIFIED = "Unclassified" diff --git a/sendgrid/rest/api/suppressions/v3/models/creat_asm_group201_response.py b/sendgrid/rest/api/suppressions/v3/models/creat_asm_group201_response.py new file mode 100644 index 00000000..07e3fcce --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/creat_asm_group201_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreatAsmGroup201Response: + def __init__( + self, + id: Optional[int] = None, + name: Optional[str] = None, + description: Optional[str] = None, + is_default: Optional[bool] = None, + ): + self.id = id + self.name = name + self.description = description + self.is_default = is_default + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "description": self.description, + "is_default": self.is_default, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreatAsmGroup201Response( + id=payload.get("id"), + name=payload.get("name"), + description=payload.get("description"), + is_default=payload.get("is_default"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/create_global_suppression201_response.py b/sendgrid/rest/api/suppressions/v3/models/create_global_suppression201_response.py new file mode 100644 index 00000000..0dbe683c --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/create_global_suppression201_response.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateGlobalSuppression201Response: + def __init__(self, recipient_emails: Optional[List[str]] = None): + self.recipient_emails = recipient_emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipient_emails": self.recipient_emails}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateGlobalSuppression201Response( + recipient_emails=payload.get("recipient_emails") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/delete_invalid_emails_request.py b/sendgrid/rest/api/suppressions/v3/models/delete_invalid_emails_request.py new file mode 100644 index 00000000..d1db04b9 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/delete_invalid_emails_request.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteInvalidEmailsRequest: + def __init__( + self, delete_all: Optional[bool] = None, emails: Optional[List[str]] = None + ): + self.delete_all = delete_all + self.emails = emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "delete_all": self.delete_all, + "emails": self.emails, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteInvalidEmailsRequest( + delete_all=payload.get("delete_all"), emails=payload.get("emails") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/delete_spam_reports_request.py b/sendgrid/rest/api/suppressions/v3/models/delete_spam_reports_request.py new file mode 100644 index 00000000..02449a8c --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/delete_spam_reports_request.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteSpamReportsRequest: + def __init__( + self, delete_all: Optional[bool] = None, emails: Optional[List[str]] = None + ): + self.delete_all = delete_all + self.emails = emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "delete_all": self.delete_all, + "emails": self.emails, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteSpamReportsRequest( + delete_all=payload.get("delete_all"), emails=payload.get("emails") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/delete_suppression_blocks_request.py b/sendgrid/rest/api/suppressions/v3/models/delete_suppression_blocks_request.py new file mode 100644 index 00000000..d60ba730 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/delete_suppression_blocks_request.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteSuppressionBlocksRequest: + def __init__( + self, delete_all: Optional[bool] = None, emails: Optional[List[str]] = None + ): + self.delete_all = delete_all + self.emails = emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "delete_all": self.delete_all, + "emails": self.emails, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteSuppressionBlocksRequest( + delete_all=payload.get("delete_all"), emails=payload.get("emails") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/delete_suppression_bounces_request.py b/sendgrid/rest/api/suppressions/v3/models/delete_suppression_bounces_request.py new file mode 100644 index 00000000..0bc37918 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/delete_suppression_bounces_request.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteSuppressionBouncesRequest: + def __init__( + self, delete_all: Optional[bool] = None, emails: Optional[List[str]] = None + ): + self.delete_all = delete_all + self.emails = emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "delete_all": self.delete_all, + "emails": self.emails, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteSuppressionBouncesRequest( + delete_all=payload.get("delete_all"), emails=payload.get("emails") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/error_response.py b/sendgrid/rest/api/suppressions/v3/models/error_response.py new file mode 100644 index 00000000..df4e0aed --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/suppressions/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/suppressions/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/get_asm_group200_response.py b/sendgrid/rest/api/suppressions/v3/models/get_asm_group200_response.py new file mode 100644 index 00000000..07ab3655 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/get_asm_group200_response.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetAsmGroup200Response: + def __init__( + self, + name: Optional[str] = None, + description: Optional[str] = None, + is_default: Optional[bool] = None, + id: Optional[int] = None, + unsubscribes: Optional[int] = None, + last_email_sent_at: Optional[str] = None, + ): + self.name = name + self.description = description + self.is_default = is_default + self.id = id + self.unsubscribes = unsubscribes + self.last_email_sent_at = last_email_sent_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "description": self.description, + "is_default": self.is_default, + "id": self.id, + "unsubscribes": self.unsubscribes, + "last_email_sent_at": self.last_email_sent_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetAsmGroup200Response( + name=payload.get("name"), + description=payload.get("description"), + is_default=payload.get("is_default"), + id=payload.get("id"), + unsubscribes=payload.get("unsubscribes"), + last_email_sent_at=payload.get("last_email_sent_at"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response.py b/sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response.py new file mode 100644 index 00000000..53ed4c87 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.get_asm_suppression200_response_suppressions_inner import ( + GetAsmSuppression200ResponseSuppressionsInner, +) + + +class GetAsmSuppression200Response: + def __init__( + self, + suppressions: Optional[ + List[GetAsmSuppression200ResponseSuppressionsInner] + ] = None, + ): + self.suppressions = suppressions + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"suppressions": self.suppressions}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetAsmSuppression200Response(suppressions=payload.get("suppressions")) diff --git a/sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response_suppressions_inner.py b/sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response_suppressions_inner.py new file mode 100644 index 00000000..d7588164 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/get_asm_suppression200_response_suppressions_inner.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetAsmSuppression200ResponseSuppressionsInner: + def __init__( + self, + description: Optional[str] = None, + id: Optional[int] = None, + is_default: Optional[bool] = None, + name: Optional[str] = None, + suppressed: Optional[bool] = None, + ): + self.description = description + self.id = id + self.is_default = is_default + self.name = name + self.suppressed = suppressed + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "description": self.description, + "id": self.id, + "is_default": self.is_default, + "name": self.name, + "suppressed": self.suppressed, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetAsmSuppression200ResponseSuppressionsInner( + description=payload.get("description"), + id=payload.get("id"), + is_default=payload.get("is_default"), + name=payload.get("name"), + suppressed=payload.get("suppressed"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response.py b/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response.py new file mode 100644 index 00000000..00f1b5ec --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.get_suppression_bounces_classifications200_response_result_inner import ( + GetSuppressionBouncesClassifications200ResponseResultInner, +) + + +class GetSuppressionBouncesClassifications200Response: + def __init__( + self, + result: Optional[ + List[GetSuppressionBouncesClassifications200ResponseResultInner] + ] = None, + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSuppressionBouncesClassifications200Response( + result=payload.get("result") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner.py b/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner.py new file mode 100644 index 00000000..0da82f83 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner.py @@ -0,0 +1,34 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.get_suppression_bounces_classifications200_response_result_inner_stats_inner import ( + GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner, +) + + +class GetSuppressionBouncesClassifications200ResponseResultInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[ + List[GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner] + ] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSuppressionBouncesClassifications200ResponseResultInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner_stats_inner.py b/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner_stats_inner.py new file mode 100644 index 00000000..2c2ac758 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/get_suppression_bounces_classifications200_response_result_inner_stats_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner: + def __init__(self, domain: Optional[str] = None, count: Optional[int] = None): + self.domain = domain + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"domain": self.domain, "count": self.count}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSuppressionBouncesClassifications200ResponseResultInnerStatsInner( + domain=payload.get("domain"), count=payload.get("count") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/invalid_email.py b/sendgrid/rest/api/suppressions/v3/models/invalid_email.py new file mode 100644 index 00000000..52725925 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/invalid_email.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InvalidEmail: + def __init__( + self, + created: Optional[int] = None, + email: Optional[str] = None, + reason: Optional[str] = None, + ): + self.created = created + self.email = email + self.reason = reason + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created": self.created, + "email": self.email, + "reason": self.reason, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InvalidEmail( + created=payload.get("created"), + email=payload.get("email"), + reason=payload.get("reason"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/list_asm_suppression200_response_inner.py b/sendgrid/rest/api/suppressions/v3/models/list_asm_suppression200_response_inner.py new file mode 100644 index 00000000..b7170511 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/list_asm_suppression200_response_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListAsmSuppression200ResponseInner: + def __init__( + self, + email: Optional[str] = None, + group_id: Optional[int] = None, + group_name: Optional[str] = None, + created_at: Optional[int] = None, + ): + self.email = email + self.group_id = group_id + self.group_name = group_name + self.created_at = created_at + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "group_id": self.group_id, + "group_name": self.group_name, + "created_at": self.created_at, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListAsmSuppression200ResponseInner( + email=payload.get("email"), + group_id=payload.get("group_id"), + group_name=payload.get("group_name"), + created_at=payload.get("created_at"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/list_global_suppression200_response_inner.py b/sendgrid/rest/api/suppressions/v3/models/list_global_suppression200_response_inner.py new file mode 100644 index 00000000..ac814144 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/list_global_suppression200_response_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListGlobalSuppression200ResponseInner: + def __init__(self, created: Optional[int] = None, email: Optional[str] = None): + self.created = created + self.email = email + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"created": self.created, "email": self.email}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListGlobalSuppression200ResponseInner( + created=payload.get("created"), email=payload.get("email") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response.py b/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response.py new file mode 100644 index 00000000..15632a39 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.list_suppression_bounces_classifications200_response_result_inner import ( + ListSuppressionBouncesClassifications200ResponseResultInner, +) + + +class ListSuppressionBouncesClassifications200Response: + def __init__( + self, + result: Optional[ + List[ListSuppressionBouncesClassifications200ResponseResultInner] + ] = None, + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSuppressionBouncesClassifications200Response( + result=payload.get("result") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner.py b/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner.py new file mode 100644 index 00000000..aba82ca9 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner.py @@ -0,0 +1,34 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.list_suppression_bounces_classifications200_response_result_inner_stats_inner import ( + ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner, +) + + +class ListSuppressionBouncesClassifications200ResponseResultInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[ + List[ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner] + ] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSuppressionBouncesClassifications200ResponseResultInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner_stats_inner.py b/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner_stats_inner.py new file mode 100644 index 00000000..83ccbec6 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/list_suppression_bounces_classifications200_response_result_inner_stats_inner.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.suppressions.v3.models.classification import Classification + + +class ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner: + def __init__( + self, + classification: Optional[Classification] = None, + count: Optional[int] = None, + ): + self.classification = classification + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "classification": self.classification, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSuppressionBouncesClassifications200ResponseResultInnerStatsInner( + classification=payload.get("classification"), count=payload.get("count") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/retrieve_a_global_suppression_response.py b/sendgrid/rest/api/suppressions/v3/models/retrieve_a_global_suppression_response.py new file mode 100644 index 00000000..da71559c --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/retrieve_a_global_suppression_response.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class RetrieveAGlobalSuppressionResponse: + def __init__(self, recipient_email: Optional[str] = None): + self.recipient_email = recipient_email + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipient_email": self.recipient_email}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return RetrieveAGlobalSuppressionResponse( + recipient_email=payload.get("recipient_email") + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/spam_reports_response_inner.py b/sendgrid/rest/api/suppressions/v3/models/spam_reports_response_inner.py new file mode 100644 index 00000000..bc3ed173 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/spam_reports_response_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SpamReportsResponseInner: + def __init__( + self, + created: Optional[int] = None, + email: Optional[str] = None, + ip: Optional[str] = None, + ): + self.created = created + self.email = email + self.ip = ip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created": self.created, + "email": self.email, + "ip": self.ip, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SpamReportsResponseInner( + created=payload.get("created"), + email=payload.get("email"), + ip=payload.get("ip"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/suppression_group.py b/sendgrid/rest/api/suppressions/v3/models/suppression_group.py new file mode 100644 index 00000000..4f2b5a9b --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/suppression_group.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SuppressionGroup: + def __init__( + self, + id: Optional[float] = None, + name: Optional[str] = None, + description: Optional[str] = None, + last_email_sent_at: Optional[int] = None, + is_default: Optional[bool] = None, + unsubscribes: Optional[int] = None, + ): + self.id = id + self.name = name + self.description = description + self.last_email_sent_at = last_email_sent_at + self.is_default = is_default + self.unsubscribes = unsubscribes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "description": self.description, + "last_email_sent_at": self.last_email_sent_at, + "is_default": self.is_default, + "unsubscribes": self.unsubscribes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SuppressionGroup( + id=payload.get("id"), + name=payload.get("name"), + description=payload.get("description"), + last_email_sent_at=payload.get("last_email_sent_at"), + is_default=payload.get("is_default"), + unsubscribes=payload.get("unsubscribes"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/suppression_group_request_base_props.py b/sendgrid/rest/api/suppressions/v3/models/suppression_group_request_base_props.py new file mode 100644 index 00000000..3c1f69f8 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/suppression_group_request_base_props.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SuppressionGroupRequestBaseProps: + def __init__( + self, + name: Optional[str] = None, + description: Optional[str] = None, + is_default: Optional[bool] = None, + ): + self.name = name + self.description = description + self.is_default = is_default + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "description": self.description, + "is_default": self.is_default, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SuppressionGroupRequestBaseProps( + name=payload.get("name"), + description=payload.get("description"), + is_default=payload.get("is_default"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/models/suppressions_request.py b/sendgrid/rest/api/suppressions/v3/models/suppressions_request.py new file mode 100644 index 00000000..a00814d0 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/suppressions_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SuppressionsRequest: + def __init__(self, recipient_emails: Optional[List[str]] = None): + self.recipient_emails = recipient_emails + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"recipient_emails": self.recipient_emails}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SuppressionsRequest(recipient_emails=payload.get("recipient_emails")) diff --git a/sendgrid/rest/api/suppressions/v3/models/update_asm_group_request.py b/sendgrid/rest/api/suppressions/v3/models/update_asm_group_request.py new file mode 100644 index 00000000..bf00152b --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/models/update_asm_group_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateAsmGroupRequest: + def __init__( + self, + name: Optional[str] = None, + description: Optional[str] = None, + is_default: Optional[bool] = None, + ): + self.name = name + self.description = description + self.is_default = is_default + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "description": self.description, + "is_default": self.is_default, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateAsmGroupRequest( + name=payload.get("name"), + description=payload.get("description"), + is_default=payload.get("is_default"), + ) diff --git a/sendgrid/rest/api/suppressions/v3/search_suppression_from_asm_group.py b/sendgrid/rest/api/suppressions/v3/search_suppression_from_asm_group.py new file mode 100644 index 00000000..434e3d6f --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/search_suppression_from_asm_group.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.suppressions_request import ( + SuppressionsRequest, +) + + +class SearchSuppressionFromAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + on_behalf_of: Optional[str] = None, + suppressions_request: Optional[SuppressionsRequest] = None, + ): + path = "/v3/asm/groups/{group_id}/suppressions/search" + path = path.format( + group_id=group_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if suppressions_request: + data = suppressions_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/suppressions/v3/update_asm_group.py b/sendgrid/rest/api/suppressions/v3/update_asm_group.py new file mode 100644 index 00000000..3eb21b90 --- /dev/null +++ b/sendgrid/rest/api/suppressions/v3/update_asm_group.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Suppressions API + The Twilio SendGrid Suppressions API allows you to manage your Suppressions or Unsubscribes and Suppression or Unsubscribe groups. With SendGrid, an unsubscribe is the action an email recipient takes when they opt-out of receiving your messages. A suppression is the action you take as a sender to filter or suppress an unsubscribed address from your email send. From the perspective of the recipient, your suppression is the result of their unsubscribe. You can have global suppressions, which represent addresses that have been unsubscribed from all of your emails. You can also have suppression groups, also known as ASM groups, which represent categories or groups of emails that your recipients can unsubscribe from, rather than unsubscribing from all of your messages. SendGrid automatically suppresses emails sent to users for a variety of reasons, including blocks, bounces, invalid email addresses, spam reports, and unsubscribes. SendGrid suppresses these messages to help you maintain the best possible sender reputation by attempting to prevent unwanted mail. You may also add addresses to your suppressions. See [**Suppressions**](https://docs.sendgrid.com/for-developers/sending-email/suppressions) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.suppressions.v3.models.update_asm_group_request import ( + UpdateAsmGroupRequest, +) + + +class UpdateAsmGroup: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + group_id: str, + on_behalf_of: Optional[str] = None, + update_asm_group_request: Optional[UpdateAsmGroupRequest] = None, + ): + path = "/v3/asm/groups/{group_id}" + path = path.format( + group_id=group_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_asm_group_request: + data = update_asm_group_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/__init__.py b/sendgrid/rest/api/teammates/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/teammates/v3/delete_pending_teammate.py b/sendgrid/rest/api/teammates/v3/delete_pending_teammate.py new file mode 100644 index 00000000..cec40e54 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/delete_pending_teammate.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeletePendingTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + token: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/teammates/pending/{token}" + path = path.format( + token=token, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/delete_teammate.py b/sendgrid/rest/api/teammates/v3/delete_teammate.py new file mode 100644 index 00000000..de80d160 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/delete_teammate.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/teammates/{username}" + path = path.format( + username=username, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/get_teammate.py b/sendgrid/rest/api/teammates/v3/get_teammate.py new file mode 100644 index 00000000..86a409be --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/get_teammate.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/teammates/{username}" + path = path.format( + username=username, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/invite_teammate.py b/sendgrid/rest/api/teammates/v3/invite_teammate.py new file mode 100644 index 00000000..a30f61ee --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/invite_teammate.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.teammates.v3.models.invite_teammate_request import ( + InviteTeammateRequest, +) + + +class InviteTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + invite_teammate_request: Optional[InviteTeammateRequest] = None, + ): + path = "/v3/teammates" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if invite_teammate_request: + data = invite_teammate_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/list_pending_teammate.py b/sendgrid/rest/api/teammates/v3/list_pending_teammate.py new file mode 100644 index 00000000..e2f6be71 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/list_pending_teammate.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListPendingTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/teammates/pending" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/list_subuser_by_template.py b/sendgrid/rest/api/teammates/v3/list_subuser_by_template.py new file mode 100644 index 00000000..1ad7bb5b --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/list_subuser_by_template.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSubuserByTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + teammate_name: str, + after_subuser_id: Optional[int] = None, + limit: Optional[int] = None, + username: Optional[str] = None, + ): + path = "/v3/teammates/{teammate_name}/subuser_access" + path = path.format( + teammate_name=teammate_name, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/list_teammate.py b/sendgrid/rest/api/teammates/v3/list_teammate.py new file mode 100644 index 00000000..5c15719c --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/list_teammate.py @@ -0,0 +1,60 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[int] = None, + offset: Optional[int] = None, + ): + path = "/v3/teammates" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/models/__init__.py b/sendgrid/rest/api/teammates/v3/models/__init__.py new file mode 100644 index 00000000..1050f5a2 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/__init__.py @@ -0,0 +1,98 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.teammates.v3.models.get_teammate200_response import ( + GetTeammate200Response, +) +from sendgrid.rest.api.teammates.v3.models.invite_teammate201_response import ( + InviteTeammate201Response, +) +from sendgrid.rest.api.teammates.v3.models.invite_teammate400_response import ( + InviteTeammate400Response, +) +from sendgrid.rest.api.teammates.v3.models.invite_teammate400_response_errors_inner import ( + InviteTeammate400ResponseErrorsInner, +) +from sendgrid.rest.api.teammates.v3.models.invite_teammate_request import ( + InviteTeammateRequest, +) +from sendgrid.rest.api.teammates.v3.models.list_pending_teammate200_response import ( + ListPendingTeammate200Response, +) +from sendgrid.rest.api.teammates.v3.models.list_pending_teammate200_response_result_inner import ( + ListPendingTeammate200ResponseResultInner, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response import ( + ListSubuserByTemplate200Response, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response_metadata import ( + ListSubuserByTemplate200ResponseMetadata, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response_metadata_next_params import ( + ListSubuserByTemplate200ResponseMetadataNextParams, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response_subuser_access_inner import ( + ListSubuserByTemplate200ResponseSubuserAccessInner, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template400_response import ( + ListSubuserByTemplate400Response, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template400_response_errors_inner import ( + ListSubuserByTemplate400ResponseErrorsInner, +) +from sendgrid.rest.api.teammates.v3.models.list_teammate200_response import ( + ListTeammate200Response, +) +from sendgrid.rest.api.teammates.v3.models.list_teammate200_response_result_inner import ( + ListTeammate200ResponseResultInner, +) +from sendgrid.rest.api.teammates.v3.models.permission_type import PermissionType +from sendgrid.rest.api.teammates.v3.models.resend_teammate_invite200_response import ( + ResendTeammateInvite200Response, +) +from sendgrid.rest.api.teammates.v3.models.update_teammate200_response import ( + UpdateTeammate200Response, +) +from sendgrid.rest.api.teammates.v3.models.update_teammate_request import ( + UpdateTeammateRequest, +) +from sendgrid.rest.api.teammates.v3.models.user_type import UserType +from sendgrid.rest.api.teammates.v3.models.user_type1 import UserType1 +from sendgrid.rest.api.teammates.v3.models.user_type2 import UserType2 + +__all__ = [ + "GetTeammate200Response", + "InviteTeammate201Response", + "InviteTeammate400Response", + "InviteTeammate400ResponseErrorsInner", + "InviteTeammateRequest", + "ListPendingTeammate200Response", + "ListPendingTeammate200ResponseResultInner", + "ListSubuserByTemplate200Response", + "ListSubuserByTemplate200ResponseMetadata", + "ListSubuserByTemplate200ResponseMetadataNextParams", + "ListSubuserByTemplate200ResponseSubuserAccessInner", + "ListSubuserByTemplate400Response", + "ListSubuserByTemplate400ResponseErrorsInner", + "ListTeammate200Response", + "ListTeammate200ResponseResultInner", + "PermissionType", + "ResendTeammateInvite200Response", + "UpdateTeammate200Response", + "UpdateTeammateRequest", + "UserType", + "UserType1", + "UserType2", +] +# Testing code diff --git a/sendgrid/rest/api/teammates/v3/models/get_teammate200_response.py b/sendgrid/rest/api/teammates/v3/models/get_teammate200_response.py new file mode 100644 index 00000000..4f2eb1e1 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/get_teammate200_response.py @@ -0,0 +1,86 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.user_type1 import UserType1 + + +class GetTeammate200Response: + def __init__( + self, + username: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email: Optional[str] = None, + scopes: Optional[List[object]] = None, + user_type: Optional[UserType1] = None, + is_admin: Optional[bool] = None, + phone: Optional[str] = None, + website: Optional[str] = None, + address: Optional[str] = None, + address2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.username = username + self.first_name = first_name + self.last_name = last_name + self.email = email + self.scopes = scopes + self.user_type = user_type + self.is_admin = is_admin + self.phone = phone + self.website = website + self.address = address + self.address2 = address2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, + "scopes": self.scopes, + "user_type": self.user_type, + "is_admin": self.is_admin, + "phone": self.phone, + "website": self.website, + "address": self.address, + "address2": self.address2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetTeammate200Response( + username=payload.get("username"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + email=payload.get("email"), + scopes=payload.get("scopes"), + user_type=payload.get("user_type"), + is_admin=payload.get("is_admin"), + phone=payload.get("phone"), + website=payload.get("website"), + address=payload.get("address"), + address2=payload.get("address2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/invite_teammate201_response.py b/sendgrid/rest/api/teammates/v3/models/invite_teammate201_response.py new file mode 100644 index 00000000..bad25559 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/invite_teammate201_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InviteTeammate201Response: + def __init__( + self, + token: Optional[str] = None, + email: Optional[str] = None, + scopes: Optional[List[object]] = None, + is_admin: Optional[bool] = None, + ): + self.token = token + self.email = email + self.scopes = scopes + self.is_admin = is_admin + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "token": self.token, + "email": self.email, + "scopes": self.scopes, + "is_admin": self.is_admin, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InviteTeammate201Response( + token=payload.get("token"), + email=payload.get("email"), + scopes=payload.get("scopes"), + is_admin=payload.get("is_admin"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/invite_teammate400_response.py b/sendgrid/rest/api/teammates/v3/models/invite_teammate400_response.py new file mode 100644 index 00000000..8fffb6a8 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/invite_teammate400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.invite_teammate400_response_errors_inner import ( + InviteTeammate400ResponseErrorsInner, +) + + +class InviteTeammate400Response: + def __init__( + self, errors: Optional[List[InviteTeammate400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InviteTeammate400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/teammates/v3/models/invite_teammate400_response_errors_inner.py b/sendgrid/rest/api/teammates/v3/models/invite_teammate400_response_errors_inner.py new file mode 100644 index 00000000..5161b1c1 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/invite_teammate400_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InviteTeammate400ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InviteTeammate400ResponseErrorsInner( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/teammates/v3/models/invite_teammate_request.py b/sendgrid/rest/api/teammates/v3/models/invite_teammate_request.py new file mode 100644 index 00000000..d3ad502e --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/invite_teammate_request.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class InviteTeammateRequest: + def __init__( + self, + email: Optional[str] = None, + scopes: Optional[List[str]] = None, + is_admin: Optional[bool] = None, + ): + self.email = email + self.scopes = scopes + self.is_admin = is_admin + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "scopes": self.scopes, + "is_admin": self.is_admin, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return InviteTeammateRequest( + email=payload.get("email"), + scopes=payload.get("scopes"), + is_admin=payload.get("is_admin"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response.py b/sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response.py new file mode 100644 index 00000000..93aa4bed --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.list_pending_teammate200_response_result_inner import ( + ListPendingTeammate200ResponseResultInner, +) + + +class ListPendingTeammate200Response: + def __init__( + self, result: Optional[List[ListPendingTeammate200ResponseResultInner]] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListPendingTeammate200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response_result_inner.py b/sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response_result_inner.py new file mode 100644 index 00000000..81fb1004 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_pending_teammate200_response_result_inner.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListPendingTeammate200ResponseResultInner: + def __init__( + self, + email: Optional[str] = None, + scopes: Optional[List[str]] = None, + is_admin: Optional[bool] = None, + token: Optional[str] = None, + expiration_date: Optional[int] = None, + ): + self.email = email + self.scopes = scopes + self.is_admin = is_admin + self.token = token + self.expiration_date = expiration_date + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "email": self.email, + "scopes": self.scopes, + "is_admin": self.is_admin, + "token": self.token, + "expiration_date": self.expiration_date, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListPendingTeammate200ResponseResultInner( + email=payload.get("email"), + scopes=payload.get("scopes"), + is_admin=payload.get("is_admin"), + token=payload.get("token"), + expiration_date=payload.get("expiration_date"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response.py b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response.py new file mode 100644 index 00000000..719129ce --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response_metadata import ( + ListSubuserByTemplate200ResponseMetadata, +) +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response_subuser_access_inner import ( + ListSubuserByTemplate200ResponseSubuserAccessInner, +) + + +class ListSubuserByTemplate200Response: + def __init__( + self, + has_restricted_subuser_access: Optional[bool] = None, + subuser_access: Optional[ + List[ListSubuserByTemplate200ResponseSubuserAccessInner] + ] = None, + metadata: Optional[ListSubuserByTemplate200ResponseMetadata] = None, + ): + self.has_restricted_subuser_access = has_restricted_subuser_access + self.subuser_access = subuser_access + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "has_restricted_subuser_access": self.has_restricted_subuser_access, + "subuser_access": self.subuser_access, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubuserByTemplate200Response( + has_restricted_subuser_access=payload.get("has_restricted_subuser_access"), + subuser_access=payload.get("subuser_access"), + metadata=payload.get("_metadata"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata.py b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata.py new file mode 100644 index 00000000..cdce7291 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template200_response_metadata_next_params import ( + ListSubuserByTemplate200ResponseMetadataNextParams, +) + + +class ListSubuserByTemplate200ResponseMetadata: + def __init__( + self, + next_params: Optional[ + ListSubuserByTemplate200ResponseMetadataNextParams + ] = None, + ): + self.next_params = next_params + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"next_params": self.next_params}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubuserByTemplate200ResponseMetadata( + next_params=payload.get("next_params") + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata_next_params.py b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata_next_params.py new file mode 100644 index 00000000..3f5837cd --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_metadata_next_params.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListSubuserByTemplate200ResponseMetadataNextParams: + def __init__( + self, + limit: Optional[int] = None, + after_subuser_id: Optional[int] = None, + username: Optional[str] = None, + ): + self.limit = limit + self.after_subuser_id = after_subuser_id + self.username = username + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "limit": self.limit, + "after_subuser_id": self.after_subuser_id, + "username": self.username, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubuserByTemplate200ResponseMetadataNextParams( + limit=payload.get("limit"), + after_subuser_id=payload.get("after_subuser_id"), + username=payload.get("username"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_subuser_access_inner.py b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_subuser_access_inner.py new file mode 100644 index 00000000..30643286 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template200_response_subuser_access_inner.py @@ -0,0 +1,50 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.permission_type import PermissionType + + +class ListSubuserByTemplate200ResponseSubuserAccessInner: + def __init__( + self, + id: Optional[int] = None, + username: Optional[str] = None, + email: Optional[str] = None, + disabled: Optional[bool] = None, + permission_type: Optional[PermissionType] = None, + scopes: Optional[List[str]] = None, + ): + self.id = id + self.username = username + self.email = email + self.disabled = disabled + self.permission_type = permission_type + self.scopes = scopes + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "username": self.username, + "email": self.email, + "disabled": self.disabled, + "permission_type": self.permission_type, + "scopes": self.scopes, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubuserByTemplate200ResponseSubuserAccessInner( + id=payload.get("id"), + username=payload.get("username"), + email=payload.get("email"), + disabled=payload.get("disabled"), + permission_type=payload.get("permission_type"), + scopes=payload.get("scopes"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response.py b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response.py new file mode 100644 index 00000000..8d58e93d --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.list_subuser_by_template400_response_errors_inner import ( + ListSubuserByTemplate400ResponseErrorsInner, +) + + +class ListSubuserByTemplate400Response: + def __init__( + self, errors: Optional[List[ListSubuserByTemplate400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubuserByTemplate400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response_errors_inner.py b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response_errors_inner.py new file mode 100644 index 00000000..7ebf5a15 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_subuser_by_template400_response_errors_inner.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListSubuserByTemplate400ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, field: Optional[str] = None): + self.message = message + self.field = field + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message, "field": self.field}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListSubuserByTemplate400ResponseErrorsInner( + message=payload.get("message"), field=payload.get("field") + ) diff --git a/sendgrid/rest/api/teammates/v3/models/list_teammate200_response.py b/sendgrid/rest/api/teammates/v3/models/list_teammate200_response.py new file mode 100644 index 00000000..7d5389a9 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_teammate200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.list_teammate200_response_result_inner import ( + ListTeammate200ResponseResultInner, +) + + +class ListTeammate200Response: + def __init__( + self, result: Optional[List[ListTeammate200ResponseResultInner]] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTeammate200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/teammates/v3/models/list_teammate200_response_result_inner.py b/sendgrid/rest/api/teammates/v3/models/list_teammate200_response_result_inner.py new file mode 100644 index 00000000..ca9a5c2d --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/list_teammate200_response_result_inner.py @@ -0,0 +1,82 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.user_type import UserType + + +class ListTeammate200ResponseResultInner: + def __init__( + self, + username: Optional[str] = None, + email: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + user_type: Optional[UserType] = None, + is_admin: Optional[bool] = None, + phone: Optional[str] = None, + website: Optional[str] = None, + address: Optional[str] = None, + address2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.username = username + self.email = email + self.first_name = first_name + self.last_name = last_name + self.user_type = user_type + self.is_admin = is_admin + self.phone = phone + self.website = website + self.address = address + self.address2 = address2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "email": self.email, + "first_name": self.first_name, + "last_name": self.last_name, + "user_type": self.user_type, + "is_admin": self.is_admin, + "phone": self.phone, + "website": self.website, + "address": self.address, + "address2": self.address2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTeammate200ResponseResultInner( + username=payload.get("username"), + email=payload.get("email"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + user_type=payload.get("user_type"), + is_admin=payload.get("is_admin"), + phone=payload.get("phone"), + website=payload.get("website"), + address=payload.get("address"), + address2=payload.get("address2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/permission_type.py b/sendgrid/rest/api/teammates/v3/models/permission_type.py new file mode 100644 index 00000000..14aced3d --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/permission_type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class PermissionType(Enum): + ADMIN = "admin" + RESTRICTED = "restricted" diff --git a/sendgrid/rest/api/teammates/v3/models/resend_teammate_invite200_response.py b/sendgrid/rest/api/teammates/v3/models/resend_teammate_invite200_response.py new file mode 100644 index 00000000..9ae58498 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/resend_teammate_invite200_response.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ResendTeammateInvite200Response: + def __init__( + self, + token: Optional[str] = None, + email: Optional[str] = None, + scopes: Optional[List[str]] = None, + is_admin: Optional[bool] = None, + ): + self.token = token + self.email = email + self.scopes = scopes + self.is_admin = is_admin + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "token": self.token, + "email": self.email, + "scopes": self.scopes, + "is_admin": self.is_admin, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ResendTeammateInvite200Response( + token=payload.get("token"), + email=payload.get("email"), + scopes=payload.get("scopes"), + is_admin=payload.get("is_admin"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/update_teammate200_response.py b/sendgrid/rest/api/teammates/v3/models/update_teammate200_response.py new file mode 100644 index 00000000..badfa52b --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/update_teammate200_response.py @@ -0,0 +1,86 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.teammates.v3.models.user_type2 import UserType2 + + +class UpdateTeammate200Response: + def __init__( + self, + username: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email: Optional[str] = None, + scopes: Optional[List[str]] = None, + user_type: Optional[UserType2] = None, + is_admin: Optional[bool] = None, + phone: Optional[str] = None, + website: Optional[str] = None, + address: Optional[str] = None, + address2: Optional[str] = None, + city: Optional[str] = None, + state: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.username = username + self.first_name = first_name + self.last_name = last_name + self.email = email + self.scopes = scopes + self.user_type = user_type + self.is_admin = is_admin + self.phone = phone + self.website = website + self.address = address + self.address2 = address2 + self.city = city + self.state = state + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "first_name": self.first_name, + "last_name": self.last_name, + "email": self.email, + "scopes": self.scopes, + "user_type": self.user_type, + "is_admin": self.is_admin, + "phone": self.phone, + "website": self.website, + "address": self.address, + "address2": self.address2, + "city": self.city, + "state": self.state, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateTeammate200Response( + username=payload.get("username"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + email=payload.get("email"), + scopes=payload.get("scopes"), + user_type=payload.get("user_type"), + is_admin=payload.get("is_admin"), + phone=payload.get("phone"), + website=payload.get("website"), + address=payload.get("address"), + address2=payload.get("address2"), + city=payload.get("city"), + state=payload.get("state"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/teammates/v3/models/update_teammate_request.py b/sendgrid/rest/api/teammates/v3/models/update_teammate_request.py new file mode 100644 index 00000000..0e479afa --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/update_teammate_request.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateTeammateRequest: + def __init__( + self, scopes: Optional[List[str]] = None, is_admin: Optional[bool] = None + ): + self.scopes = scopes + self.is_admin = is_admin + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"scopes": self.scopes, "is_admin": self.is_admin}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateTeammateRequest( + scopes=payload.get("scopes"), is_admin=payload.get("is_admin") + ) diff --git a/sendgrid/rest/api/teammates/v3/models/user_type.py b/sendgrid/rest/api/teammates/v3/models/user_type.py new file mode 100644 index 00000000..c57452aa --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/user_type.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class UserType(Enum): + ADMIN = "admin" + OWNER = "owner" + TEAMMATE = "teammate" diff --git a/sendgrid/rest/api/teammates/v3/models/user_type1.py b/sendgrid/rest/api/teammates/v3/models/user_type1.py new file mode 100644 index 00000000..a6466dbb --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/user_type1.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class UserType1(Enum): + ADMIN = "admin" + OWNER = "owner" + TEAMMATE = "teammate" diff --git a/sendgrid/rest/api/teammates/v3/models/user_type2.py b/sendgrid/rest/api/teammates/v3/models/user_type2.py new file mode 100644 index 00000000..01e9dae5 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/models/user_type2.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class UserType2(Enum): + ADMIN = "admin" + OWNER = "owner" + TEAMMATE = "teammate" diff --git a/sendgrid/rest/api/teammates/v3/resend_teammate_invite.py b/sendgrid/rest/api/teammates/v3/resend_teammate_invite.py new file mode 100644 index 00000000..fb2de11f --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/resend_teammate_invite.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ResendTeammateInvite: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + token: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/teammates/pending/{token}/resend" + path = path.format( + token=token, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/teammates/v3/update_teammate.py b/sendgrid/rest/api/teammates/v3/update_teammate.py new file mode 100644 index 00000000..3bf167b9 --- /dev/null +++ b/sendgrid/rest/api/teammates/v3/update_teammate.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Teammates API + The Twilio SendGrid Teammates API allows you to add, manage, and remove Teammates, or user accounts, from your SendGrid account. Teammates function like user accounts on the SendGrid account, allowing you to invite additional users to your account with scoped access. You can think of Teammates as SendGrid's approach to enabling [role-based access control](https://en.wikipedia.org/wiki/Role-based_access_control) for your SendGrid account. For even more control over the access to your account, see the [Twilio SendGrid SSO API](https://docs.sendgrid.com/api-reference/single-sign-on-teammates/), which enables SSO-authenticated Teammates to be managed through a SAML 2.0 identity provider. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.teammates.v3.models.update_teammate_request import ( + UpdateTeammateRequest, +) + + +class UpdateTeammate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + username: str, + on_behalf_of: Optional[str] = None, + update_teammate_request: Optional[UpdateTeammateRequest] = None, + ): + path = "/v3/teammates/{username}" + path = path.format( + username=username, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_teammate_request: + data = update_teammate_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/__init__.py b/sendgrid/rest/api/templates/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/templates/v3/activate_template_version.py b/sendgrid/rest/api/templates/v3/activate_template_version.py new file mode 100644 index 00000000..bd93c2f8 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/activate_template_version.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ActivateTemplateVersion: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + version_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/templates/{template_id}/versions/{version_id}/activate" + path = path.format( + template_id=template_id, + version_id=version_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/create_template.py b/sendgrid/rest/api/templates/v3/create_template.py new file mode 100644 index 00000000..0e5afd87 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/create_template.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.templates.v3.models.create_template_request import ( + CreateTemplateRequest, +) + + +class CreateTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + create_template_request: Optional[CreateTemplateRequest] = None, + ): + path = "/v3/templates" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if create_template_request: + data = create_template_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/create_template_version.py b/sendgrid/rest/api/templates/v3/create_template_version.py new file mode 100644 index 00000000..247c52d5 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/create_template_version.py @@ -0,0 +1,71 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.templates.v3.models.transactional_template_version_create import ( + TransactionalTemplateVersionCreate, +) + + +class CreateTemplateVersion: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + on_behalf_of: Optional[str] = None, + transactional_template_version_create: Optional[ + TransactionalTemplateVersionCreate + ] = None, + ): + path = "/v3/templates/{template_id}/versions" + path = path.format( + template_id=template_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if transactional_template_version_create: + data = transactional_template_version_create.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/delete_template.py b/sendgrid/rest/api/templates/v3/delete_template.py new file mode 100644 index 00000000..4dedc0e2 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/delete_template.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/templates/{template_id}" + path = path.format( + template_id=template_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/delete_template_version.py b/sendgrid/rest/api/templates/v3/delete_template_version.py new file mode 100644 index 00000000..cf1c1a2b --- /dev/null +++ b/sendgrid/rest/api/templates/v3/delete_template_version.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteTemplateVersion: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + version_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/templates/{template_id}/versions/{version_id}" + path = path.format( + template_id=template_id, + version_id=version_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/duplicate_template.py b/sendgrid/rest/api/templates/v3/duplicate_template.py new file mode 100644 index 00000000..05d51b38 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/duplicate_template.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.templates.v3.models.duplicate_template_request import ( + DuplicateTemplateRequest, +) + + +class DuplicateTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + on_behalf_of: Optional[str] = None, + duplicate_template_request: Optional[DuplicateTemplateRequest] = None, + ): + path = "/v3/templates/{template_id}" + path = path.format( + template_id=template_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if duplicate_template_request: + data = duplicate_template_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/get_template.py b/sendgrid/rest/api/templates/v3/get_template.py new file mode 100644 index 00000000..35d06eac --- /dev/null +++ b/sendgrid/rest/api/templates/v3/get_template.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/templates/{template_id}" + path = path.format( + template_id=template_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/get_template_version.py b/sendgrid/rest/api/templates/v3/get_template_version.py new file mode 100644 index 00000000..4a590c9d --- /dev/null +++ b/sendgrid/rest/api/templates/v3/get_template_version.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetTemplateVersion: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + version_id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/templates/{template_id}/versions/{version_id}" + path = path.format( + template_id=template_id, + version_id=version_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/list_template.py b/sendgrid/rest/api/templates/v3/list_template.py new file mode 100644 index 00000000..77ce48a5 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/list_template.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.templates.v3.models.generations import Generations + + +class ListTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + generations: Optional[Generations] = None, + page_size: Optional[float] = None, + page_token: Optional[str] = None, + ): + path = "/v3/templates" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/models/__init__.py b/sendgrid/rest/api/templates/v3/models/__init__.py new file mode 100644 index 00000000..616713b1 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/__init__.py @@ -0,0 +1,82 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.templates.v3.models.active import Active +from sendgrid.rest.api.templates.v3.models.active1 import Active1 +from sendgrid.rest.api.templates.v3.models.create_template_request import ( + CreateTemplateRequest, +) +from sendgrid.rest.api.templates.v3.models.duplicate_template_request import ( + DuplicateTemplateRequest, +) +from sendgrid.rest.api.templates.v3.models.editor import Editor +from sendgrid.rest.api.templates.v3.models.editor1 import Editor1 +from sendgrid.rest.api.templates.v3.models.generation import Generation +from sendgrid.rest.api.templates.v3.models.generation1 import Generation1 +from sendgrid.rest.api.templates.v3.models.generations import Generations +from sendgrid.rest.api.templates.v3.models.list_template200_response import ( + ListTemplate200Response, +) +from sendgrid.rest.api.templates.v3.models.list_template400_response import ( + ListTemplate400Response, +) +from sendgrid.rest.api.templates.v3.models.list_template400_response_errors_inner import ( + ListTemplate400ResponseErrorsInner, +) +from sendgrid.rest.api.templates.v3.models.metadata import Metadata +from sendgrid.rest.api.templates.v3.models.transactional_template import ( + TransactionalTemplate, +) +from sendgrid.rest.api.templates.v3.models.transactional_template_version_create import ( + TransactionalTemplateVersionCreate, +) +from sendgrid.rest.api.templates.v3.models.transactional_template_version_output import ( + TransactionalTemplateVersionOutput, +) +from sendgrid.rest.api.templates.v3.models.transactional_template_warning import ( + TransactionalTemplateWarning, +) +from sendgrid.rest.api.templates.v3.models.transactional_templates_template_lean import ( + TransactionalTemplatesTemplateLean, +) +from sendgrid.rest.api.templates.v3.models.transactional_templates_version_output_lean import ( + TransactionalTemplatesVersionOutputLean, +) +from sendgrid.rest.api.templates.v3.models.update_template_request import ( + UpdateTemplateRequest, +) + +__all__ = [ + "Active", + "Active1", + "CreateTemplateRequest", + "DuplicateTemplateRequest", + "Editor", + "Editor1", + "Generation", + "Generation1", + "Generations", + "ListTemplate200Response", + "ListTemplate400Response", + "ListTemplate400ResponseErrorsInner", + "Metadata", + "TransactionalTemplate", + "TransactionalTemplateVersionCreate", + "TransactionalTemplateVersionOutput", + "TransactionalTemplateWarning", + "TransactionalTemplatesTemplateLean", + "TransactionalTemplatesVersionOutputLean", + "UpdateTemplateRequest", +] +# Testing code diff --git a/sendgrid/rest/api/templates/v3/models/active.py b/sendgrid/rest/api/templates/v3/models/active.py new file mode 100644 index 00000000..65593356 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/active.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Active(Enum): + NUMBER_0 = 0 + NUMBER_1 = 1 diff --git a/sendgrid/rest/api/templates/v3/models/active1.py b/sendgrid/rest/api/templates/v3/models/active1.py new file mode 100644 index 00000000..a730bf0c --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/active1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Active1(Enum): + NUMBER_0 = 0 + NUMBER_1 = 1 diff --git a/sendgrid/rest/api/templates/v3/models/create_template_request.py b/sendgrid/rest/api/templates/v3/models/create_template_request.py new file mode 100644 index 00000000..f98f7ce4 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/create_template_request.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.generation import Generation + + +class CreateTemplateRequest: + def __init__( + self, name: Optional[str] = None, generation: Optional[Generation] = None + ): + self.name = name + self.generation = generation + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name, "generation": self.generation}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateTemplateRequest( + name=payload.get("name"), generation=payload.get("generation") + ) diff --git a/sendgrid/rest/api/templates/v3/models/duplicate_template_request.py b/sendgrid/rest/api/templates/v3/models/duplicate_template_request.py new file mode 100644 index 00000000..4431575e --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/duplicate_template_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DuplicateTemplateRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DuplicateTemplateRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/templates/v3/models/editor.py b/sendgrid/rest/api/templates/v3/models/editor.py new file mode 100644 index 00000000..47b41f47 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/editor.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Editor(Enum): + CODE = "code" + DESIGN = "design" diff --git a/sendgrid/rest/api/templates/v3/models/editor1.py b/sendgrid/rest/api/templates/v3/models/editor1.py new file mode 100644 index 00000000..a50f81cc --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/editor1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Editor1(Enum): + CODE = "code" + DESIGN = "design" diff --git a/sendgrid/rest/api/templates/v3/models/generation.py b/sendgrid/rest/api/templates/v3/models/generation.py new file mode 100644 index 00000000..59c0db9f --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/generation.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Generation(Enum): + LEGACY = "legacy" + DYNAMIC = "dynamic" diff --git a/sendgrid/rest/api/templates/v3/models/generation1.py b/sendgrid/rest/api/templates/v3/models/generation1.py new file mode 100644 index 00000000..888519c2 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/generation1.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Generation1(Enum): + LEGACY = "legacy" + DYNAMIC = "dynamic" diff --git a/sendgrid/rest/api/templates/v3/models/generations.py b/sendgrid/rest/api/templates/v3/models/generations.py new file mode 100644 index 00000000..42f3e0a1 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/generations.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class Generations(Enum): + LEGACY = "legacy" + DYNAMIC = "dynamic" + LEGACY_COMMA_DYNAMIC = "legacy,dynamic" diff --git a/sendgrid/rest/api/templates/v3/models/list_template200_response.py b/sendgrid/rest/api/templates/v3/models/list_template200_response.py new file mode 100644 index 00000000..5b57ae2d --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/list_template200_response.py @@ -0,0 +1,36 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.metadata import Metadata +from sendgrid.rest.api.templates.v3.models.transactional_templates_template_lean import ( + TransactionalTemplatesTemplateLean, +) + + +class ListTemplate200Response: + def __init__( + self, + result: Optional[List[TransactionalTemplatesTemplateLean]] = None, + metadata: Optional[Metadata] = None, + ): + self.result = result + self.metadata = metadata + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "result": self.result, + "_metadata": self.metadata, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTemplate200Response( + result=payload.get("result"), metadata=payload.get("_metadata") + ) diff --git a/sendgrid/rest/api/templates/v3/models/list_template400_response.py b/sendgrid/rest/api/templates/v3/models/list_template400_response.py new file mode 100644 index 00000000..78d38671 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/list_template400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.list_template400_response_errors_inner import ( + ListTemplate400ResponseErrorsInner, +) + + +class ListTemplate400Response: + def __init__( + self, errors: Optional[List[ListTemplate400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTemplate400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/templates/v3/models/list_template400_response_errors_inner.py b/sendgrid/rest/api/templates/v3/models/list_template400_response_errors_inner.py new file mode 100644 index 00000000..c4e0826c --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/list_template400_response_errors_inner.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListTemplate400ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, error_id: Optional[str] = None): + self.message = message + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTemplate400ResponseErrorsInner( + message=payload.get("message"), error_id=payload.get("error_id") + ) diff --git a/sendgrid/rest/api/templates/v3/models/metadata.py b/sendgrid/rest/api/templates/v3/models/metadata.py new file mode 100644 index 00000000..3281a432 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/metadata.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class Metadata: + def __init__( + self, + prev: Optional[str] = None, + var_self: Optional[str] = None, + next: Optional[str] = None, + count: Optional[int] = None, + ): + self.prev = prev + self.var_self = var_self + self.next = next + self.count = count + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "prev": self.prev, + "self": self.var_self, + "next": self.next, + "count": self.count, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return Metadata( + prev=payload.get("prev"), + var_self=payload.get("self"), + next=payload.get("next"), + count=payload.get("count"), + ) diff --git a/sendgrid/rest/api/templates/v3/models/transactional_template.py b/sendgrid/rest/api/templates/v3/models/transactional_template.py new file mode 100644 index 00000000..bced593b --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/transactional_template.py @@ -0,0 +1,56 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.generation1 import Generation1 +from sendgrid.rest.api.templates.v3.models.transactional_template_warning import ( + TransactionalTemplateWarning, +) +from sendgrid.rest.api.templates.v3.models.transactional_templates_version_output_lean import ( + TransactionalTemplatesVersionOutputLean, +) + + +class TransactionalTemplate: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + generation: Optional[Generation1] = None, + updated_at: Optional[str] = None, + versions: Optional[List[TransactionalTemplatesVersionOutputLean]] = None, + warning: Optional[TransactionalTemplateWarning] = None, + ): + self.id = id + self.name = name + self.generation = generation + self.updated_at = updated_at + self.versions = versions + self.warning = warning + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "generation": self.generation, + "updated_at": self.updated_at, + "versions": self.versions, + "warning": self.warning, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return TransactionalTemplate( + id=payload.get("id"), + name=payload.get("name"), + generation=payload.get("generation"), + updated_at=payload.get("updated_at"), + versions=payload.get("versions"), + warning=payload.get("warning"), + ) diff --git a/sendgrid/rest/api/templates/v3/models/transactional_template_version_create.py b/sendgrid/rest/api/templates/v3/models/transactional_template_version_create.py new file mode 100644 index 00000000..63b19426 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/transactional_template_version_create.py @@ -0,0 +1,59 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.active import Active +from sendgrid.rest.api.templates.v3.models.editor import Editor + + +class TransactionalTemplateVersionCreate: + def __init__( + self, + active: Optional[Active] = None, + name: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + generate_plain_content: Optional[bool] = None, + subject: Optional[str] = None, + editor: Optional[Editor] = None, + test_data: Optional[str] = None, + ): + self.active = active + self.name = name + self.html_content = html_content + self.plain_content = plain_content + self.generate_plain_content = generate_plain_content + self.subject = subject + self.editor = editor + self.test_data = test_data + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "active": self.active, + "name": self.name, + "html_content": self.html_content, + "plain_content": self.plain_content, + "generate_plain_content": self.generate_plain_content, + "subject": self.subject, + "editor": self.editor, + "test_data": self.test_data, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return TransactionalTemplateVersionCreate( + active=payload.get("active"), + name=payload.get("name"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + generate_plain_content=payload.get("generate_plain_content"), + subject=payload.get("subject"), + editor=payload.get("editor"), + test_data=payload.get("test_data"), + ) diff --git a/sendgrid/rest/api/templates/v3/models/transactional_template_version_output.py b/sendgrid/rest/api/templates/v3/models/transactional_template_version_output.py new file mode 100644 index 00000000..55b83ad3 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/transactional_template_version_output.py @@ -0,0 +1,82 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.active1 import Active1 +from sendgrid.rest.api.templates.v3.models.editor1 import Editor1 +from sendgrid.rest.api.templates.v3.models.transactional_template_warning import ( + TransactionalTemplateWarning, +) + + +class TransactionalTemplateVersionOutput: + def __init__( + self, + warnings: Optional[List[TransactionalTemplateWarning]] = None, + active: Optional[Active1] = None, + name: Optional[str] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + generate_plain_content: Optional[bool] = None, + subject: Optional[str] = None, + editor: Optional[Editor1] = None, + test_data: Optional[str] = None, + id: Optional[str] = None, + template_id: Optional[str] = None, + updated_at: Optional[str] = None, + thumbnail_url: Optional[str] = None, + ): + self.warnings = warnings + self.active = active + self.name = name + self.html_content = html_content + self.plain_content = plain_content + self.generate_plain_content = generate_plain_content + self.subject = subject + self.editor = editor + self.test_data = test_data + self.id = id + self.template_id = template_id + self.updated_at = updated_at + self.thumbnail_url = thumbnail_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "warnings": self.warnings, + "active": self.active, + "name": self.name, + "html_content": self.html_content, + "plain_content": self.plain_content, + "generate_plain_content": self.generate_plain_content, + "subject": self.subject, + "editor": self.editor, + "test_data": self.test_data, + "id": self.id, + "template_id": self.template_id, + "updated_at": self.updated_at, + "thumbnail_url": self.thumbnail_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return TransactionalTemplateVersionOutput( + warnings=payload.get("warnings"), + active=payload.get("active"), + name=payload.get("name"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + generate_plain_content=payload.get("generate_plain_content"), + subject=payload.get("subject"), + editor=payload.get("editor"), + test_data=payload.get("test_data"), + id=payload.get("id"), + template_id=payload.get("template_id"), + updated_at=payload.get("updated_at"), + thumbnail_url=payload.get("thumbnail_url"), + ) diff --git a/sendgrid/rest/api/templates/v3/models/transactional_template_warning.py b/sendgrid/rest/api/templates/v3/models/transactional_template_warning.py new file mode 100644 index 00000000..9f04d4d6 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/transactional_template_warning.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class TransactionalTemplateWarning: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return TransactionalTemplateWarning(message=payload.get("message")) diff --git a/sendgrid/rest/api/templates/v3/models/transactional_templates_template_lean.py b/sendgrid/rest/api/templates/v3/models/transactional_templates_template_lean.py new file mode 100644 index 00000000..a25aa19c --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/transactional_templates_template_lean.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.generation1 import Generation1 +from sendgrid.rest.api.templates.v3.models.transactional_templates_version_output_lean import ( + TransactionalTemplatesVersionOutputLean, +) + + +class TransactionalTemplatesTemplateLean: + def __init__( + self, + id: Optional[str] = None, + name: Optional[str] = None, + generation: Optional[Generation1] = None, + updated_at: Optional[str] = None, + versions: Optional[List[TransactionalTemplatesVersionOutputLean]] = None, + ): + self.id = id + self.name = name + self.generation = generation + self.updated_at = updated_at + self.versions = versions + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "name": self.name, + "generation": self.generation, + "updated_at": self.updated_at, + "versions": self.versions, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return TransactionalTemplatesTemplateLean( + id=payload.get("id"), + name=payload.get("name"), + generation=payload.get("generation"), + updated_at=payload.get("updated_at"), + versions=payload.get("versions"), + ) diff --git a/sendgrid/rest/api/templates/v3/models/transactional_templates_version_output_lean.py b/sendgrid/rest/api/templates/v3/models/transactional_templates_version_output_lean.py new file mode 100644 index 00000000..4472afc4 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/transactional_templates_version_output_lean.py @@ -0,0 +1,71 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.templates.v3.models.active1 import Active1 +from sendgrid.rest.api.templates.v3.models.editor1 import Editor1 + + +class TransactionalTemplatesVersionOutputLean: + def __init__( + self, + id: Optional[str] = None, + template_id: Optional[str] = None, + active: Optional[Active1] = None, + name: Optional[str] = None, + subject: Optional[str] = None, + updated_at: Optional[str] = None, + generate_plain_content: Optional[bool] = None, + html_content: Optional[str] = None, + plain_content: Optional[str] = None, + editor: Optional[Editor1] = None, + thumbnail_url: Optional[str] = None, + ): + self.id = id + self.template_id = template_id + self.active = active + self.name = name + self.subject = subject + self.updated_at = updated_at + self.generate_plain_content = generate_plain_content + self.html_content = html_content + self.plain_content = plain_content + self.editor = editor + self.thumbnail_url = thumbnail_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "template_id": self.template_id, + "active": self.active, + "name": self.name, + "subject": self.subject, + "updated_at": self.updated_at, + "generate_plain_content": self.generate_plain_content, + "html_content": self.html_content, + "plain_content": self.plain_content, + "editor": self.editor, + "thumbnail_url": self.thumbnail_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return TransactionalTemplatesVersionOutputLean( + id=payload.get("id"), + template_id=payload.get("template_id"), + active=payload.get("active"), + name=payload.get("name"), + subject=payload.get("subject"), + updated_at=payload.get("updated_at"), + generate_plain_content=payload.get("generate_plain_content"), + html_content=payload.get("html_content"), + plain_content=payload.get("plain_content"), + editor=payload.get("editor"), + thumbnail_url=payload.get("thumbnail_url"), + ) diff --git a/sendgrid/rest/api/templates/v3/models/update_template_request.py b/sendgrid/rest/api/templates/v3/models/update_template_request.py new file mode 100644 index 00000000..d329a716 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/models/update_template_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateTemplateRequest: + def __init__(self, name: Optional[str] = None): + self.name = name + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"name": self.name}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateTemplateRequest(name=payload.get("name")) diff --git a/sendgrid/rest/api/templates/v3/update_template.py b/sendgrid/rest/api/templates/v3/update_template.py new file mode 100644 index 00000000..4ee9f8f9 --- /dev/null +++ b/sendgrid/rest/api/templates/v3/update_template.py @@ -0,0 +1,69 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.templates.v3.models.update_template_request import ( + UpdateTemplateRequest, +) + + +class UpdateTemplate: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + on_behalf_of: Optional[str] = None, + update_template_request: Optional[UpdateTemplateRequest] = None, + ): + path = "/v3/templates/{template_id}" + path = path.format( + template_id=template_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_template_request: + data = update_template_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/templates/v3/update_template_version.py b/sendgrid/rest/api/templates/v3/update_template_version.py new file mode 100644 index 00000000..529b00fc --- /dev/null +++ b/sendgrid/rest/api/templates/v3/update_template_version.py @@ -0,0 +1,73 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Templates API + The Twilio SendGrid Templates API allows you to create and manage email templates to be delivered with SendGrid's sending APIs. The templates you create will be available using a template ID that is passed to our sending APIs as part of the request. Each template may then have multiple versions associated with it. Whichever version is set as \"active\" at the time of the request will be sent to your recipients. This system allows you to update a single template's look and feel entirely without modifying your requests to our Mail Send API. For example, you could have a single template for welcome emails. That welcome template could then have a version for each season of the year that's themed appropriately and marked as active during the appropriate season. The template ID passed to our sending APIs never needs to change; you can just modify which version is active. This API provides operations to create and manage your templates as well as their versions. Each user can create up to 300 different templates. Templates are specific to accounts and Subusers. Templates created on a parent account will not be accessible from the Subusers' accounts. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.templates.v3.models.transactional_template_version_create import ( + TransactionalTemplateVersionCreate, +) + + +class UpdateTemplateVersion: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + template_id: str, + version_id: str, + on_behalf_of: Optional[str] = None, + transactional_template_version_create: Optional[ + TransactionalTemplateVersionCreate + ] = None, + ): + path = "/v3/templates/{template_id}/versions/{version_id}" + path = path.format( + template_id=template_id, + version_id=version_id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if transactional_template_version_create: + data = transactional_template_version_create.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/__init__.py b/sendgrid/rest/api/tracking_settings/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/tracking_settings/v3/list_click_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/list_click_tracking_setting.py new file mode 100644 index 00000000..895974be --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/list_click_tracking_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListClickTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/tracking_settings/click" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/list_google_analytics_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/list_google_analytics_tracking_setting.py new file mode 100644 index 00000000..39bd35a9 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/list_google_analytics_tracking_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListGoogleAnalyticsTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/tracking_settings/google_analytics" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/list_open_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/list_open_tracking_setting.py new file mode 100644 index 00000000..7904c1c2 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/list_open_tracking_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListOpenTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/tracking_settings/open" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/list_subscription_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/list_subscription_tracking_setting.py new file mode 100644 index 00000000..c486d329 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/list_subscription_tracking_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListSubscriptionTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/tracking_settings/subscription" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/list_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/list_tracking_setting.py new file mode 100644 index 00000000..610af68c --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/list_tracking_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/tracking_settings" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/__init__.py b/sendgrid/rest/api/tracking_settings/v3/models/__init__.py new file mode 100644 index 00000000..37df41a9 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/__init__.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.tracking_settings.v3.models.click_tracking import ClickTracking +from sendgrid.rest.api.tracking_settings.v3.models.google_analytics_settings import ( + GoogleAnalyticsSettings, +) +from sendgrid.rest.api.tracking_settings.v3.models.list_open_tracking_setting200_response import ( + ListOpenTrackingSetting200Response, +) +from sendgrid.rest.api.tracking_settings.v3.models.list_tracking_setting200_response import ( + ListTrackingSetting200Response, +) +from sendgrid.rest.api.tracking_settings.v3.models.list_tracking_setting200_response_result_inner import ( + ListTrackingSetting200ResponseResultInner, +) +from sendgrid.rest.api.tracking_settings.v3.models.subscription_tracking_settings import ( + SubscriptionTrackingSettings, +) +from sendgrid.rest.api.tracking_settings.v3.models.update_click_tracking_setting_request import ( + UpdateClickTrackingSettingRequest, +) +from sendgrid.rest.api.tracking_settings.v3.models.update_open_tracking_setting_request import ( + UpdateOpenTrackingSettingRequest, +) + +__all__ = [ + "ClickTracking", + "GoogleAnalyticsSettings", + "ListOpenTrackingSetting200Response", + "ListTrackingSetting200Response", + "ListTrackingSetting200ResponseResultInner", + "SubscriptionTrackingSettings", + "UpdateClickTrackingSettingRequest", + "UpdateOpenTrackingSettingRequest", +] +# Testing code diff --git a/sendgrid/rest/api/tracking_settings/v3/models/click_tracking.py b/sendgrid/rest/api/tracking_settings/v3/models/click_tracking.py new file mode 100644 index 00000000..5f8690e4 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/click_tracking.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ClickTracking: + def __init__( + self, enable_text: Optional[bool] = None, enabled: Optional[bool] = None + ): + self.enable_text = enable_text + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enable_text": self.enable_text, + "enabled": self.enabled, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ClickTracking( + enable_text=payload.get("enable_text"), enabled=payload.get("enabled") + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/google_analytics_settings.py b/sendgrid/rest/api/tracking_settings/v3/models/google_analytics_settings.py new file mode 100644 index 00000000..a181d610 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/google_analytics_settings.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GoogleAnalyticsSettings: + def __init__( + self, + enabled: Optional[bool] = None, + utm_campaign: Optional[str] = None, + utm_content: Optional[str] = None, + utm_medium: Optional[str] = None, + utm_source: Optional[str] = None, + utm_term: Optional[str] = None, + ): + self.enabled = enabled + self.utm_campaign = utm_campaign + self.utm_content = utm_content + self.utm_medium = utm_medium + self.utm_source = utm_source + self.utm_term = utm_term + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "utm_campaign": self.utm_campaign, + "utm_content": self.utm_content, + "utm_medium": self.utm_medium, + "utm_source": self.utm_source, + "utm_term": self.utm_term, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GoogleAnalyticsSettings( + enabled=payload.get("enabled"), + utm_campaign=payload.get("utm_campaign"), + utm_content=payload.get("utm_content"), + utm_medium=payload.get("utm_medium"), + utm_source=payload.get("utm_source"), + utm_term=payload.get("utm_term"), + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/list_open_tracking_setting200_response.py b/sendgrid/rest/api/tracking_settings/v3/models/list_open_tracking_setting200_response.py new file mode 100644 index 00000000..469cf1df --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/list_open_tracking_setting200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListOpenTrackingSetting200Response: + def __init__(self, enabled: Optional[bool] = None): + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enabled": self.enabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListOpenTrackingSetting200Response(enabled=payload.get("enabled")) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response.py b/sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response.py new file mode 100644 index 00000000..c3e76780 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.tracking_settings.v3.models.list_tracking_setting200_response_result_inner import ( + ListTrackingSetting200ResponseResultInner, +) + + +class ListTrackingSetting200Response: + def __init__( + self, result: Optional[List[ListTrackingSetting200ResponseResultInner]] = None + ): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTrackingSetting200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response_result_inner.py b/sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response_result_inner.py new file mode 100644 index 00000000..a8d6d629 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/list_tracking_setting200_response_result_inner.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListTrackingSetting200ResponseResultInner: + def __init__( + self, + name: Optional[str] = None, + title: Optional[str] = None, + description: Optional[str] = None, + enabled: Optional[bool] = None, + ): + self.name = name + self.title = title + self.description = description + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "name": self.name, + "title": self.title, + "description": self.description, + "enabled": self.enabled, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListTrackingSetting200ResponseResultInner( + name=payload.get("name"), + title=payload.get("title"), + description=payload.get("description"), + enabled=payload.get("enabled"), + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/subscription_tracking_settings.py b/sendgrid/rest/api/tracking_settings/v3/models/subscription_tracking_settings.py new file mode 100644 index 00000000..a36e575c --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/subscription_tracking_settings.py @@ -0,0 +1,49 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class SubscriptionTrackingSettings: + def __init__( + self, + enabled: Optional[bool] = None, + html_content: Optional[str] = None, + landing: Optional[str] = None, + plain_content: Optional[str] = None, + replace: Optional[str] = None, + url: Optional[str] = None, + ): + self.enabled = enabled + self.html_content = html_content + self.landing = landing + self.plain_content = plain_content + self.replace = replace + self.url = url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "html_content": self.html_content, + "landing": self.landing, + "plain_content": self.plain_content, + "replace": self.replace, + "url": self.url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return SubscriptionTrackingSettings( + enabled=payload.get("enabled"), + html_content=payload.get("html_content"), + landing=payload.get("landing"), + plain_content=payload.get("plain_content"), + replace=payload.get("replace"), + url=payload.get("url"), + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/update_click_tracking_setting_request.py b/sendgrid/rest/api/tracking_settings/v3/models/update_click_tracking_setting_request.py new file mode 100644 index 00000000..98c0beb6 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/update_click_tracking_setting_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateClickTrackingSettingRequest: + def __init__(self, enabled: Optional[bool] = None): + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enabled": self.enabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateClickTrackingSettingRequest(enabled=payload.get("enabled")) diff --git a/sendgrid/rest/api/tracking_settings/v3/models/update_open_tracking_setting_request.py b/sendgrid/rest/api/tracking_settings/v3/models/update_open_tracking_setting_request.py new file mode 100644 index 00000000..4ec8af7f --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/models/update_open_tracking_setting_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateOpenTrackingSettingRequest: + def __init__(self, enabled: Optional[bool] = None): + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enabled": self.enabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateOpenTrackingSettingRequest(enabled=payload.get("enabled")) diff --git a/sendgrid/rest/api/tracking_settings/v3/update_click_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/update_click_tracking_setting.py new file mode 100644 index 00000000..26ed03cf --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/update_click_tracking_setting.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.tracking_settings.v3.models.update_click_tracking_setting_request import ( + UpdateClickTrackingSettingRequest, +) + + +class UpdateClickTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_click_tracking_setting_request: Optional[ + UpdateClickTrackingSettingRequest + ] = None, + ): + path = "/v3/tracking_settings/click" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_click_tracking_setting_request: + data = update_click_tracking_setting_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/update_google_analytics_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/update_google_analytics_tracking_setting.py new file mode 100644 index 00000000..5e388c43 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/update_google_analytics_tracking_setting.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.tracking_settings.v3.models.google_analytics_settings import ( + GoogleAnalyticsSettings, +) + + +class UpdateGoogleAnalyticsTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + google_analytics_settings: Optional[GoogleAnalyticsSettings] = None, + ): + path = "/v3/tracking_settings/google_analytics" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if google_analytics_settings: + data = google_analytics_settings.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/update_open_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/update_open_tracking_setting.py new file mode 100644 index 00000000..e6368758 --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/update_open_tracking_setting.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.tracking_settings.v3.models.update_open_tracking_setting_request import ( + UpdateOpenTrackingSettingRequest, +) + + +class UpdateOpenTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_open_tracking_setting_request: Optional[ + UpdateOpenTrackingSettingRequest + ] = None, + ): + path = "/v3/tracking_settings/open" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_open_tracking_setting_request: + data = update_open_tracking_setting_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/tracking_settings/v3/update_subscription_tracking_setting.py b/sendgrid/rest/api/tracking_settings/v3/update_subscription_tracking_setting.py new file mode 100644 index 00000000..03cbd72c --- /dev/null +++ b/sendgrid/rest/api/tracking_settings/v3/update_subscription_tracking_setting.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Tracking Settings API + The Twilio SendGrid Tracking Settings API allows you to configure which tracking settings are enabled for your messages. You can track many of your recipients' interactions with your emails, including which emails they open, which links they click, and when they subscribe to or unsubscribe from your emails. See [**Tracking Settings**](https://docs.sendgrid.com/ui/account-and-settings/tracking) for more information. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.tracking_settings.v3.models.subscription_tracking_settings import ( + SubscriptionTrackingSettings, +) + + +class UpdateSubscriptionTrackingSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + subscription_tracking_settings: Optional[SubscriptionTrackingSettings] = None, + ): + path = "/v3/tracking_settings/subscription" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if subscription_tracking_settings: + data = subscription_tracking_settings.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/__init__.py b/sendgrid/rest/api/user/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/user/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/user/v3/list_account.py b/sendgrid/rest/api/user/v3/list_account.py new file mode 100644 index 00000000..e20632f0 --- /dev/null +++ b/sendgrid/rest/api/user/v3/list_account.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListAccount: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/account" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/list_credit.py b/sendgrid/rest/api/user/v3/list_credit.py new file mode 100644 index 00000000..681036ca --- /dev/null +++ b/sendgrid/rest/api/user/v3/list_credit.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListCredit: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/credits" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/list_email.py b/sendgrid/rest/api/user/v3/list_email.py new file mode 100644 index 00000000..83789020 --- /dev/null +++ b/sendgrid/rest/api/user/v3/list_email.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/email" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/list_profile.py b/sendgrid/rest/api/user/v3/list_profile.py new file mode 100644 index 00000000..3aa6d92d --- /dev/null +++ b/sendgrid/rest/api/user/v3/list_profile.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListProfile: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/profile" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/list_username.py b/sendgrid/rest/api/user/v3/list_username.py new file mode 100644 index 00000000..68d9db83 --- /dev/null +++ b/sendgrid/rest/api/user/v3/list_username.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListUsername: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/username" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/models/__init__.py b/sendgrid/rest/api/user/v3/models/__init__.py new file mode 100644 index 00000000..5675a1cf --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/__init__.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.user.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.user.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.user.v3.models.get_user_account_response import ( + GETUserAccountResponse, +) +from sendgrid.rest.api.user.v3.models.get_user_profile_response import ( + GETUserProfileResponse, +) +from sendgrid.rest.api.user.v3.models.list_credit200_response import ( + ListCredit200Response, +) +from sendgrid.rest.api.user.v3.models.list_email200_response import ListEmail200Response +from sendgrid.rest.api.user.v3.models.list_username200_response import ( + ListUsername200Response, +) +from sendgrid.rest.api.user.v3.models.type import Type +from sendgrid.rest.api.user.v3.models.update_email200_response import ( + UpdateEmail200Response, +) +from sendgrid.rest.api.user.v3.models.update_email_request import UpdateEmailRequest +from sendgrid.rest.api.user.v3.models.update_password_request import ( + UpdatePasswordRequest, +) +from sendgrid.rest.api.user.v3.models.update_username200_response import ( + UpdateUsername200Response, +) +from sendgrid.rest.api.user.v3.models.update_username_request import ( + UpdateUsernameRequest, +) +from sendgrid.rest.api.user.v3.models.user_profile import UserProfile + +__all__ = [ + "ErrorResponse", + "ErrorResponseErrorsInner", + "GETUserAccountResponse", + "GETUserProfileResponse", + "ListCredit200Response", + "ListEmail200Response", + "ListUsername200Response", + "Type", + "UpdateEmail200Response", + "UpdateEmailRequest", + "UpdatePasswordRequest", + "UpdateUsername200Response", + "UpdateUsernameRequest", + "UserProfile", +] +# Testing code diff --git a/sendgrid/rest/api/user/v3/models/error_response.py b/sendgrid/rest/api/user/v3/models/error_response.py new file mode 100644 index 00000000..ca0448da --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.user.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/user/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/user/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/user/v3/models/get_user_account_response.py b/sendgrid/rest/api/user/v3/models/get_user_account_response.py new file mode 100644 index 00000000..91a7dee3 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/get_user_account_response.py @@ -0,0 +1,26 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.user.v3.models.type import Type + + +class GETUserAccountResponse: + def __init__(self, type: Optional[Type] = None, reputation: Optional[float] = None): + self.type = type + self.reputation = reputation + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"type": self.type, "reputation": self.reputation}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GETUserAccountResponse( + type=payload.get("type"), reputation=payload.get("reputation") + ) diff --git a/sendgrid/rest/api/user/v3/models/get_user_profile_response.py b/sendgrid/rest/api/user/v3/models/get_user_profile_response.py new file mode 100644 index 00000000..ebd95ed7 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/get_user_profile_response.py @@ -0,0 +1,69 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GETUserProfileResponse: + def __init__( + self, + address: Optional[str] = None, + address2: Optional[str] = None, + city: Optional[str] = None, + company: Optional[str] = None, + country: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + phone: Optional[str] = None, + state: Optional[str] = None, + website: Optional[str] = None, + zip: Optional[str] = None, + ): + self.address = address + self.address2 = address2 + self.city = city + self.company = company + self.country = country + self.first_name = first_name + self.last_name = last_name + self.phone = phone + self.state = state + self.website = website + self.zip = zip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "address": self.address, + "address2": self.address2, + "city": self.city, + "company": self.company, + "country": self.country, + "first_name": self.first_name, + "last_name": self.last_name, + "phone": self.phone, + "state": self.state, + "website": self.website, + "zip": self.zip, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GETUserProfileResponse( + address=payload.get("address"), + address2=payload.get("address2"), + city=payload.get("city"), + company=payload.get("company"), + country=payload.get("country"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + phone=payload.get("phone"), + state=payload.get("state"), + website=payload.get("website"), + zip=payload.get("zip"), + ) diff --git a/sendgrid/rest/api/user/v3/models/list_credit200_response.py b/sendgrid/rest/api/user/v3/models/list_credit200_response.py new file mode 100644 index 00000000..447fcb90 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/list_credit200_response.py @@ -0,0 +1,53 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListCredit200Response: + def __init__( + self, + remain: Optional[int] = None, + total: Optional[int] = None, + overage: Optional[int] = None, + used: Optional[int] = None, + last_reset: Optional[str] = None, + next_reset: Optional[str] = None, + reset_frequency: Optional[str] = None, + ): + self.remain = remain + self.total = total + self.overage = overage + self.used = used + self.last_reset = last_reset + self.next_reset = next_reset + self.reset_frequency = reset_frequency + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "remain": self.remain, + "total": self.total, + "overage": self.overage, + "used": self.used, + "last_reset": self.last_reset, + "next_reset": self.next_reset, + "reset_frequency": self.reset_frequency, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListCredit200Response( + remain=payload.get("remain"), + total=payload.get("total"), + overage=payload.get("overage"), + used=payload.get("used"), + last_reset=payload.get("last_reset"), + next_reset=payload.get("next_reset"), + reset_frequency=payload.get("reset_frequency"), + ) diff --git a/sendgrid/rest/api/user/v3/models/list_email200_response.py b/sendgrid/rest/api/user/v3/models/list_email200_response.py new file mode 100644 index 00000000..35008600 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/list_email200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListEmail200Response: + def __init__(self, email: Optional[str] = None): + self.email = email + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListEmail200Response(email=payload.get("email")) diff --git a/sendgrid/rest/api/user/v3/models/list_username200_response.py b/sendgrid/rest/api/user/v3/models/list_username200_response.py new file mode 100644 index 00000000..ab5719c8 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/list_username200_response.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListUsername200Response: + def __init__(self, username: Optional[str] = None, user_id: Optional[int] = None): + self.username = username + self.user_id = user_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "username": self.username, + "user_id": self.user_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListUsername200Response( + username=payload.get("username"), user_id=payload.get("user_id") + ) diff --git a/sendgrid/rest/api/user/v3/models/type.py b/sendgrid/rest/api/user/v3/models/type.py new file mode 100644 index 00000000..a0731f2d --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/type.py @@ -0,0 +1,7 @@ +from enum import Enum +from enum import Enum + + +class Type(Enum): + FREE = "free" + PAID = "paid" diff --git a/sendgrid/rest/api/user/v3/models/update_email200_response.py b/sendgrid/rest/api/user/v3/models/update_email200_response.py new file mode 100644 index 00000000..f51a20ef --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/update_email200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateEmail200Response: + def __init__(self, email: Optional[str] = None): + self.email = email + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateEmail200Response(email=payload.get("email")) diff --git a/sendgrid/rest/api/user/v3/models/update_email_request.py b/sendgrid/rest/api/user/v3/models/update_email_request.py new file mode 100644 index 00000000..9e5b7ca1 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/update_email_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateEmailRequest: + def __init__(self, email: Optional[str] = None): + self.email = email + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"email": self.email}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateEmailRequest(email=payload.get("email")) diff --git a/sendgrid/rest/api/user/v3/models/update_password_request.py b/sendgrid/rest/api/user/v3/models/update_password_request.py new file mode 100644 index 00000000..98b0e656 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/update_password_request.py @@ -0,0 +1,31 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdatePasswordRequest: + def __init__( + self, new_password: Optional[str] = None, old_password: Optional[str] = None + ): + self.new_password = new_password + self.old_password = old_password + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "new_password": self.new_password, + "old_password": self.old_password, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdatePasswordRequest( + new_password=payload.get("new_password"), + old_password=payload.get("old_password"), + ) diff --git a/sendgrid/rest/api/user/v3/models/update_username200_response.py b/sendgrid/rest/api/user/v3/models/update_username200_response.py new file mode 100644 index 00000000..c33479c7 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/update_username200_response.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateUsername200Response: + def __init__(self, username: Optional[str] = None): + self.username = username + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"username": self.username}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateUsername200Response(username=payload.get("username")) diff --git a/sendgrid/rest/api/user/v3/models/update_username_request.py b/sendgrid/rest/api/user/v3/models/update_username_request.py new file mode 100644 index 00000000..fd780920 --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/update_username_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateUsernameRequest: + def __init__(self, username: Optional[str] = None): + self.username = username + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"username": self.username}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateUsernameRequest(username=payload.get("username")) diff --git a/sendgrid/rest/api/user/v3/models/user_profile.py b/sendgrid/rest/api/user/v3/models/user_profile.py new file mode 100644 index 00000000..487c550c --- /dev/null +++ b/sendgrid/rest/api/user/v3/models/user_profile.py @@ -0,0 +1,69 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UserProfile: + def __init__( + self, + address: Optional[str] = None, + address2: Optional[str] = None, + city: Optional[str] = None, + company: Optional[str] = None, + country: Optional[str] = None, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + phone: Optional[str] = None, + state: Optional[str] = None, + website: Optional[str] = None, + zip: Optional[str] = None, + ): + self.address = address + self.address2 = address2 + self.city = city + self.company = company + self.country = country + self.first_name = first_name + self.last_name = last_name + self.phone = phone + self.state = state + self.website = website + self.zip = zip + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "address": self.address, + "address2": self.address2, + "city": self.city, + "company": self.company, + "country": self.country, + "first_name": self.first_name, + "last_name": self.last_name, + "phone": self.phone, + "state": self.state, + "website": self.website, + "zip": self.zip, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UserProfile( + address=payload.get("address"), + address2=payload.get("address2"), + city=payload.get("city"), + company=payload.get("company"), + country=payload.get("country"), + first_name=payload.get("first_name"), + last_name=payload.get("last_name"), + phone=payload.get("phone"), + state=payload.get("state"), + website=payload.get("website"), + zip=payload.get("zip"), + ) diff --git a/sendgrid/rest/api/user/v3/update_email.py b/sendgrid/rest/api/user/v3/update_email.py new file mode 100644 index 00000000..30fff87f --- /dev/null +++ b/sendgrid/rest/api/user/v3/update_email.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.user.v3.models.update_email_request import UpdateEmailRequest + + +class UpdateEmail: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_email_request: Optional[UpdateEmailRequest] = None, + ): + path = "/v3/user/email" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_email_request: + data = update_email_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/update_password.py b/sendgrid/rest/api/user/v3/update_password.py new file mode 100644 index 00000000..0fa46bb8 --- /dev/null +++ b/sendgrid/rest/api/user/v3/update_password.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.user.v3.models.update_password_request import ( + UpdatePasswordRequest, +) + + +class UpdatePassword: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_password_request: Optional[UpdatePasswordRequest] = None, + ): + path = "/v3/user/password" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_password_request: + data = update_password_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/update_profile.py b/sendgrid/rest/api/user/v3/update_profile.py new file mode 100644 index 00000000..61b97846 --- /dev/null +++ b/sendgrid/rest/api/user/v3/update_profile.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.user.v3.models.user_profile import UserProfile + + +class UpdateProfile: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + user_profile: Optional[UserProfile] = None, + ): + path = "/v3/user/profile" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if user_profile: + data = user_profile.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/user/v3/update_username.py b/sendgrid/rest/api/user/v3/update_username.py new file mode 100644 index 00000000..4c7d589d --- /dev/null +++ b/sendgrid/rest/api/user/v3/update_username.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid User API + The Twilio SendGrid User API allows you to modify the settings of a SendGrid user account such as the user's email address or username. Keeping your user profile up to date helps SendGrid verify who you are and share important communications with you. See [**Account Details**](https://docs.sendgrid.com/ui/account-and-settings/account) for more information. You can also manage your user settings in the [SendGrid application user interface](https://app.sendgrid.com/account/details). + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.user.v3.models.update_username_request import ( + UpdateUsernameRequest, +) + + +class UpdateUsername: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + update_username_request: Optional[UpdateUsernameRequest] = None, + ): + path = "/v3/user/username" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_username_request: + data = update_username_request.to_dict() + request = Request(method="PUT", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/__init__.py b/sendgrid/rest/api/verified_senders/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/verified_senders/v3/create_verified_sender.py b/sendgrid/rest/api/verified_senders/v3/create_verified_sender.py new file mode 100644 index 00000000..bb518ca4 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/create_verified_sender.py @@ -0,0 +1,57 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.verified_senders.v3.models.verified_sender_request import ( + VerifiedSenderRequest, +) + + +class CreateVerifiedSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + verified_sender_request: Optional[VerifiedSenderRequest] = None, + ): + path = "/v3/verified_senders" + + data = None + if verified_sender_request: + data = verified_sender_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/delete_verified_sender.py b/sendgrid/rest/api/verified_senders/v3/delete_verified_sender.py new file mode 100644 index 00000000..0a63655a --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/delete_verified_sender.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class DeleteVerifiedSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/verified_senders/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/list_verified_sender.py b/sendgrid/rest/api/verified_senders/v3/list_verified_sender.py new file mode 100644 index 00000000..2d794395 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/list_verified_sender.py @@ -0,0 +1,54 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListVerifiedSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + limit: Optional[float] = None, + last_seen_id: Optional[float] = None, + id: Optional[int] = None, + ): + path = "/v3/verified_senders" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/list_verified_sender_domain.py b/sendgrid/rest/api/verified_senders/v3/list_verified_sender_domain.py new file mode 100644 index 00000000..55436ee4 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/list_verified_sender_domain.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListVerifiedSenderDomain: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/verified_senders/domains" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/list_verified_sender_steps_completed.py b/sendgrid/rest/api/verified_senders/v3/list_verified_sender_steps_completed.py new file mode 100644 index 00000000..80fcfcb5 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/list_verified_sender_steps_completed.py @@ -0,0 +1,48 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ListVerifiedSenderStepsCompleted: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + ): + path = "/v3/verified_senders/steps_completed" + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/__init__.py b/sendgrid/rest/api/verified_senders/v3/models/__init__.py new file mode 100644 index 00000000..a6c5265a --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/__init__.py @@ -0,0 +1,72 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.verified_senders.v3.models.create_verified_sender400_response import ( + CreateVerifiedSender400Response, +) +from sendgrid.rest.api.verified_senders.v3.models.create_verified_sender400_response_errors_inner import ( + CreateVerifiedSender400ResponseErrorsInner, +) +from sendgrid.rest.api.verified_senders.v3.models.delete_verified_sender403_response import ( + DeleteVerifiedSender403Response, +) +from sendgrid.rest.api.verified_senders.v3.models.delete_verified_sender403_response_errors_inner import ( + DeleteVerifiedSender403ResponseErrorsInner, +) +from sendgrid.rest.api.verified_senders.v3.models.delete_verified_sender404_response import ( + DeleteVerifiedSender404Response, +) +from sendgrid.rest.api.verified_senders.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.verified_senders.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender200_response import ( + ListVerifiedSender200Response, +) +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender_domain200_response import ( + ListVerifiedSenderDomain200Response, +) +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender_domain200_response_results import ( + ListVerifiedSenderDomain200ResponseResults, +) +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender_steps_completed200_response import ( + ListVerifiedSenderStepsCompleted200Response, +) +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender_steps_completed200_response_results import ( + ListVerifiedSenderStepsCompleted200ResponseResults, +) +from sendgrid.rest.api.verified_senders.v3.models.verified_sender_request import ( + VerifiedSenderRequest, +) +from sendgrid.rest.api.verified_senders.v3.models.verified_sender_response import ( + VerifiedSenderResponse, +) + +__all__ = [ + "CreateVerifiedSender400Response", + "CreateVerifiedSender400ResponseErrorsInner", + "DeleteVerifiedSender403Response", + "DeleteVerifiedSender403ResponseErrorsInner", + "DeleteVerifiedSender404Response", + "ErrorResponse", + "ErrorResponseErrorsInner", + "ListVerifiedSender200Response", + "ListVerifiedSenderDomain200Response", + "ListVerifiedSenderDomain200ResponseResults", + "ListVerifiedSenderStepsCompleted200Response", + "ListVerifiedSenderStepsCompleted200ResponseResults", + "VerifiedSenderRequest", + "VerifiedSenderResponse", +] +# Testing code diff --git a/sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response.py b/sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response.py new file mode 100644 index 00000000..f8a977c1 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.create_verified_sender400_response_errors_inner import ( + CreateVerifiedSender400ResponseErrorsInner, +) + + +class CreateVerifiedSender400Response: + def __init__( + self, errors: Optional[List[CreateVerifiedSender400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateVerifiedSender400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response_errors_inner.py b/sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response_errors_inner.py new file mode 100644 index 00000000..6b8c57b5 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/create_verified_sender400_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateVerifiedSender400ResponseErrorsInner: + def __init__( + self, + field: Optional[str] = None, + message: Optional[str] = None, + error_id: Optional[str] = None, + ): + self.field = field + self.message = message + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "field": self.field, + "message": self.message, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateVerifiedSender400ResponseErrorsInner( + field=payload.get("field"), + message=payload.get("message"), + error_id=payload.get("error_id"), + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response.py b/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response.py new file mode 100644 index 00000000..154740ab --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.delete_verified_sender403_response_errors_inner import ( + DeleteVerifiedSender403ResponseErrorsInner, +) + + +class DeleteVerifiedSender403Response: + def __init__( + self, errors: Optional[List[DeleteVerifiedSender403ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteVerifiedSender403Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response_errors_inner.py b/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response_errors_inner.py new file mode 100644 index 00000000..08ee53c2 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender403_response_errors_inner.py @@ -0,0 +1,28 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class DeleteVerifiedSender403ResponseErrorsInner: + def __init__(self, message: Optional[str] = None, error_id: Optional[str] = None): + self.message = message + self.error_id = error_id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "error_id": self.error_id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteVerifiedSender403ResponseErrorsInner( + message=payload.get("message"), error_id=payload.get("error_id") + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender404_response.py b/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender404_response.py new file mode 100644 index 00000000..9e917466 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/delete_verified_sender404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.delete_verified_sender403_response_errors_inner import ( + DeleteVerifiedSender403ResponseErrorsInner, +) + + +class DeleteVerifiedSender404Response: + def __init__( + self, errors: Optional[List[DeleteVerifiedSender403ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return DeleteVerifiedSender404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/verified_senders/v3/models/error_response.py b/sendgrid/rest/api/verified_senders/v3/models/error_response.py new file mode 100644 index 00000000..56434e65 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/verified_senders/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/verified_senders/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender200_response.py b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender200_response.py new file mode 100644 index 00000000..e369690b --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender200_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.verified_sender_response import ( + VerifiedSenderResponse, +) + + +class ListVerifiedSender200Response: + def __init__(self, results: Optional[List[VerifiedSenderResponse]] = None): + self.results = results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"results": self.results}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListVerifiedSender200Response(results=payload.get("results")) diff --git a/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response.py b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response.py new file mode 100644 index 00000000..ffea4bf1 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender_domain200_response_results import ( + ListVerifiedSenderDomain200ResponseResults, +) + + +class ListVerifiedSenderDomain200Response: + def __init__( + self, results: Optional[ListVerifiedSenderDomain200ResponseResults] = None + ): + self.results = results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"results": self.results}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListVerifiedSenderDomain200Response(results=payload.get("results")) diff --git a/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response_results.py b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response_results.py new file mode 100644 index 00000000..cfdf2fe1 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_domain200_response_results.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListVerifiedSenderDomain200ResponseResults: + def __init__( + self, + soft_failures: Optional[List[str]] = None, + hard_failures: Optional[List[str]] = None, + ): + self.soft_failures = soft_failures + self.hard_failures = hard_failures + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "soft_failures": self.soft_failures, + "hard_failures": self.hard_failures, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListVerifiedSenderDomain200ResponseResults( + soft_failures=payload.get("soft_failures"), + hard_failures=payload.get("hard_failures"), + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response.py b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response.py new file mode 100644 index 00000000..4f5370dd --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.verified_senders.v3.models.list_verified_sender_steps_completed200_response_results import ( + ListVerifiedSenderStepsCompleted200ResponseResults, +) + + +class ListVerifiedSenderStepsCompleted200Response: + def __init__( + self, + results: Optional[ListVerifiedSenderStepsCompleted200ResponseResults] = None, + ): + self.results = results + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"results": self.results}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListVerifiedSenderStepsCompleted200Response( + results=payload.get("results") + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response_results.py b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response_results.py new file mode 100644 index 00000000..8a00b969 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/list_verified_sender_steps_completed200_response_results.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListVerifiedSenderStepsCompleted200ResponseResults: + def __init__( + self, + sender_verified: Optional[bool] = None, + domain_verified: Optional[bool] = None, + ): + self.sender_verified = sender_verified + self.domain_verified = domain_verified + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "sender_verified": self.sender_verified, + "domain_verified": self.domain_verified, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListVerifiedSenderStepsCompleted200ResponseResults( + sender_verified=payload.get("sender_verified"), + domain_verified=payload.get("domain_verified"), + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/verified_sender_request.py b/sendgrid/rest/api/verified_senders/v3/models/verified_sender_request.py new file mode 100644 index 00000000..5244308a --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/verified_sender_request.py @@ -0,0 +1,69 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class VerifiedSenderRequest: + def __init__( + self, + nickname: Optional[str] = None, + from_email: Optional[str] = None, + from_name: Optional[str] = None, + reply_to: Optional[str] = None, + reply_to_name: Optional[str] = None, + address: Optional[str] = None, + address2: Optional[str] = None, + state: Optional[str] = None, + city: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + ): + self.nickname = nickname + self.from_email = from_email + self.from_name = from_name + self.reply_to = reply_to + self.reply_to_name = reply_to_name + self.address = address + self.address2 = address2 + self.state = state + self.city = city + self.zip = zip + self.country = country + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "nickname": self.nickname, + "from_email": self.from_email, + "from_name": self.from_name, + "reply_to": self.reply_to, + "reply_to_name": self.reply_to_name, + "address": self.address, + "address2": self.address2, + "state": self.state, + "city": self.city, + "zip": self.zip, + "country": self.country, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return VerifiedSenderRequest( + nickname=payload.get("nickname"), + from_email=payload.get("from_email"), + from_name=payload.get("from_name"), + reply_to=payload.get("reply_to"), + reply_to_name=payload.get("reply_to_name"), + address=payload.get("address"), + address2=payload.get("address2"), + state=payload.get("state"), + city=payload.get("city"), + zip=payload.get("zip"), + country=payload.get("country"), + ) diff --git a/sendgrid/rest/api/verified_senders/v3/models/verified_sender_response.py b/sendgrid/rest/api/verified_senders/v3/models/verified_sender_response.py new file mode 100644 index 00000000..c6fc8a07 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/models/verified_sender_response.py @@ -0,0 +1,81 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class VerifiedSenderResponse: + def __init__( + self, + id: Optional[int] = None, + nickname: Optional[str] = None, + from_email: Optional[str] = None, + from_name: Optional[str] = None, + reply_to: Optional[str] = None, + reply_to_name: Optional[str] = None, + address: Optional[str] = None, + address2: Optional[str] = None, + state: Optional[str] = None, + city: Optional[str] = None, + zip: Optional[str] = None, + country: Optional[str] = None, + verified: Optional[bool] = None, + locked: Optional[bool] = None, + ): + self.id = id + self.nickname = nickname + self.from_email = from_email + self.from_name = from_name + self.reply_to = reply_to + self.reply_to_name = reply_to_name + self.address = address + self.address2 = address2 + self.state = state + self.city = city + self.zip = zip + self.country = country + self.verified = verified + self.locked = locked + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "nickname": self.nickname, + "from_email": self.from_email, + "from_name": self.from_name, + "reply_to": self.reply_to, + "reply_to_name": self.reply_to_name, + "address": self.address, + "address2": self.address2, + "state": self.state, + "city": self.city, + "zip": self.zip, + "country": self.country, + "verified": self.verified, + "locked": self.locked, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return VerifiedSenderResponse( + id=payload.get("id"), + nickname=payload.get("nickname"), + from_email=payload.get("from_email"), + from_name=payload.get("from_name"), + reply_to=payload.get("reply_to"), + reply_to_name=payload.get("reply_to_name"), + address=payload.get("address"), + address2=payload.get("address2"), + state=payload.get("state"), + city=payload.get("city"), + zip=payload.get("zip"), + country=payload.get("country"), + verified=payload.get("verified"), + locked=payload.get("locked"), + ) diff --git a/sendgrid/rest/api/verified_senders/v3/resend_verified_sender.py b/sendgrid/rest/api/verified_senders/v3/resend_verified_sender.py new file mode 100644 index 00000000..7a24b882 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/resend_verified_sender.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class ResendVerifiedSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + ): + path = "/v3/verified_senders/resend/{id}" + path = path.format( + id=id, + ) + + data = None + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/update_verified_sender.py b/sendgrid/rest/api/verified_senders/v3/update_verified_sender.py new file mode 100644 index 00000000..bea03a41 --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/update_verified_sender.py @@ -0,0 +1,61 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.verified_senders.v3.models.verified_sender_request import ( + VerifiedSenderRequest, +) + + +class UpdateVerifiedSender: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + verified_sender_request: Optional[VerifiedSenderRequest] = None, + ): + path = "/v3/verified_senders/{id}" + path = path.format( + id=id, + ) + + data = None + if verified_sender_request: + data = verified_sender_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/verified_senders/v3/verify_sender_token.py b/sendgrid/rest/api/verified_senders/v3/verify_sender_token.py new file mode 100644 index 00000000..20bac7ce --- /dev/null +++ b/sendgrid/rest/api/verified_senders/v3/verify_sender_token.py @@ -0,0 +1,52 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Verified Senders API + The Twilio SendGrid Verified Senders API allows you to programmatically manage the Sender Identities that are authorized to send email for your account. You can also manage Sender Identities in the [SendGrid application user interface](https://app.sendgrid.com/settings/sender_auth). See [**Single Sender Verification**](https://sendgrid.com/docs/ui/sending-email/sender-verification/) for more information. You an use this API to create new Sender Identities, retrieve a list of existing Sender Identities, check the status of a Sender Identity, update a Sender Identity, and delete a Sender Identity. This API offers additional operations to check for domains known to implement DMARC and resend verification emails to Sender Identities that have yet to complete the verification process. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + + +class VerifySenderToken: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + token: str, + ): + path = "/v3/verified_senders/verify/{token}" + path = path.format( + token=token, + ) + + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/__init__.py b/sendgrid/rest/api/webhooks/v3/__init__.py new file mode 100644 index 00000000..46409041 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/__init__.py @@ -0,0 +1 @@ +# TODO diff --git a/sendgrid/rest/api/webhooks/v3/create_event_webhook.py b/sendgrid/rest/api/webhooks/v3/create_event_webhook.py new file mode 100644 index 00000000..379af7cb --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/create_event_webhook.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.event_webhook_request import ( + EventWebhookRequest, +) + + +class CreateEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + event_webhook_request: Optional[EventWebhookRequest] = None, + ): + path = "/v3/user/webhooks/event/settings" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if event_webhook_request: + data = event_webhook_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/create_parse_setting.py b/sendgrid/rest/api/webhooks/v3/create_parse_setting.py new file mode 100644 index 00000000..329ddd89 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/create_parse_setting.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.parse_setting import ParseSetting + + +class CreateParseSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + parse_setting: Optional[ParseSetting] = None, + ): + path = "/v3/user/webhooks/parse/settings" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if parse_setting: + data = parse_setting.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/delete_event_webhook.py b/sendgrid/rest/api/webhooks/v3/delete_event_webhook.py new file mode 100644 index 00000000..30b046ba --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/delete_event_webhook.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/webhooks/event/settings/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/delete_parse_setting.py b/sendgrid/rest/api/webhooks/v3/delete_parse_setting.py new file mode 100644 index 00000000..cc46aea8 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/delete_parse_setting.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class DeleteParseSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + hostname: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/webhooks/parse/settings/{hostname}" + path = path.format( + hostname=hostname, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="DELETE", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/get_event_webhook.py b/sendgrid/rest/api/webhooks/v3/get_event_webhook.py new file mode 100644 index 00000000..7983dc13 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/get_event_webhook.py @@ -0,0 +1,63 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + include: Optional[str] = None, + ): + path = "/v3/user/webhooks/event/settings/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/get_parse_setting.py b/sendgrid/rest/api/webhooks/v3/get_parse_setting.py new file mode 100644 index 00000000..683a04b3 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/get_parse_setting.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetParseSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + hostname: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/webhooks/parse/settings/{hostname}" + path = path.format( + hostname=hostname, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/get_signed_event_webhook.py b/sendgrid/rest/api/webhooks/v3/get_signed_event_webhook.py new file mode 100644 index 00000000..48b11131 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/get_signed_event_webhook.py @@ -0,0 +1,62 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class GetSignedEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/webhooks/event/settings/signed/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/list_event_webhook.py b/sendgrid/rest/api/webhooks/v3/list_event_webhook.py new file mode 100644 index 00000000..dca9a1ce --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/list_event_webhook.py @@ -0,0 +1,59 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + include: Optional[str] = None, + ): + path = "/v3/user/webhooks/event/settings/all" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/list_parse_setting.py b/sendgrid/rest/api/webhooks/v3/list_parse_setting.py new file mode 100644 index 00000000..d6b94e47 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/list_parse_setting.py @@ -0,0 +1,58 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional + + +class ListParseSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + ): + path = "/v3/user/webhooks/parse/settings" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/list_parse_static.py b/sendgrid/rest/api/webhooks/v3/list_parse_static.py new file mode 100644 index 00000000..b26a2380 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/list_parse_static.py @@ -0,0 +1,64 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.aggregated_by import AggregatedBy + + +class ListParseStatic: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + limit: Optional[str] = None, + offset: Optional[str] = None, + aggregated_by: Optional[AggregatedBy] = None, + start_date: Optional[str] = None, + end_date: Optional[str] = None, + ): + path = "/v3/user/webhooks/parse/stats" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + data = None + request = Request(method="GET", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/__init__.py b/sendgrid/rest/api/webhooks/v3/models/__init__.py new file mode 100644 index 00000000..1202452a --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/__init__.py @@ -0,0 +1,108 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +# import models into model package +from sendgrid.rest.api.webhooks.v3.models.aggregated_by import AggregatedBy +from sendgrid.rest.api.webhooks.v3.models.create_event_webhook400_response import ( + CreateEventWebhook400Response, +) +from sendgrid.rest.api.webhooks.v3.models.create_event_webhook400_response_errors_inner import ( + CreateEventWebhook400ResponseErrorsInner, +) +from sendgrid.rest.api.webhooks.v3.models.error_response import ErrorResponse +from sendgrid.rest.api.webhooks.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_all_response import ( + EventWebhookAllResponse, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_base_response_props import ( + EventWebhookBaseResponseProps, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_date_response_props import ( + EventWebhookDateResponseProps, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_no_dates_response import ( + EventWebhookNoDatesResponse, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_oauth_response_props import ( + EventWebhookOauthResponseProps, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_request import ( + EventWebhookRequest, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_signed_response import ( + EventWebhookSignedResponse, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_signed_response_prop import ( + EventWebhookSignedResponseProp, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_test_request import ( + EventWebhookTestRequest, +) +from sendgrid.rest.api.webhooks.v3.models.event_webhook_unsigned_response import ( + EventWebhookUnsignedResponse, +) +from sendgrid.rest.api.webhooks.v3.models.get_signed_event_webhook200_response import ( + GetSignedEventWebhook200Response, +) +from sendgrid.rest.api.webhooks.v3.models.get_signed_event_webhook404_response import ( + GetSignedEventWebhook404Response, +) +from sendgrid.rest.api.webhooks.v3.models.get_signed_event_webhook404_response_errors_inner import ( + GetSignedEventWebhook404ResponseErrorsInner, +) +from sendgrid.rest.api.webhooks.v3.models.list_parse_setting200_response import ( + ListParseSetting200Response, +) +from sendgrid.rest.api.webhooks.v3.models.list_parse_static200_response_inner import ( + ListParseStatic200ResponseInner, +) +from sendgrid.rest.api.webhooks.v3.models.list_parse_static200_response_inner_stats_inner import ( + ListParseStatic200ResponseInnerStatsInner, +) +from sendgrid.rest.api.webhooks.v3.models.list_parse_static200_response_inner_stats_inner_metrics import ( + ListParseStatic200ResponseInnerStatsInnerMetrics, +) +from sendgrid.rest.api.webhooks.v3.models.parse_setting import ParseSetting +from sendgrid.rest.api.webhooks.v3.models.update_signed_event_webhook_request import ( + UpdateSignedEventWebhookRequest, +) + +__all__ = [ + "AggregatedBy", + "CreateEventWebhook400Response", + "CreateEventWebhook400ResponseErrorsInner", + "ErrorResponse", + "ErrorResponseErrorsInner", + "EventWebhookAllResponse", + "EventWebhookBaseResponseProps", + "EventWebhookDateResponseProps", + "EventWebhookNoDatesResponse", + "EventWebhookOauthResponseProps", + "EventWebhookRequest", + "EventWebhookSignedResponse", + "EventWebhookSignedResponseProp", + "EventWebhookTestRequest", + "EventWebhookUnsignedResponse", + "GetSignedEventWebhook200Response", + "GetSignedEventWebhook404Response", + "GetSignedEventWebhook404ResponseErrorsInner", + "ListParseSetting200Response", + "ListParseStatic200ResponseInner", + "ListParseStatic200ResponseInnerStatsInner", + "ListParseStatic200ResponseInnerStatsInnerMetrics", + "ParseSetting", + "UpdateSignedEventWebhookRequest", +] +# Testing code diff --git a/sendgrid/rest/api/webhooks/v3/models/aggregated_by.py b/sendgrid/rest/api/webhooks/v3/models/aggregated_by.py new file mode 100644 index 00000000..8139656a --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/aggregated_by.py @@ -0,0 +1,8 @@ +from enum import Enum +from enum import Enum + + +class AggregatedBy(Enum): + DAY = "day" + WEEK = "week" + MONTH = "month" diff --git a/sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response.py b/sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response.py new file mode 100644 index 00000000..5ac1ad73 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.create_event_webhook400_response_errors_inner import ( + CreateEventWebhook400ResponseErrorsInner, +) + + +class CreateEventWebhook400Response: + def __init__( + self, errors: Optional[List[CreateEventWebhook400ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateEventWebhook400Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response_errors_inner.py b/sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response_errors_inner.py new file mode 100644 index 00000000..9e262f4a --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/create_event_webhook400_response_errors_inner.py @@ -0,0 +1,35 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class CreateEventWebhook400ResponseErrorsInner: + def __init__( + self, + id: Optional[str] = None, + message: Optional[str] = None, + url: Optional[str] = None, + ): + self.id = id + self.message = message + self.url = url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "message": self.message, + "url": self.url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return CreateEventWebhook400ResponseErrorsInner( + id=payload.get("id"), message=payload.get("message"), url=payload.get("url") + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/error_response.py b/sendgrid/rest/api/webhooks/v3/models/error_response.py new file mode 100644 index 00000000..13daba92 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/error_response.py @@ -0,0 +1,30 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.error_response_errors_inner import ( + ErrorResponseErrorsInner, +) + + +class ErrorResponse: + def __init__( + self, + errors: Optional[List[ErrorResponseErrorsInner]] = None, + id: Optional[str] = None, + ): + self.errors = errors + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors, "id": self.id}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponse(errors=payload.get("errors"), id=payload.get("id")) diff --git a/sendgrid/rest/api/webhooks/v3/models/error_response_errors_inner.py b/sendgrid/rest/api/webhooks/v3/models/error_response_errors_inner.py new file mode 100644 index 00000000..4cbf78ef --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/error_response_errors_inner.py @@ -0,0 +1,37 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ErrorResponseErrorsInner: + def __init__( + self, + message: Optional[str] = None, + field: Optional[str] = None, + help: Optional[object] = None, + ): + self.message = message + self.field = field + self.help = help + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "message": self.message, + "field": self.field, + "help": self.help, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ErrorResponseErrorsInner( + message=payload.get("message"), + field=payload.get("field"), + help=payload.get("help"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_all_response.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_all_response.py new file mode 100644 index 00000000..9ff509af --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_all_response.py @@ -0,0 +1,35 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.event_webhook_signed_response import ( + EventWebhookSignedResponse, +) + + +class EventWebhookAllResponse: + def __init__( + self, + max_allowed: Optional[float] = None, + webhooks: Optional[List[EventWebhookSignedResponse]] = None, + ): + self.max_allowed = max_allowed + self.webhooks = webhooks + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "max_allowed": self.max_allowed, + "webhooks": self.webhooks, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookAllResponse( + max_allowed=payload.get("max_allowed"), webhooks=payload.get("webhooks") + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_base_response_props.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_base_response_props.py new file mode 100644 index 00000000..bb39c23b --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_base_response_props.py @@ -0,0 +1,89 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookBaseResponseProps: + def __init__( + self, + enabled: Optional[bool] = None, + url: Optional[str] = None, + account_status_change: Optional[bool] = None, + group_resubscribe: Optional[bool] = None, + delivered: Optional[bool] = None, + group_unsubscribe: Optional[bool] = None, + spam_report: Optional[bool] = None, + bounce: Optional[bool] = None, + deferred: Optional[bool] = None, + unsubscribe: Optional[bool] = None, + processed: Optional[bool] = None, + open: Optional[bool] = None, + click: Optional[bool] = None, + dropped: Optional[bool] = None, + friendly_name: Optional[str] = None, + id: Optional[str] = None, + ): + self.enabled = enabled + self.url = url + self.account_status_change = account_status_change + self.group_resubscribe = group_resubscribe + self.delivered = delivered + self.group_unsubscribe = group_unsubscribe + self.spam_report = spam_report + self.bounce = bounce + self.deferred = deferred + self.unsubscribe = unsubscribe + self.processed = processed + self.open = open + self.click = click + self.dropped = dropped + self.friendly_name = friendly_name + self.id = id + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "url": self.url, + "account_status_change": self.account_status_change, + "group_resubscribe": self.group_resubscribe, + "delivered": self.delivered, + "group_unsubscribe": self.group_unsubscribe, + "spam_report": self.spam_report, + "bounce": self.bounce, + "deferred": self.deferred, + "unsubscribe": self.unsubscribe, + "processed": self.processed, + "open": self.open, + "click": self.click, + "dropped": self.dropped, + "friendly_name": self.friendly_name, + "id": self.id, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookBaseResponseProps( + enabled=payload.get("enabled"), + url=payload.get("url"), + account_status_change=payload.get("account_status_change"), + group_resubscribe=payload.get("group_resubscribe"), + delivered=payload.get("delivered"), + group_unsubscribe=payload.get("group_unsubscribe"), + spam_report=payload.get("spam_report"), + bounce=payload.get("bounce"), + deferred=payload.get("deferred"), + unsubscribe=payload.get("unsubscribe"), + processed=payload.get("processed"), + open=payload.get("open"), + click=payload.get("click"), + dropped=payload.get("dropped"), + friendly_name=payload.get("friendly_name"), + id=payload.get("id"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_date_response_props.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_date_response_props.py new file mode 100644 index 00000000..84cbf75e --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_date_response_props.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookDateResponseProps: + def __init__( + self, + created_date: Optional[datetime] = None, + updated_date: Optional[datetime] = None, + ): + self.created_date = created_date + self.updated_date = updated_date + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "created_date": self.created_date, + "updated_date": self.updated_date, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookDateResponseProps( + created_date=payload.get("created_date"), + updated_date=payload.get("updated_date"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_no_dates_response.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_no_dates_response.py new file mode 100644 index 00000000..044bd353 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_no_dates_response.py @@ -0,0 +1,101 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookNoDatesResponse: + def __init__( + self, + enabled: Optional[bool] = None, + url: Optional[str] = None, + account_status_change: Optional[bool] = None, + group_resubscribe: Optional[bool] = None, + delivered: Optional[bool] = None, + group_unsubscribe: Optional[bool] = None, + spam_report: Optional[bool] = None, + bounce: Optional[bool] = None, + deferred: Optional[bool] = None, + unsubscribe: Optional[bool] = None, + processed: Optional[bool] = None, + open: Optional[bool] = None, + click: Optional[bool] = None, + dropped: Optional[bool] = None, + friendly_name: Optional[str] = None, + id: Optional[str] = None, + oauth_client_id: Optional[str] = None, + oauth_token_url: Optional[str] = None, + public_key: Optional[str] = None, + ): + self.enabled = enabled + self.url = url + self.account_status_change = account_status_change + self.group_resubscribe = group_resubscribe + self.delivered = delivered + self.group_unsubscribe = group_unsubscribe + self.spam_report = spam_report + self.bounce = bounce + self.deferred = deferred + self.unsubscribe = unsubscribe + self.processed = processed + self.open = open + self.click = click + self.dropped = dropped + self.friendly_name = friendly_name + self.id = id + self.oauth_client_id = oauth_client_id + self.oauth_token_url = oauth_token_url + self.public_key = public_key + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "url": self.url, + "account_status_change": self.account_status_change, + "group_resubscribe": self.group_resubscribe, + "delivered": self.delivered, + "group_unsubscribe": self.group_unsubscribe, + "spam_report": self.spam_report, + "bounce": self.bounce, + "deferred": self.deferred, + "unsubscribe": self.unsubscribe, + "processed": self.processed, + "open": self.open, + "click": self.click, + "dropped": self.dropped, + "friendly_name": self.friendly_name, + "id": self.id, + "oauth_client_id": self.oauth_client_id, + "oauth_token_url": self.oauth_token_url, + "public_key": self.public_key, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookNoDatesResponse( + enabled=payload.get("enabled"), + url=payload.get("url"), + account_status_change=payload.get("account_status_change"), + group_resubscribe=payload.get("group_resubscribe"), + delivered=payload.get("delivered"), + group_unsubscribe=payload.get("group_unsubscribe"), + spam_report=payload.get("spam_report"), + bounce=payload.get("bounce"), + deferred=payload.get("deferred"), + unsubscribe=payload.get("unsubscribe"), + processed=payload.get("processed"), + open=payload.get("open"), + click=payload.get("click"), + dropped=payload.get("dropped"), + friendly_name=payload.get("friendly_name"), + id=payload.get("id"), + oauth_client_id=payload.get("oauth_client_id"), + oauth_token_url=payload.get("oauth_token_url"), + public_key=payload.get("public_key"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_oauth_response_props.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_oauth_response_props.py new file mode 100644 index 00000000..25bf8a27 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_oauth_response_props.py @@ -0,0 +1,33 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookOauthResponseProps: + def __init__( + self, + oauth_client_id: Optional[str] = None, + oauth_token_url: Optional[str] = None, + ): + self.oauth_client_id = oauth_client_id + self.oauth_token_url = oauth_token_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "oauth_client_id": self.oauth_client_id, + "oauth_token_url": self.oauth_token_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookOauthResponseProps( + oauth_client_id=payload.get("oauth_client_id"), + oauth_token_url=payload.get("oauth_token_url"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_request.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_request.py new file mode 100644 index 00000000..e7e5d27f --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_request.py @@ -0,0 +1,93 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookRequest: + def __init__( + self, + enabled: Optional[bool] = None, + url: Optional[str] = None, + group_resubscribe: Optional[bool] = None, + delivered: Optional[bool] = None, + group_unsubscribe: Optional[bool] = None, + spam_report: Optional[bool] = None, + bounce: Optional[bool] = None, + deferred: Optional[bool] = None, + unsubscribe: Optional[bool] = None, + processed: Optional[bool] = None, + open: Optional[bool] = None, + click: Optional[bool] = None, + dropped: Optional[bool] = None, + friendly_name: Optional[str] = None, + oauth_client_id: Optional[str] = None, + oauth_client_secret: Optional[str] = None, + oauth_token_url: Optional[str] = None, + ): + self.enabled = enabled + self.url = url + self.group_resubscribe = group_resubscribe + self.delivered = delivered + self.group_unsubscribe = group_unsubscribe + self.spam_report = spam_report + self.bounce = bounce + self.deferred = deferred + self.unsubscribe = unsubscribe + self.processed = processed + self.open = open + self.click = click + self.dropped = dropped + self.friendly_name = friendly_name + self.oauth_client_id = oauth_client_id + self.oauth_client_secret = oauth_client_secret + self.oauth_token_url = oauth_token_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "url": self.url, + "group_resubscribe": self.group_resubscribe, + "delivered": self.delivered, + "group_unsubscribe": self.group_unsubscribe, + "spam_report": self.spam_report, + "bounce": self.bounce, + "deferred": self.deferred, + "unsubscribe": self.unsubscribe, + "processed": self.processed, + "open": self.open, + "click": self.click, + "dropped": self.dropped, + "friendly_name": self.friendly_name, + "oauth_client_id": self.oauth_client_id, + "oauth_client_secret": self.oauth_client_secret, + "oauth_token_url": self.oauth_token_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookRequest( + enabled=payload.get("enabled"), + url=payload.get("url"), + group_resubscribe=payload.get("group_resubscribe"), + delivered=payload.get("delivered"), + group_unsubscribe=payload.get("group_unsubscribe"), + spam_report=payload.get("spam_report"), + bounce=payload.get("bounce"), + deferred=payload.get("deferred"), + unsubscribe=payload.get("unsubscribe"), + processed=payload.get("processed"), + open=payload.get("open"), + click=payload.get("click"), + dropped=payload.get("dropped"), + friendly_name=payload.get("friendly_name"), + oauth_client_id=payload.get("oauth_client_id"), + oauth_client_secret=payload.get("oauth_client_secret"), + oauth_token_url=payload.get("oauth_token_url"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response.py new file mode 100644 index 00000000..d3b21d31 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response.py @@ -0,0 +1,109 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookSignedResponse: + def __init__( + self, + enabled: Optional[bool] = None, + url: Optional[str] = None, + account_status_change: Optional[bool] = None, + group_resubscribe: Optional[bool] = None, + delivered: Optional[bool] = None, + group_unsubscribe: Optional[bool] = None, + spam_report: Optional[bool] = None, + bounce: Optional[bool] = None, + deferred: Optional[bool] = None, + unsubscribe: Optional[bool] = None, + processed: Optional[bool] = None, + open: Optional[bool] = None, + click: Optional[bool] = None, + dropped: Optional[bool] = None, + friendly_name: Optional[str] = None, + id: Optional[str] = None, + created_date: Optional[datetime] = None, + updated_date: Optional[datetime] = None, + oauth_client_id: Optional[str] = None, + oauth_token_url: Optional[str] = None, + public_key: Optional[str] = None, + ): + self.enabled = enabled + self.url = url + self.account_status_change = account_status_change + self.group_resubscribe = group_resubscribe + self.delivered = delivered + self.group_unsubscribe = group_unsubscribe + self.spam_report = spam_report + self.bounce = bounce + self.deferred = deferred + self.unsubscribe = unsubscribe + self.processed = processed + self.open = open + self.click = click + self.dropped = dropped + self.friendly_name = friendly_name + self.id = id + self.created_date = created_date + self.updated_date = updated_date + self.oauth_client_id = oauth_client_id + self.oauth_token_url = oauth_token_url + self.public_key = public_key + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "url": self.url, + "account_status_change": self.account_status_change, + "group_resubscribe": self.group_resubscribe, + "delivered": self.delivered, + "group_unsubscribe": self.group_unsubscribe, + "spam_report": self.spam_report, + "bounce": self.bounce, + "deferred": self.deferred, + "unsubscribe": self.unsubscribe, + "processed": self.processed, + "open": self.open, + "click": self.click, + "dropped": self.dropped, + "friendly_name": self.friendly_name, + "id": self.id, + "created_date": self.created_date, + "updated_date": self.updated_date, + "oauth_client_id": self.oauth_client_id, + "oauth_token_url": self.oauth_token_url, + "public_key": self.public_key, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookSignedResponse( + enabled=payload.get("enabled"), + url=payload.get("url"), + account_status_change=payload.get("account_status_change"), + group_resubscribe=payload.get("group_resubscribe"), + delivered=payload.get("delivered"), + group_unsubscribe=payload.get("group_unsubscribe"), + spam_report=payload.get("spam_report"), + bounce=payload.get("bounce"), + deferred=payload.get("deferred"), + unsubscribe=payload.get("unsubscribe"), + processed=payload.get("processed"), + open=payload.get("open"), + click=payload.get("click"), + dropped=payload.get("dropped"), + friendly_name=payload.get("friendly_name"), + id=payload.get("id"), + created_date=payload.get("created_date"), + updated_date=payload.get("updated_date"), + oauth_client_id=payload.get("oauth_client_id"), + oauth_token_url=payload.get("oauth_token_url"), + public_key=payload.get("public_key"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response_prop.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response_prop.py new file mode 100644 index 00000000..f54d185d --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_signed_response_prop.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookSignedResponseProp: + def __init__(self, public_key: Optional[str] = None): + self.public_key = public_key + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"public_key": self.public_key}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookSignedResponseProp(public_key=payload.get("public_key")) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_test_request.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_test_request.py new file mode 100644 index 00000000..5fac3e5e --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_test_request.py @@ -0,0 +1,45 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookTestRequest: + def __init__( + self, + id: Optional[str] = None, + url: Optional[str] = None, + oauth_client_id: Optional[str] = None, + oauth_client_secret: Optional[str] = None, + oauth_token_url: Optional[str] = None, + ): + self.id = id + self.url = url + self.oauth_client_id = oauth_client_id + self.oauth_client_secret = oauth_client_secret + self.oauth_token_url = oauth_token_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "id": self.id, + "url": self.url, + "oauth_client_id": self.oauth_client_id, + "oauth_client_secret": self.oauth_client_secret, + "oauth_token_url": self.oauth_token_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookTestRequest( + id=payload.get("id"), + url=payload.get("url"), + oauth_client_id=payload.get("oauth_client_id"), + oauth_client_secret=payload.get("oauth_client_secret"), + oauth_token_url=payload.get("oauth_token_url"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/event_webhook_unsigned_response.py b/sendgrid/rest/api/webhooks/v3/models/event_webhook_unsigned_response.py new file mode 100644 index 00000000..235e6b4f --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/event_webhook_unsigned_response.py @@ -0,0 +1,105 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class EventWebhookUnsignedResponse: + def __init__( + self, + enabled: Optional[bool] = None, + url: Optional[str] = None, + account_status_change: Optional[bool] = None, + group_resubscribe: Optional[bool] = None, + delivered: Optional[bool] = None, + group_unsubscribe: Optional[bool] = None, + spam_report: Optional[bool] = None, + bounce: Optional[bool] = None, + deferred: Optional[bool] = None, + unsubscribe: Optional[bool] = None, + processed: Optional[bool] = None, + open: Optional[bool] = None, + click: Optional[bool] = None, + dropped: Optional[bool] = None, + friendly_name: Optional[str] = None, + id: Optional[str] = None, + created_date: Optional[datetime] = None, + updated_date: Optional[datetime] = None, + oauth_client_id: Optional[str] = None, + oauth_token_url: Optional[str] = None, + ): + self.enabled = enabled + self.url = url + self.account_status_change = account_status_change + self.group_resubscribe = group_resubscribe + self.delivered = delivered + self.group_unsubscribe = group_unsubscribe + self.spam_report = spam_report + self.bounce = bounce + self.deferred = deferred + self.unsubscribe = unsubscribe + self.processed = processed + self.open = open + self.click = click + self.dropped = dropped + self.friendly_name = friendly_name + self.id = id + self.created_date = created_date + self.updated_date = updated_date + self.oauth_client_id = oauth_client_id + self.oauth_token_url = oauth_token_url + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "enabled": self.enabled, + "url": self.url, + "account_status_change": self.account_status_change, + "group_resubscribe": self.group_resubscribe, + "delivered": self.delivered, + "group_unsubscribe": self.group_unsubscribe, + "spam_report": self.spam_report, + "bounce": self.bounce, + "deferred": self.deferred, + "unsubscribe": self.unsubscribe, + "processed": self.processed, + "open": self.open, + "click": self.click, + "dropped": self.dropped, + "friendly_name": self.friendly_name, + "id": self.id, + "created_date": self.created_date, + "updated_date": self.updated_date, + "oauth_client_id": self.oauth_client_id, + "oauth_token_url": self.oauth_token_url, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return EventWebhookUnsignedResponse( + enabled=payload.get("enabled"), + url=payload.get("url"), + account_status_change=payload.get("account_status_change"), + group_resubscribe=payload.get("group_resubscribe"), + delivered=payload.get("delivered"), + group_unsubscribe=payload.get("group_unsubscribe"), + spam_report=payload.get("spam_report"), + bounce=payload.get("bounce"), + deferred=payload.get("deferred"), + unsubscribe=payload.get("unsubscribe"), + processed=payload.get("processed"), + open=payload.get("open"), + click=payload.get("click"), + dropped=payload.get("dropped"), + friendly_name=payload.get("friendly_name"), + id=payload.get("id"), + created_date=payload.get("created_date"), + updated_date=payload.get("updated_date"), + oauth_client_id=payload.get("oauth_client_id"), + oauth_token_url=payload.get("oauth_token_url"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook200_response.py b/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook200_response.py new file mode 100644 index 00000000..cbfa34dc --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook200_response.py @@ -0,0 +1,25 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetSignedEventWebhook200Response: + def __init__(self, id: Optional[str] = None, public_key: Optional[str] = None): + self.id = id + self.public_key = public_key + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"id": self.id, "public_key": self.public_key}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSignedEventWebhook200Response( + id=payload.get("id"), public_key=payload.get("public_key") + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response.py b/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response.py new file mode 100644 index 00000000..1a3e31d8 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.get_signed_event_webhook404_response_errors_inner import ( + GetSignedEventWebhook404ResponseErrorsInner, +) + + +class GetSignedEventWebhook404Response: + def __init__( + self, errors: Optional[List[GetSignedEventWebhook404ResponseErrorsInner]] = None + ): + self.errors = errors + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"errors": self.errors}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSignedEventWebhook404Response(errors=payload.get("errors")) diff --git a/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response_errors_inner.py b/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response_errors_inner.py new file mode 100644 index 00000000..4366ed72 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/get_signed_event_webhook404_response_errors_inner.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class GetSignedEventWebhook404ResponseErrorsInner: + def __init__(self, message: Optional[str] = None): + self.message = message + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"message": self.message}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return GetSignedEventWebhook404ResponseErrorsInner( + message=payload.get("message") + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/list_parse_setting200_response.py b/sendgrid/rest/api/webhooks/v3/models/list_parse_setting200_response.py new file mode 100644 index 00000000..56c0bd70 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/list_parse_setting200_response.py @@ -0,0 +1,23 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.parse_setting import ParseSetting + + +class ListParseSetting200Response: + def __init__(self, result: Optional[List[ParseSetting]] = None): + self.result = result + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"result": self.result}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListParseSetting200Response(result=payload.get("result")) diff --git a/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner.py b/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner.py new file mode 100644 index 00000000..e9bcf036 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner.py @@ -0,0 +1,32 @@ +from typing import Optional, Dict, List +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.list_parse_static200_response_inner_stats_inner import ( + ListParseStatic200ResponseInnerStatsInner, +) + + +class ListParseStatic200ResponseInner: + def __init__( + self, + var_date: Optional[str] = None, + stats: Optional[List[ListParseStatic200ResponseInnerStatsInner]] = None, + ): + self.var_date = var_date + self.stats = stats + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"date": self.var_date, "stats": self.stats}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListParseStatic200ResponseInner( + var_date=payload.get("date"), stats=payload.get("stats") + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner.py b/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner.py new file mode 100644 index 00000000..596daa7d --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner.py @@ -0,0 +1,27 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable +from sendgrid.rest.api.webhooks.v3.models.list_parse_static200_response_inner_stats_inner_metrics import ( + ListParseStatic200ResponseInnerStatsInnerMetrics, +) + + +class ListParseStatic200ResponseInnerStatsInner: + def __init__( + self, metrics: Optional[ListParseStatic200ResponseInnerStatsInnerMetrics] = None + ): + self.metrics = metrics + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"metrics": self.metrics}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListParseStatic200ResponseInnerStatsInner(metrics=payload.get("metrics")) diff --git a/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner_metrics.py b/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner_metrics.py new file mode 100644 index 00000000..71227be5 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/list_parse_static200_response_inner_stats_inner_metrics.py @@ -0,0 +1,24 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ListParseStatic200ResponseInnerStatsInnerMetrics: + def __init__(self, received: Optional[float] = None): + self.received = received + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"received": self.received}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ListParseStatic200ResponseInnerStatsInnerMetrics( + received=payload.get("received") + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/parse_setting.py b/sendgrid/rest/api/webhooks/v3/models/parse_setting.py new file mode 100644 index 00000000..05af2565 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/parse_setting.py @@ -0,0 +1,41 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class ParseSetting: + def __init__( + self, + url: Optional[str] = None, + hostname: Optional[str] = None, + spam_check: Optional[bool] = None, + send_raw: Optional[bool] = None, + ): + self.url = url + self.hostname = hostname + self.spam_check = spam_check + self.send_raw = send_raw + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in { + "url": self.url, + "hostname": self.hostname, + "spam_check": self.spam_check, + "send_raw": self.send_raw, + }.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return ParseSetting( + url=payload.get("url"), + hostname=payload.get("hostname"), + spam_check=payload.get("spam_check"), + send_raw=payload.get("send_raw"), + ) diff --git a/sendgrid/rest/api/webhooks/v3/models/update_signed_event_webhook_request.py b/sendgrid/rest/api/webhooks/v3/models/update_signed_event_webhook_request.py new file mode 100644 index 00000000..90debf2e --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/models/update_signed_event_webhook_request.py @@ -0,0 +1,22 @@ +from typing import Optional, Dict +from sendgrid.converters.serialize import to_serializable, from_serializable + + +class UpdateSignedEventWebhookRequest: + def __init__(self, enabled: Optional[bool] = None): + self.enabled = enabled + + def to_dict(self): + return { + key: to_serializable(value) + for key, value in {"enabled": self.enabled}.items() + if value is not None + } + + @classmethod + def from_dict(cls, data): + return from_serializable(data, cls) + + @staticmethod + def generate_model(payload: Dict[str, object]): + return UpdateSignedEventWebhookRequest(enabled=payload.get("enabled")) diff --git a/sendgrid/rest/api/webhooks/v3/test_event_webhook.py b/sendgrid/rest/api/webhooks/v3/test_event_webhook.py new file mode 100644 index 00000000..0cd90afb --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/test_event_webhook.py @@ -0,0 +1,65 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.event_webhook_test_request import ( + EventWebhookTestRequest, +) + + +class TestEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + on_behalf_of: Optional[str] = None, + event_webhook_test_request: Optional[EventWebhookTestRequest] = None, + ): + path = "/v3/user/webhooks/event/test" + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if event_webhook_test_request: + data = event_webhook_test_request.to_dict() + request = Request(method="POST", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/update_event_webhook.py b/sendgrid/rest/api/webhooks/v3/update_event_webhook.py new file mode 100644 index 00000000..bc603045 --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/update_event_webhook.py @@ -0,0 +1,70 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.event_webhook_request import ( + EventWebhookRequest, +) + + +class UpdateEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + include: Optional[str] = None, + event_webhook_request: Optional[EventWebhookRequest] = None, + ): + path = "/v3/user/webhooks/event/settings/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if event_webhook_request: + data = event_webhook_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/update_parse_setting.py b/sendgrid/rest/api/webhooks/v3/update_parse_setting.py new file mode 100644 index 00000000..cd82932e --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/update_parse_setting.py @@ -0,0 +1,67 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.parse_setting import ParseSetting + + +class UpdateParseSetting: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + hostname: str, + on_behalf_of: Optional[str] = None, + parse_setting: Optional[ParseSetting] = None, + ): + path = "/v3/user/webhooks/parse/settings/{hostname}" + path = path.format( + hostname=hostname, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if parse_setting: + data = parse_setting.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/rest/api/webhooks/v3/update_signed_event_webhook.py b/sendgrid/rest/api/webhooks/v3/update_signed_event_webhook.py new file mode 100644 index 00000000..fdd92aae --- /dev/null +++ b/sendgrid/rest/api/webhooks/v3/update_signed_event_webhook.py @@ -0,0 +1,71 @@ +""" + This code was generated by + + SENDGRID-OAI-GENERATOR + + Twilio SendGrid Webhook Configuration API + The Twilio SendGrid Webhooks API allows you to configure the Event and Parse Webhooks. Email is a data-rich channel, and implementing the Event Webhook will allow you to consume those data in nearly real time. This means you can actively monitor and participate in the health of your email program throughout the send cycle. The Inbound Parse Webhook processes all incoming email for a domain or subdomain, parses the contents and attachments and then POSTs `multipart/form-data` to a URL that you choose. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +import json +from typing import Optional +from sendgrid.base import values +from sendgrid.exceptions import ApiException +from sendgrid.http.request import Request +from sendgrid.http.response import ApiResponse + +from typing import Optional +from sendgrid.rest.api.webhooks.v3.models.update_signed_event_webhook_request import ( + UpdateSignedEventWebhookRequest, +) + + +class UpdateSignedEventWebhook: + def __init__(self, client) -> None: + self.client = client + + def send( + self, + id: str, + on_behalf_of: Optional[str] = None, + update_signed_event_webhook_request: Optional[ + UpdateSignedEventWebhookRequest + ] = None, + ): + path = "/v3/user/webhooks/event/settings/signed/{id}" + path = path.format( + id=id, + ) + + headers = values.of( + { + "on-behalf-of": on_behalf_of, + } + ) + headers["Content-Type"] = "application/json" + data = None + if update_signed_event_webhook_request: + data = update_signed_event_webhook_request.to_dict() + request = Request(method="PATCH", url=path, data=data, headers=headers) + response = self.client.send(request) + if response is None: + raise ApiException( + error="CreateAlert creation failed: Unable to connect to server" + ) + + if response.text: + text = json.loads(response.text) + else: + text = "" + if response.is_success(): + return ApiResponse( + status_code=response.status_code, model=text, headers=response.headers + ) + else: + raise ApiException( + status_code=response.status_code, error=text, headers=response.headers + ) diff --git a/sendgrid/version.py b/sendgrid/version.py index 901082d4..3b0a199f 100644 --- a/sendgrid/version.py +++ b/sendgrid/version.py @@ -1 +1 @@ -__version__ = '6.11.0' +__version__ = '7.0.0-rc.1'