From 5aca3f671cbd987c61c8a2921bc06e3af9e4b364 Mon Sep 17 00:00:00 2001 From: nicoco Date: Tue, 22 Aug 2023 00:26:01 +0200 Subject: [PATCH] Re-generate with openapi-python-client 0.15.1 And fix issues related to https://github.com/openapi-generators/openapi-python-client/issues/758 --- .../api/bleve/purge_bleve_indexes.py | 48 ++- .../api/bots/assign_bot.py | 44 ++- .../api/bots/convert_bot_to_user.py | 40 ++- .../api/bots/convert_user_to_bot.py | 41 ++- .../api/bots/create_bot.py | 38 +-- .../api/bots/delete_bot_icon_image.py | 41 ++- .../api/bots/disable_bot.py | 41 ++- .../api/bots/enable_bot.py | 41 ++- .../api/bots/get_bot.py | 40 ++- .../api/bots/get_bot_icon_image.py | 35 +-- .../api/bots/get_bots.py | 38 +-- .../api/bots/patch_bot.py | 40 ++- .../api/bots/set_bot_icon_image.py | 40 ++- .../api/brand/delete_brand_image.py | 48 ++- .../api/brand/get_brand_image.py | 48 ++- .../api/brand/upload_brand_image.py | 38 +-- .../api/channels/add_channel_member.py | 40 ++- .../autocomplete_channels_for_team.py | 40 ++- ...tocomplete_channels_for_team_for_search.py | 40 ++- .../channel_members_minus_group_members.py | 32 +- .../api/channels/create_channel.py | 38 +-- .../api/channels/create_direct_channel.py | 38 +-- .../api/channels/create_group_channel.py | 38 +-- ...eate_sidebar_category_for_team_for_user.py | 43 ++- .../api/channels/delete_channel.py | 41 ++- .../api/channels/get_all_channels.py | 38 +-- .../api/channels/get_channel.py | 41 ++- .../api/channels/get_channel_by_name.py | 43 ++- .../get_channel_by_name_for_team_name.py | 43 ++- .../api/channels/get_channel_member.py | 44 ++- .../get_channel_member_counts_by_group.py | 32 +- .../api/channels/get_channel_members.py | 40 ++- .../channels/get_channel_members_by_ids.py | 40 ++- .../channels/get_channel_members_for_user.py | 44 ++- .../channels/get_channel_members_timezones.py | 41 ++- .../api/channels/get_channel_moderations.py | 41 ++- .../api/channels/get_channel_stats.py | 41 ++- .../api/channels/get_channel_unread.py | 44 ++- .../get_channels_for_team_for_user.py | 41 ++- .../api/channels/get_channels_for_user.py | 40 ++- .../channels/get_deleted_channels_for_team.py | 40 ++- .../api/channels/get_pinned_posts.py | 41 ++- .../channels/get_private_channels_for_team.py | 40 ++- .../get_public_channels_by_ids_for_team.py | 40 ++- .../channels/get_public_channels_for_team.py | 40 ++- ...et_sidebar_categories_for_team_for_user.py | 40 +-- .../get_sidebar_category_for_team_for_user.py | 45 ++- ...idebar_category_order_for_team_for_user.py | 44 ++- .../api/channels/move_channel.py | 40 ++- .../api/channels/patch_channel.py | 40 ++- .../api/channels/patch_channel_moderations.py | 40 ++- ...move_sidebar_category_for_team_for_user.py | 45 ++- .../api/channels/remove_user_from_channel.py | 44 ++- .../api/channels/restore_channel.py | 41 ++- .../api/channels/search_all_channels.py | 38 +-- .../api/channels/search_archived_channels.py | 40 ++- .../api/channels/search_channels.py | 40 ++- .../api/channels/search_group_channels.py | 38 +-- .../api/channels/update_channel.py | 40 ++- .../update_channel_member_scheme_roles.py | 43 ++- .../channels/update_channel_notify_props.py | 43 ++- .../api/channels/update_channel_privacy.py | 40 ++- .../api/channels/update_channel_roles.py | 43 ++- .../api/channels/update_channel_scheme.py | 40 ++- ...te_sidebar_categories_for_team_for_user.py | 43 ++- ...date_sidebar_category_for_team_for_user.py | 44 ++- ...idebar_category_order_for_team_for_user.py | 43 ++- .../api/channels/view_channel.py | 40 ++- .../api/cloud/confirm_customer_payment.py | 32 +- .../api/cloud/create_customer_payment.py | 48 ++- .../api/cloud/get_cloud_customer.py | 48 ++- .../api/cloud/get_cloud_limits.py | 48 ++- .../api/cloud/get_cloud_products.py | 48 ++- .../get_invoice_for_subscription_as_pdf.py | 35 +-- .../cloud/get_invoices_for_subscription.py | 48 ++- .../api/cloud/get_subscription.py | 48 ++- .../cloud/post_endpoint_for_cws_webhooks.py | 42 +-- .../api/cloud/update_cloud_customer.py | 38 +-- .../cloud/update_cloud_customer_address.py | 38 +-- .../api/cluster/get_cluster_status.py | 48 ++- .../api/commands/create_command.py | 38 +-- .../api/commands/delete_command.py | 41 ++- .../api/commands/execute_command.py | 38 +-- .../api/commands/get_command_by_id.py | 41 ++- .../commands/list_autocomplete_commands.py | 41 ++- .../list_command_autocomplete_suggestions.py | 36 +-- .../api/commands/list_commands.py | 38 +-- .../api/commands/move_command.py | 40 ++- .../api/commands/regen_command_token.py | 41 ++- .../api/commands/update_command.py | 40 ++- .../compliance/create_compliance_report.py | 48 ++- .../compliance/download_compliance_report.py | 35 +-- .../api/compliance/get_compliance_report.py | 41 ++- .../api/compliance/get_compliance_reports.py | 38 +-- .../add_channels_to_retention_policy.py | 40 ++- .../add_teams_to_retention_policy.py | 40 ++- .../create_data_retention_policy.py | 34 +-- .../delete_data_retention_policy.py | 41 ++- .../get_channel_policies_for_user.py | 40 ++- .../get_channels_for_retention_policy.py | 40 ++- .../get_data_retention_policies.py | 34 +-- .../get_data_retention_policies_count.py | 44 +-- .../get_data_retention_policy.py | 48 ++- .../get_data_retention_policy_by_id.py | 37 +-- .../get_team_policies_for_user.py | 40 ++- .../get_teams_for_retention_policy.py | 40 ++- .../patch_data_retention_policy.py | 36 +-- .../remove_channels_from_retention_policy.py | 40 ++- .../remove_teams_from_retention_policy.py | 40 ++- .../search_channels_for_retention_policy.py | 40 ++- .../search_teams_for_retention_policy.py | 40 ++- .../purge_elasticsearch_indexes.py | 48 ++- .../api/elasticsearch/test_elasticsearch.py | 48 ++- .../api/emoji/autocomplete_emoji.py | 38 +-- .../api/emoji/create_emoji.py | 38 +-- .../api/emoji/delete_emoji.py | 41 ++- .../api/emoji/get_emoji.py | 41 ++- .../api/emoji/get_emoji_by_name.py | 41 ++- .../api/emoji/get_emoji_image.py | 35 +-- .../api/emoji/get_emoji_list.py | 38 +-- .../api/emoji/search_emoji.py | 38 +-- .../api/exports/delete_export.py | 35 +-- .../api/exports/download_export.py | 35 +-- .../api/exports/list_exports.py | 42 +-- .../api/files/get_file.py | 41 ++- .../api/files/get_file_info.py | 41 ++- .../api/files/get_file_link.py | 37 +-- .../api/files/get_file_preview.py | 41 ++- .../api/files/get_file_public.py | 40 ++- .../api/files/get_file_thumbnail.py | 41 ++- .../api/files/upload_file.py | 38 +-- .../api/groups/add_group_members.py | 40 ++- .../api/groups/create_group.py | 32 +- .../api/groups/delete_group.py | 41 ++- .../api/groups/delete_group_members.py | 40 ++- .../api/groups/get_group.py | 41 ++- .../api/groups/get_group_stats.py | 41 ++- .../get_group_syncable_for_channel_id.py | 44 ++- .../groups/get_group_syncable_for_team_id.py | 42 ++- .../groups/get_group_syncables_channels.py | 41 ++- .../api/groups/get_group_syncables_teams.py | 41 ++- .../api/groups/get_group_users.py | 40 ++- .../api/groups/get_groups.py | 38 +-- ...t_groups_associated_to_channels_by_team.py | 36 +-- .../api/groups/get_groups_by_channel.py | 40 ++- .../api/groups/get_groups_by_team.py | 40 ++- .../api/groups/get_groups_by_user_id.py | 41 ++- .../groups/link_group_syncable_for_channel.py | 44 ++- .../groups/link_group_syncable_for_team.py | 42 ++- .../api/groups/patch_group.py | 40 ++- .../patch_group_syncable_for_channel.py | 43 ++- .../groups/patch_group_syncable_for_team.py | 43 ++- .../api/groups/restore_group.py | 184 ++++++++++++ .../unlink_group_syncable_for_channel.py | 44 ++- .../groups/unlink_group_syncable_for_team.py | 42 ++- .../api/groups/unlink_ldap_group.py | 41 ++- .../api/imports/list_imports.py | 42 +-- .../api/insights/__init__.py | 0 .../api/insights/get_new_team_members.py | 234 --------------- .../api/insights/get_top_channels_for_team.py | 230 -------------- .../api/insights/get_top_channels_for_user.py | 232 -------------- .../insights/get_top_reactions_for_team.py | 234 --------------- .../insights/get_top_reactions_for_user.py | 244 --------------- .../api/insights/get_top_threads_for_team.py | 234 --------------- .../api/insights/get_top_threads_for_user.py | 236 --------------- .../open_interactive_dialog.py | 38 +-- .../submit_interactive_dialog.py | 38 +-- .../create_playbook_run_from_dialog.py | 28 +- .../api/internal/end_playbook_run_dialog.py | 29 +- .../internal/get_checklist_autocomplete.py | 24 +- .../api/internal/next_stage_dialog.py | 28 +- .../api/jobs/cancel_job.py | 41 ++- .../api/jobs/create_job.py | 38 +-- .../api/jobs/download_job.py | 35 +-- .../api/jobs/get_job.py | 41 ++- .../api/jobs/get_jobs.py | 38 +-- .../api/jobs/get_jobs_by_type.py | 40 ++- .../api/ldap/add_user_to_group_syncables.py | 180 +++++++++++ .../ldap/delete_ldap_private_certificate.py | 48 ++- .../ldap/delete_ldap_public_certificate.py | 48 ++- .../api/ldap/get_ldap_groups.py | 38 +-- .../api/ldap/link_ldap_group.py | 41 ++- .../api/ldap/migrate_id_ldap.py | 38 +-- .../api/ldap/sync_ldap.py | 48 ++- .../api/ldap/test_ldap.py | 48 ++- .../ldap/upload_ldap_private_certificate.py | 38 +-- .../ldap/upload_ldap_public_certificate.py | 38 +-- .../api/o_auth/create_o_auth_app.py | 38 +-- .../api/o_auth/delete_o_auth_app.py | 41 ++- .../get_authorized_o_auth_apps_for_user.py | 40 ++- .../api/o_auth/get_o_auth_app.py | 41 ++- .../api/o_auth/get_o_auth_app_info.py | 41 ++- .../api/o_auth/get_o_auth_apps.py | 38 +-- .../o_auth/regenerate_o_auth_app_secret.py | 41 ++- .../api/o_auth/update_o_auth_app.py | 40 ++- .../api/open_graph/open_graph.py | 38 +-- .../permissions/get_ancillary_permissions.py | 38 +-- .../playbook_autofollows/get_auto_follows.py | 31 +- .../api/playbook_runs/add_checklist_item.py | 33 +- .../api/playbook_runs/change_owner.py | 28 +- .../create_playbook_run_from_post.py | 28 +- .../api/playbook_runs/end_playbook_run.py | 29 +- .../api/playbook_runs/finish.py | 29 +- .../api/playbook_runs/get_channels.py | 28 +- .../api/playbook_runs/get_owners.py | 28 +- .../api/playbook_runs/get_playbook_run.py | 31 +- .../get_playbook_run_by_channel_id.py | 31 +- .../get_playbook_run_metadata.py | 31 +- .../api/playbook_runs/item_delete.py | 33 +- .../api/playbook_runs/item_rename.py | 32 +- .../api/playbook_runs/item_run.py | 35 +-- .../api/playbook_runs/item_set_assignee.py | 32 +- .../api/playbook_runs/item_set_state.py | 32 +- .../api/playbook_runs/list_playbook_runs.py | 28 +- .../playbook_runs/reoder_checklist_item.py | 31 +- .../api/playbook_runs/restart_playbook_run.py | 29 +- .../api/playbook_runs/status.py | 28 +- .../api/playbook_runs/update_playbook_run.py | 28 +- .../api/playbooks/create_playbook.py | 28 +- .../api/playbooks/delete_playbook.py | 29 +- .../api/playbooks/get_playbook.py | 31 +- .../api/playbooks/get_playbooks.py | 28 +- .../api/playbooks/update_playbook.py | 28 +- .../api/plugins/disable_plugin.py | 41 ++- .../api/plugins/enable_plugin.py | 41 ++- .../api/plugins/get_marketplace_plugins.py | 30 +- .../get_marketplace_visited_by_admin.py | 48 ++- .../api/plugins/get_plugin_statuses.py | 48 ++- .../api/plugins/get_plugins.py | 42 +-- .../api/plugins/get_webapp_plugins.py | 48 ++- .../api/plugins/install_marketplace_plugin.py | 32 +- .../api/plugins/install_plugin_from_url.py | 38 +-- .../api/plugins/remove_plugin.py | 41 ++- .../api/plugins/upload_plugin.py | 38 +-- .../api/posts/create_post.py | 38 +-- .../api/posts/create_post_ephemeral.py | 38 +-- .../api/posts/delete_post.py | 41 ++- .../api/posts/do_post_action.py | 42 ++- .../api/posts/get_file_infos_for_post.py | 40 ++- .../api/posts/get_flagged_posts_for_user.py | 40 ++- .../api/posts/get_post.py | 40 ++- .../api/posts/get_post_thread.py | 40 ++- .../api/posts/get_posts_around_last_unread.py | 43 ++- .../api/posts/get_posts_by_ids.py | 38 +-- .../api/posts/get_posts_for_channel.py | 40 ++- .../api/posts/patch_post.py | 40 ++- .../api/posts/pin_post.py | 41 ++- .../posts/save_acknowledgement_for_post.py | 42 ++- .../api/posts/search_posts.py | 40 ++- .../api/posts/set_post_reminder.py | 41 ++- .../api/posts/set_post_unread.py | 44 ++- .../api/posts/unpin_post.py | 41 ++- .../api/posts/update_post.py | 40 ++- .../api/preferences/delete_preferences.py | 40 ++- .../api/preferences/get_preferences.py | 41 ++- .../get_preferences_by_category.py | 42 ++- .../get_preferences_by_category_by_name.py | 45 ++- .../api/preferences/update_preferences.py | 40 ++- .../api/reactions/delete_reaction.py | 45 ++- .../api/reactions/get_bulk_reactions.py | 38 +-- .../api/reactions/get_reactions.py | 41 ++- .../api/reactions/save_reaction.py | 38 +-- .../api/roles/get_all_roles.py | 48 ++- .../api/roles/get_role.py | 41 ++- .../api/roles/get_role_by_name.py | 41 ++- .../api/roles/get_roles_by_names.py | 38 +-- .../api/roles/patch_role.py | 40 ++- .../api/root/acknowledge_notification.py | 48 ++- .../api/saml/delete_saml_idp_certificate.py | 48 ++- .../saml/delete_saml_private_certificate.py | 48 ++- .../saml/delete_saml_public_certificate.py | 48 ++- .../api/saml/get_saml_certificate_status.py | 48 ++- .../api/saml/get_saml_metadata.py | 48 ++- .../api/saml/get_saml_metadata_from_idp.py | 38 +-- .../api/saml/reset_saml_auth_data_to_email.py | 34 +-- .../api/saml/upload_saml_idp_certificate.py | 38 +-- .../saml/upload_saml_private_certificate.py | 38 +-- .../saml/upload_saml_public_certificate.py | 38 +-- .../api/schemes/create_scheme.py | 38 +-- .../api/schemes/delete_scheme.py | 41 ++- .../api/schemes/get_channels_for_scheme.py | 40 ++- .../api/schemes/get_scheme.py | 41 ++- .../api/schemes/get_schemes.py | 38 +-- .../api/schemes/get_teams_for_scheme.py | 40 ++- .../api/schemes/patch_scheme.py | 40 ++- .../get_all_shared_channels.py | 40 ++- .../get_remote_cluster_info.py | 41 ++- .../api/status/get_user_status.py | 41 ++- .../api/status/get_users_statuses_by_ids.py | 38 +-- .../post_user_recent_custom_status_delete.py | 34 +-- .../api/status/remove_recent_custom_status.py | 34 +-- .../api/status/unset_user_custom_status.py | 35 +-- .../api/status/update_user_custom_status.py | 34 +-- .../api/status/update_user_status.py | 40 ++- .../api/system/check_integrity.py | 50 ++-- .../api/system/clear_server_busy.py | 48 ++- .../api/system/database_recycle.py | 48 ++- .../api/system/generate_support_packet.py | 42 +-- .../api/system/get_analytics_old.py | 30 +- .../api/system/get_audits.py | 38 +-- .../api/system/get_client_config.py | 32 +- .../api/system/get_client_license.py | 32 +- .../api/system/get_config.py | 48 ++- .../api/system/get_environment_config.py | 48 ++- .../api/system/get_image_by_url.py | 42 +-- .../api/system/get_logs.py | 38 +-- .../api/system/get_notices.py | 68 ++--- .../api/system/get_ping.py | 42 ++- .../api/system/get_prev_trial_license.py | 42 +-- .../api/system/get_redirect_location.py | 48 ++- .../api/system/get_server_busy_expires.py | 48 ++- .../api/system/get_supported_timezone.py | 48 ++- .../api/system/get_warn_metrics_status.py | 48 ++- .../api/system/invalidate_caches.py | 48 ++- .../api/system/mark_notices_viewed.py | 38 +-- .../api/system/patch_config.py | 38 +-- .../api/system/post_log.py | 38 +-- .../api/system/reload_config.py | 48 ++- .../api/system/remove_license_file.py | 42 +-- .../system/request_license_renewal_link.py | 48 ++- .../api/system/request_trial_license.py | 32 +- .../api/system/restart_server.py | 48 ++- .../send_trial_license_warn_metric_ack.py | 43 ++- .../api/system/send_warn_metric_ack.py | 40 ++- .../api/system/set_server_busy.py | 38 +-- .../api/system/test_email.py | 38 +-- .../api/system/test_s3_connection.py | 38 +-- .../api/system/test_site_url.py | 38 +-- .../api/system/update_config.py | 38 +-- .../update_marketplace_visited_by_admin.py | 38 +-- .../api/system/upgrade_to_enterprise.py | 48 ++- .../system/upgrade_to_enterprise_status.py | 44 +-- .../api/system/upload_license_file.py | 38 +-- .../api/teams/add_team_member.py | 40 ++- .../api/teams/add_team_member_from_invite.py | 38 +-- .../api/teams/add_team_members.py | 40 ++- .../api/teams/create_team.py | 38 +-- .../api/teams/get_all_teams.py | 38 +-- .../api/teams/get_team.py | 41 ++- .../api/teams/get_team_by_name.py | 41 ++- .../api/teams/get_team_icon.py | 35 +-- .../api/teams/get_team_invite_info.py | 41 ++- .../api/teams/get_team_member.py | 42 ++- .../api/teams/get_team_members.py | 40 ++- .../api/teams/get_team_members_by_ids.py | 40 ++- .../api/teams/get_team_members_for_user.py | 41 ++- .../api/teams/get_team_stats.py | 41 ++- .../api/teams/get_team_unread.py | 42 ++- .../api/teams/get_teams_for_user.py | 41 ++- .../api/teams/get_teams_unread_for_user.py | 40 ++- .../api/teams/import_team.py | 40 ++- .../api/teams/invalidate_email_invites.py | 48 ++- .../api/teams/invite_guests_to_team.py | 40 ++- .../api/teams/invite_users_to_team.py | 40 ++- .../api/teams/patch_team.py | 40 ++- .../api/teams/regenerate_team_invite_id.py | 41 ++- .../api/teams/remove_team_icon.py | 41 ++- .../api/teams/remove_team_member.py | 42 ++- .../api/teams/restore_team.py | 41 ++- .../api/teams/search_files.py | 40 ++- .../api/teams/search_teams.py | 38 +-- .../api/teams/set_team_icon.py | 40 ++- .../api/teams/soft_delete_team.py | 40 ++- .../api/teams/team_exists.py | 41 ++- .../teams/team_members_minus_group_members.py | 32 +- .../api/teams/update_team.py | 40 ++- .../api/teams/update_team_member_roles.py | 41 ++- .../teams/update_team_member_scheme_roles.py | 43 ++- .../api/teams/update_team_privacy.py | 40 ++- .../api/teams/update_team_scheme.py | 40 ++- .../create_terms_of_service.py | 48 ++- .../terms_of_service/get_terms_of_service.py | 48 ++- .../get_thread_mention_counts_by_channel.py | 38 +-- .../api/threads/get_user_thread.py | 39 +-- .../api/threads/get_user_threads.py | 41 ++- .../threads/set_thread_unread_by_post_id.py | 40 +-- .../api/threads/start_following_thread.py | 39 +-- .../api/threads/stop_following_thread.py | 39 +-- .../threads/update_thread_read_for_user.py | 40 +-- .../threads/update_threads_read_for_user.py | 38 +-- .../api/timeline/remove_timeline_event.py | 30 +- .../api/uploads/create_upload.py | 38 +-- .../api/uploads/get_upload.py | 35 +-- .../api/uploads/upload_data.py | 41 ++- .../api/usage/get_posts_usage.py | 48 ++- .../api/usage/get_storage_usage.py | 48 ++- .../api/users/attach_device_id.py | 38 +-- .../api/users/autocomplete_users.py | 38 +-- .../api/users/check_user_mfa.py | 38 +-- .../api/users/create_user.py | 38 +-- .../api/users/create_user_access_token.py | 40 ++- .../api/users/delete_user.py | 41 ++- .../api/users/demote_user_to_guest.py | 41 ++- .../api/users/disable_user_access_token.py | 38 +-- .../api/users/enable_user_access_token.py | 38 +-- .../api/users/generate_mfa_secret.py | 41 ++- ...channel_members_with_team_data_for_user.py | 36 +-- .../api/users/get_default_profile_image.py | 35 +-- .../api/users/get_known_users.py | 42 +-- .../api/users/get_profile_image.py | 32 +- .../api/users/get_sessions.py | 41 ++- .../api/users/get_total_users_stats.py | 48 ++- .../users/get_total_users_stats_filtered.py | 38 +-- .../api/users/get_uploads_for_user.py | 41 ++- .../api/users/get_user.py | 41 ++- .../api/users/get_user_access_token.py | 41 ++- .../api/users/get_user_access_tokens.py | 34 +-- .../users/get_user_access_tokens_for_user.py | 36 +-- .../api/users/get_user_audits.py | 41 ++- .../api/users/get_user_by_email.py | 41 ++- .../api/users/get_user_by_username.py | 41 ++- .../api/users/get_user_terms_of_service.py | 41 ++- .../api/users/get_users.py | 38 +-- .../users/get_users_by_group_channel_ids.py | 34 +-- .../api/users/get_users_by_ids.py | 38 +-- .../api/users/get_users_by_usernames.py | 38 +-- .../get_users_with_invalid_emails.py} | 111 ++++--- .../api/users/login.py | 38 +-- .../api/users/login_by_cws_token.py | 32 +- .../api/users/logout.py | 48 ++- .../api/users/migrate_auth_to_ldap.py | 32 +- .../api/users/migrate_auth_to_saml.py | 32 +- .../api/users/patch_user.py | 40 ++- .../api/users/permanent_delete_all_users.py | 42 +-- .../api/users/promote_guest_to_user.py | 41 ++- .../api/users/publish_user_typing.py | 34 +-- .../users/register_terms_of_service_action.py | 40 ++- .../api/users/reset_password.py | 38 +-- .../api/users/revoke_all_sessions.py | 41 ++- .../api/users/revoke_session.py | 40 ++- .../users/revoke_sessions_from_all_users.py | 42 +-- .../api/users/revoke_user_access_token.py | 38 +-- .../api/users/search_user_access_tokens.py | 40 +-- .../api/users/search_users.py | 38 +-- .../api/users/send_password_reset_email.py | 38 +-- .../api/users/send_verification_email.py | 38 +-- .../api/users/set_default_profile_image.py | 41 ++- .../api/users/set_profile_image.py | 40 ++- .../api/users/switch_account_type.py | 38 +-- .../api/users/update_user.py | 40 ++- .../api/users/update_user_active.py | 40 ++- .../api/users/update_user_auth.py | 40 ++- .../api/users/update_user_mfa.py | 40 ++- .../api/users/update_user_password.py | 40 ++- .../api/users/update_user_roles.py | 40 ++- .../api/users/verify_user_email.py | 38 +-- .../users/verify_user_email_without_token.py | 41 ++- .../api/webhooks/create_incoming_webhook.py | 38 +-- .../api/webhooks/create_outgoing_webhook.py | 38 +-- .../api/webhooks/delete_incoming_webhook.py | 41 ++- .../api/webhooks/delete_outgoing_webhook.py | 41 ++- .../api/webhooks/get_incoming_webhook.py | 41 ++- .../api/webhooks/get_incoming_webhooks.py | 38 +-- .../api/webhooks/get_outgoing_webhook.py | 41 ++- .../api/webhooks/get_outgoing_webhooks.py | 38 +-- .../api/webhooks/regen_outgoing_hook_token.py | 41 ++- .../api/webhooks/update_incoming_webhook.py | 40 ++- .../api/webhooks/update_outgoing_webhook.py | 40 ++- mattermost_api_reference_client/client.py | 282 +++++++++++++++--- .../models/__init__.py | 20 -- .../models/add_channel_member_json_body.py | 7 +- .../models/add_checklist_item_json_body.py | 7 +- .../models/add_group_members_json_body.py | 7 +- .../models/add_on.py | 7 +- .../models/add_team_member_json_body.py | 7 +- .../models/address.py | 7 +- .../models/app_error.py | 7 +- .../models/attach_device_id_json_body.py | 7 +- .../models/audit.py | 7 +- .../models/autocomplete_suggestion.py | 7 +- .../models/boards_limits.py | 7 +- mattermost_api_reference_client/models/bot.py | 7 +- .../models/change_owner_json_body.py | 7 +- .../models/channel.py | 7 +- .../models/channel_data.py | 7 +- .../models/channel_member.py | 7 +- .../models/channel_member_count_by_group.py | 7 +- .../models/channel_member_with_team_data.py | 7 +- .../models/channel_moderated_role.py | 7 +- .../models/channel_moderated_roles.py | 7 +- .../models/channel_moderated_roles_patch.py | 7 +- .../models/channel_moderation.py | 7 +- .../models/channel_moderation_patch.py | 7 +- .../models/channel_notify_props.py | 7 +- .../models/channel_stats.py | 7 +- .../models/channel_unread.py | 7 +- .../models/channel_unread_at.py | 7 +- .../models/channel_with_team_data.py | 7 +- .../models/check_user_mfa_json_body.py | 7 +- .../models/check_user_mfa_response_200.py | 7 +- .../models/checklist.py | 7 +- .../models/checklist_item.py | 7 +- .../models/cloud_customer.py | 7 +- .../models/cluster_info.py | 7 +- .../models/command.py | 7 +- .../models/command_response.py | 7 +- .../models/compliance.py | 7 +- .../models/config.py | 7 +- .../models/config_analytics_settings.py | 7 +- .../models/config_cluster_settings.py | 7 +- .../models/config_compliance_settings.py | 7 +- .../models/config_email_settings.py | 7 +- .../models/config_file_settings.py | 7 +- .../models/config_git_lab_settings.py | 7 +- .../models/config_google_settings.py | 7 +- .../models/config_ldap_settings.py | 7 +- .../models/config_localization_settings.py | 7 +- .../models/config_log_settings.py | 7 +- .../models/config_metrics_settings.py | 7 +- .../models/config_native_app_settings.py | 7 +- .../models/config_office_365_settings.py | 7 +- .../models/config_password_settings.py | 7 +- .../models/config_privacy_settings.py | 7 +- .../models/config_rate_limit_settings.py | 7 +- .../models/config_saml_settings.py | 7 +- .../models/config_service_settings.py | 7 +- .../models/config_sql_settings.py | 7 +- .../models/config_support_settings.py | 7 +- .../models/config_team_settings.py | 7 +- ...confirm_customer_payment_multipart_data.py | 7 +- .../models/convert_bot_to_user_json_body.py | 7 +- .../convert_bot_to_user_json_body_props.py | 8 +- .../models/create_bot_json_body.py | 7 +- .../models/create_channel_json_body.py | 7 +- .../models/create_command_json_body.py | 7 +- .../models/create_emoji_multipart_data.py | 7 +- .../models/create_group_json_body.py | 7 +- .../models/create_group_json_body_group.py | 7 +- .../create_incoming_webhook_json_body.py | 7 +- .../models/create_job_json_body.py | 7 +- .../models/create_job_json_body_data.py | 8 +- .../models/create_o_auth_app_json_body.py | 7 +- .../create_outgoing_webhook_json_body.py | 7 +- .../models/create_playbook_json_body.py | 15 +- ...eate_playbook_json_body_checklists_item.py | 7 +- ...ok_json_body_checklists_item_items_item.py | 7 +- .../models/create_playbook_response_201.py | 7 +- ...eate_playbook_run_from_dialog_json_body.py | 7 +- ...ok_run_from_dialog_json_body_submission.py | 7 +- ...create_playbook_run_from_post_json_body.py | 7 +- .../models/create_post_ephemeral_json_body.py | 7 +- .../create_post_ephemeral_json_body_post.py | 7 +- .../models/create_post_json_body.py | 7 +- .../models/create_post_json_body_metadata.py | 7 +- ...create_post_json_body_metadata_priority.py | 7 +- .../models/create_post_json_body_props.py | 8 +- .../models/create_scheme_json_body.py | 7 +- .../models/create_team_json_body.py | 7 +- .../models/create_upload_json_body.py | 7 +- .../create_user_access_token_json_body.py | 7 +- .../models/create_user_json_body.py | 7 +- .../models/create_user_json_body_props.py | 8 +- .../models/data_retention_policy.py | 7 +- .../data_retention_policy_for_channel.py | 7 +- .../models/data_retention_policy_for_team.py | 7 +- ...ion_policy_with_team_and_channel_counts.py | 7 +- ...ention_policy_with_team_and_channel_ids.py | 7 +- .../data_retention_policy_without_id.py | 7 +- .../models/delete_group_members_json_body.py | 7 +- .../disable_user_access_token_json_body.py | 7 +- .../models/emoji.py | 7 +- .../enable_user_access_token_json_body.py | 7 +- .../models/environment_config.py | 7 +- .../environment_config_analytics_settings.py | 7 +- .../environment_config_cluster_settings.py | 7 +- .../environment_config_compliance_settings.py | 7 +- .../environment_config_email_settings.py | 7 +- .../environment_config_file_settings.py | 7 +- .../environment_config_git_lab_settings.py | 7 +- .../environment_config_google_settings.py | 7 +- .../environment_config_ldap_settings.py | 7 +- ...nvironment_config_localization_settings.py | 7 +- .../models/environment_config_log_settings.py | 7 +- .../environment_config_metrics_settings.py | 7 +- .../environment_config_native_app_settings.py | 7 +- .../environment_config_office_365_settings.py | 7 +- .../environment_config_password_settings.py | 7 +- .../environment_config_privacy_settings.py | 7 +- .../environment_config_rate_limit_settings.py | 7 +- .../environment_config_saml_settings.py | 7 +- .../environment_config_service_settings.py | 7 +- .../models/environment_config_sql_settings.py | 7 +- .../environment_config_support_settings.py | 7 +- .../environment_config_team_settings.py | 7 +- .../models/error.py | 7 +- .../models/execute_command_json_body.py | 7 +- .../models/file_info.py | 7 +- .../models/file_info_list.py | 7 +- .../models/file_info_list_file_infos.py | 7 +- .../models/files_limits.py | 7 +- .../generate_mfa_secret_response_200.py | 7 +- ...hecklist_autocomplete_response_200_item.py | 7 +- ...a_retention_policies_count_response_200.py | 7 +- .../models/get_file_link_response_200.py | 7 +- .../models/get_group_stats_response_200.py | 7 +- .../models/get_group_users_response_200.py | 7 +- ...ciated_to_channels_by_team_response_200.py | 8 +- .../get_saml_metadata_from_idp_json_body.py | 7 +- .../get_team_invite_info_response_200.py | 7 +- ...users_by_group_channel_ids_response_200.py | 7 +- .../models/global_data_retention_policy.py | 7 +- .../models/group.py | 7 +- .../models/group_syncable_channel.py | 7 +- .../models/group_syncable_channels.py | 7 +- .../models/group_syncable_team.py | 7 +- .../models/group_syncable_teams.py | 7 +- .../models/group_with_scheme_admin.py | 7 +- .../models/groups_associated_to_channels.py | 7 +- .../models/import_team_multipart_data.py | 7 +- .../models/import_team_response_200.py | 7 +- .../models/incoming_webhook.py | 7 +- .../models/insight_user_information.py | 105 ------- .../install_marketplace_plugin_json_body.py | 7 +- .../models/integrations_limits.py | 7 +- .../models/integrity_check_result.py | 7 +- .../models/invite_guests_to_team_json_body.py | 7 +- .../models/invoice.py | 7 +- .../models/invoice_line_item.py | 7 +- .../models/item_rename_json_body.py | 7 +- .../models/item_set_assignee_json_body.py | 7 +- .../models/item_set_state_json_body.py | 7 +- mattermost_api_reference_client/models/job.py | 7 +- .../models/job_data.py | 8 +- .../models/ldap_group.py | 7 +- .../models/ldap_groups_paged.py | 7 +- .../models/license_renewal_link.py | 7 +- .../models/login_by_cws_token_json_body.py | 7 +- .../models/login_json_body.py | 7 +- .../models/messages_limits.py | 7 +- .../models/migrate_auth_to_ldap_json_body.py | 7 +- .../models/migrate_auth_to_saml_json_body.py | 7 +- .../migrate_auth_to_saml_json_body_matches.py | 8 +- .../models/migrate_id_ldap_json_body.py | 7 +- .../models/move_channel_json_body.py | 7 +- .../models/move_command_json_body.py | 7 +- .../models/new_team_member.py | 7 +- .../models/new_team_members_list.py | 7 +- .../models/next_stage_dialog_json_body.py | 7 +- .../models/notice.py | 7 +- .../models/o_auth_app.py | 7 +- .../models/open_graph.py | 7 +- .../models/open_graph_article.py | 7 +- .../models/open_graph_article_authors_item.py | 7 +- .../models/open_graph_audios_item.py | 7 +- .../models/open_graph_book.py | 7 +- .../models/open_graph_book_authors_item.py | 7 +- .../models/open_graph_images_item.py | 7 +- .../models/open_graph_json_body.py | 7 +- .../models/open_graph_profile.py | 7 +- .../models/open_graph_videos_item.py | 7 +- .../open_interactive_dialog_json_body.py | 7 +- ...pen_interactive_dialog_json_body_dialog.py | 7 +- ...e_dialog_json_body_dialog_elements_item.py | 8 +- .../models/ordered_sidebar_categories.py | 7 +- .../models/orphaned_record.py | 7 +- .../models/outgoing_webhook.py | 7 +- .../models/owner_info.py | 7 +- .../models/patch_bot_json_body.py | 7 +- .../models/patch_channel_json_body.py | 7 +- .../models/patch_group_json_body.py | 7 +- ...ch_group_syncable_for_channel_json_body.py | 7 +- ...patch_group_syncable_for_team_json_body.py | 7 +- .../models/patch_post_json_body.py | 7 +- .../models/patch_role_json_body.py | 7 +- .../models/patch_scheme_json_body.py | 7 +- .../models/patch_team_json_body.py | 7 +- .../models/patch_user_json_body.py | 7 +- .../models/patch_user_json_body_props.py | 8 +- .../models/payment_method.py | 7 +- .../models/payment_setup_intent.py | 7 +- .../models/playbook.py | 8 +- .../models/playbook_autofollows.py | 7 +- .../models/playbook_list.py | 7 +- .../models/playbook_run.py | 7 +- .../models/playbook_run_list.py | 7 +- .../models/playbook_run_metadata.py | 7 +- .../models/plugin_manifest_webapp_webapp.py | 7 +- .../models/plugin_status.py | 7 +- .../models/post.py | 7 +- .../models/post_acknowledgement.py | 7 +- .../models/post_id_to_reactions_map.py | 7 +- .../models/post_list.py | 7 +- .../models/post_list_posts.py | 7 +- .../models/post_list_with_search_matches.py | 7 +- .../post_list_with_search_matches_matches.py | 8 +- .../post_list_with_search_matches_posts.py | 7 +- .../models/post_log_json_body.py | 7 +- .../models/post_log_response_200.py | 8 +- .../models/post_metadata.py | 7 +- .../models/post_metadata_embeds_item.py | 7 +- .../models/post_metadata_embeds_item_data.py | 8 +- .../models/post_metadata_images.py | 8 +- .../models/post_metadata_priority.py | 7 +- .../models/post_props.py | 8 +- ...r_recent_custom_status_delete_json_body.py | 7 +- .../models/posts_usage.py | 7 +- .../models/preference.py | 7 +- .../models/product.py | 7 +- .../models/product_limits.py | 7 +- .../models/publish_user_typing_json_body.py | 7 +- .../models/push_notification.py | 7 +- .../models/reaction.py | 7 +- .../regen_command_token_response_200.py | 7 +- ...ister_terms_of_service_action_json_body.py | 7 +- .../models/relational_integrity_check_data.py | 7 +- .../models/remote_cluster_info.py | 7 +- .../remove_recent_custom_status_json_body.py | 7 +- .../models/reoder_checklist_item_json_body.py | 7 +- .../models/request_trial_license_json_body.py | 7 +- .../models/reset_password_json_body.py | 7 +- ...reset_saml_auth_data_to_email_json_body.py | 7 +- ...et_saml_auth_data_to_email_response_200.py | 7 +- .../retention_policy_for_channel_list.py | 7 +- .../models/retention_policy_for_team_list.py | 7 +- .../models/revoke_session_json_body.py | 7 +- .../revoke_user_access_token_json_body.py | 7 +- .../models/role.py | 7 +- .../models/saml_certificate_status.py | 7 +- .../models/scheme.py | 7 +- .../models/search_all_channels_json_body.py | 7 +- .../search_all_channels_response_200.py | 7 +- .../search_archived_channels_json_body.py | 7 +- ...channels_for_retention_policy_json_body.py | 7 +- .../models/search_channels_json_body.py | 7 +- .../models/search_emoji_json_body.py | 7 +- .../models/search_files_multipart_data.py | 7 +- .../models/search_group_channels_json_body.py | 7 +- .../models/search_posts_json_body.py | 7 +- ...ch_teams_for_retention_policy_json_body.py | 7 +- .../models/search_teams_json_body.py | 7 +- .../models/search_teams_response_200.py | 7 +- .../search_user_access_tokens_json_body.py | 7 +- .../models/search_users_json_body.py | 7 +- .../send_password_reset_email_json_body.py | 7 +- .../send_verification_email_json_body.py | 7 +- .../models/send_warn_metric_ack_json_body.py | 7 +- .../models/server_busy.py | 7 +- .../models/session.py | 7 +- .../models/session_props.py | 8 +- .../set_bot_icon_image_multipart_data.py | 7 +- .../models/set_post_reminder_json_body.py | 7 +- .../set_profile_image_multipart_data.py | 7 +- .../models/set_team_icon_multipart_data.py | 7 +- .../models/shared_channel.py | 7 +- .../models/sidebar_category.py | 7 +- .../models/sidebar_category_with_channels.py | 7 +- .../models/slack_attachment.py | 7 +- .../models/slack_attachment_field.py | 7 +- .../models/status.py | 7 +- .../models/status_json_body.py | 7 +- .../models/status_ok.py | 7 +- .../models/storage_usage.py | 7 +- .../submit_interactive_dialog_json_body.py | 7 +- ...interactive_dialog_json_body_submission.py | 8 +- .../models/subscription.py | 7 +- .../models/subscription_stats.py | 7 +- .../models/switch_account_type_json_body.py | 7 +- .../switch_account_type_response_200.py | 7 +- .../models/system.py | 7 +- .../models/system_status_response.py | 7 +- .../models/team.py | 7 +- .../models/team_exists.py | 7 +- .../models/team_map.py | 7 +- .../models/team_member.py | 7 +- .../models/team_stats.py | 7 +- .../models/team_unread.py | 7 +- .../models/teams_limits.py | 7 +- .../models/terms_of_service.py | 7 +- .../models/test_site_url_json_body.py | 7 +- .../models/timezone.py | 7 +- .../models/top_channel.py | 98 ------ .../models/top_channel_list.py | 82 ----- .../models/top_dm.py | 86 ------ .../models/top_dm_insight_user_information.py | 113 ------- .../models/top_dm_list.py | 82 ----- .../models/top_reaction.py | 65 ---- .../models/top_reaction_list.py | 82 ----- .../models/top_thread.py | 123 -------- .../models/top_thread_list.py | 82 ----- .../models/trigger_id_return.py | 7 +- .../models/update_channel_json_body.py | 7 +- ...e_channel_member_scheme_roles_json_body.py | 7 +- .../update_channel_privacy_json_body.py | 7 +- .../models/update_channel_roles_json_body.py | 7 +- .../models/update_channel_scheme_json_body.py | 7 +- .../models/update_cloud_customer_json_body.py | 7 +- .../update_incoming_webhook_json_body.py | 7 +- .../models/update_o_auth_app_json_body.py | 7 +- .../update_outgoing_webhook_json_body.py | 7 +- .../models/update_playbook_run_json_body.py | 7 +- .../models/update_post_json_body.py | 7 +- .../models/update_team_json_body.py | 7 +- .../update_team_member_roles_json_body.py | 7 +- ...date_team_member_scheme_roles_json_body.py | 7 +- .../models/update_team_privacy_json_body.py | 7 +- .../models/update_team_scheme_json_body.py | 7 +- .../models/update_user_active_json_body.py | 7 +- .../update_user_custom_status_json_body.py | 7 +- .../models/update_user_json_body.py | 7 +- .../models/update_user_json_body_props.py | 8 +- .../models/update_user_mfa_json_body.py | 7 +- .../models/update_user_password_json_body.py | 7 +- .../models/update_user_roles_json_body.py | 7 +- .../models/update_user_status_json_body.py | 7 +- ...grade_to_enterprise_status_response_200.py | 7 +- .../upload_brand_image_multipart_data.py | 7 +- .../models/upload_data_data.py | 8 +- .../models/upload_file_multipart_data.py | 7 +- .../models/upload_file_response_201.py | 7 +- ...ldap_private_certificate_multipart_data.py | 7 +- ..._ldap_public_certificate_multipart_data.py | 7 +- .../upload_license_file_multipart_data.py | 7 +- .../models/upload_plugin_multipart_data.py | 7 +- ...oad_saml_idp_certificate_multipart_data.py | 7 +- ...saml_private_certificate_multipart_data.py | 7 +- ..._saml_public_certificate_multipart_data.py | 7 +- .../models/upload_session.py | 7 +- .../models/user.py | 7 +- .../models/user_access_token.py | 7 +- .../models/user_access_token_sanitized.py | 7 +- .../models/user_auth_data.py | 7 +- .../models/user_autocomplete.py | 7 +- .../models/user_autocomplete_in_channel.py | 7 +- .../models/user_autocomplete_in_team.py | 7 +- .../models/user_notify_props.py | 7 +- .../models/user_props.py | 8 +- .../models/user_terms_of_service.py | 7 +- .../models/user_thread.py | 7 +- .../models/user_threads.py | 7 +- .../models/users_stats.py | 7 +- .../models/verify_user_email_json_body.py | 7 +- .../models/view_channel_json_body.py | 7 +- .../models/view_channel_response_200.py | 7 +- ...annel_response_200_last_viewed_at_times.py | 8 +- .../models/webhook_on_creation_payload.py | 7 +- .../webhook_on_status_update_payload.py | 7 +- mattermost_api_reference_client/types.py | 6 +- 837 files changed, 9142 insertions(+), 14574 deletions(-) create mode 100644 mattermost_api_reference_client/api/groups/restore_group.py delete mode 100644 mattermost_api_reference_client/api/insights/__init__.py delete mode 100644 mattermost_api_reference_client/api/insights/get_new_team_members.py delete mode 100644 mattermost_api_reference_client/api/insights/get_top_channels_for_team.py delete mode 100644 mattermost_api_reference_client/api/insights/get_top_channels_for_user.py delete mode 100644 mattermost_api_reference_client/api/insights/get_top_reactions_for_team.py delete mode 100644 mattermost_api_reference_client/api/insights/get_top_reactions_for_user.py delete mode 100644 mattermost_api_reference_client/api/insights/get_top_threads_for_team.py delete mode 100644 mattermost_api_reference_client/api/insights/get_top_threads_for_user.py create mode 100644 mattermost_api_reference_client/api/ldap/add_user_to_group_syncables.py rename mattermost_api_reference_client/api/{insights/get_top_d_ms_for_user.py => users/get_users_with_invalid_emails.py} (60%) delete mode 100644 mattermost_api_reference_client/models/insight_user_information.py delete mode 100644 mattermost_api_reference_client/models/top_channel.py delete mode 100644 mattermost_api_reference_client/models/top_channel_list.py delete mode 100644 mattermost_api_reference_client/models/top_dm.py delete mode 100644 mattermost_api_reference_client/models/top_dm_insight_user_information.py delete mode 100644 mattermost_api_reference_client/models/top_dm_list.py delete mode 100644 mattermost_api_reference_client/models/top_reaction.py delete mode 100644 mattermost_api_reference_client/models/top_reaction_list.py delete mode 100644 mattermost_api_reference_client/models/top_thread.py delete mode 100644 mattermost_api_reference_client/models/top_thread_list.py diff --git a/mattermost_api_reference_client/api/bleve/purge_bleve_indexes.py b/mattermost_api_reference_client/api/bleve/purge_bleve_indexes.py index a655fcf..934d039 100644 --- a/mattermost_api_reference_client/api/bleve/purge_bleve_indexes.py +++ b/mattermost_api_reference_client/api/bleve/purge_bleve_indexes.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/bleve/purge_indexes".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bleve/purge_indexes", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -45,7 +37,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -56,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Purge all Bleve indexes @@ -74,12 +68,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -88,7 +79,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Purge all Bleve indexes @@ -113,7 +104,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Purge all Bleve indexes @@ -131,19 +122,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Purge all Bleve indexes diff --git a/mattermost_api_reference_client/api/bots/assign_bot.py b/mattermost_api_reference_client/api/bots/assign_bot.py index 99ce12a..dc8ee4d 100644 --- a/mattermost_api_reference_client/api/bots/assign_bot.py +++ b/mattermost_api_reference_client/api/bots/assign_bot.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( bot_user_id: str, user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/assign/{user_id}".format( - client.base_url, bot_user_id=bot_user_id, user_id=user_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/assign/{user_id}".format( + bot_user_id=bot_user_id, + user_id=user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Bot]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Bot]]: if response.status_code == HTTPStatus.OK: response_200 = Bot.from_dict(response.json()) @@ -52,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Bot]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Bot]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +61,7 @@ def sync_detailed( bot_user_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Bot]]: """Assign a bot to a user @@ -89,11 +85,9 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, user_id=user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +98,7 @@ def sync( bot_user_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Bot]]: """Assign a bot to a user @@ -136,7 +130,7 @@ async def asyncio_detailed( bot_user_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Bot]]: """Assign a bot to a user @@ -160,11 +154,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, user_id=user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -173,7 +165,7 @@ async def asyncio( bot_user_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Bot]]: """Assign a bot to a user diff --git a/mattermost_api_reference_client/api/bots/convert_bot_to_user.py b/mattermost_api_reference_client/api/bots/convert_bot_to_user.py index 4e96830..21ebf95 100644 --- a/mattermost_api_reference_client/api/bots/convert_bot_to_user.py +++ b/mattermost_api_reference_client/api/bots/convert_bot_to_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.convert_bot_to_user_json_body import ConvertBotToUserJsonBody from ...models.status_ok import StatusOK from ...types import UNSET, Response, Unset @@ -13,14 +13,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( bot_user_id: str, *, - client: Client, json_body: ConvertBotToUserJsonBody, set_system_admin: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/convert_to_user".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["set_system_admin"] = set_system_admin @@ -31,17 +27,17 @@ def _get_kwargs( return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/convert_to_user".format( + bot_user_id=bot_user_id, + ), "json": json_json_body, "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -64,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +74,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ConvertBotToUserJsonBody, set_system_admin: Union[Unset, None, bool] = False, ) -> Response[Union[Any, StatusOK]]: @@ -104,13 +102,11 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, json_body=json_body, set_system_admin=set_system_admin, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -120,7 +116,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ConvertBotToUserJsonBody, set_system_admin: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, StatusOK]]: @@ -157,7 +153,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ConvertBotToUserJsonBody, set_system_admin: Union[Unset, None, bool] = False, ) -> Response[Union[Any, StatusOK]]: @@ -185,13 +181,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, json_body=json_body, set_system_admin=set_system_admin, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -199,7 +193,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ConvertBotToUserJsonBody, set_system_admin: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, StatusOK]]: diff --git a/mattermost_api_reference_client/api/bots/convert_user_to_bot.py b/mattermost_api_reference_client/api/bots/convert_user_to_bot.py index 7a84b87..324d2b3 100644 --- a/mattermost_api_reference_client/api/bots/convert_user_to_bot.py +++ b/mattermost_api_reference_client/api/bots/convert_user_to_bot.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/convert_to_bot".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/convert_to_bot".format( + user_id=user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Convert a user into a bot @@ -88,11 +85,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +97,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Convert a user into a bot @@ -133,7 +128,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Convert a user into a bot @@ -157,11 +152,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -169,7 +162,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Convert a user into a bot diff --git a/mattermost_api_reference_client/api/bots/create_bot.py b/mattermost_api_reference_client/api/bots/create_bot.py index 40d23ce..10575e4 100644 --- a/mattermost_api_reference_client/api/bots/create_bot.py +++ b/mattermost_api_reference_client/api/bots/create_bot.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...models.create_bot_json_body import CreateBotJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreateBotJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/bots".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Bot]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Bot]]: if response.status_code == HTTPStatus.CREATED: response_201 = Bot.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Bot]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Bot]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +60,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateBotJsonBody, ) -> Response[Union[Any, Bot]]: """Create a bot @@ -86,12 +82,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +94,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateBotJsonBody, ) -> Optional[Union[Any, Bot]]: """Create a bot @@ -129,7 +123,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateBotJsonBody, ) -> Response[Union[Any, Bot]]: """Create a bot @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateBotJsonBody, ) -> Optional[Union[Any, Bot]]: """Create a bot diff --git a/mattermost_api_reference_client/api/bots/delete_bot_icon_image.py b/mattermost_api_reference_client/api/bots/delete_bot_icon_image.py index dc18e0c..4d43303 100644 --- a/mattermost_api_reference_client/api/bots/delete_bot_icon_image.py +++ b/mattermost_api_reference_client/api/bots/delete_bot_icon_image.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( bot_user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/icon".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/icon".format( + bot_user_id=bot_user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -58,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete bot's LHS icon image @@ -92,11 +89,9 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +101,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete bot's LHS icon image @@ -135,7 +130,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete bot's LHS icon image @@ -157,11 +152,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -169,7 +162,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete bot's LHS icon image diff --git a/mattermost_api_reference_client/api/bots/disable_bot.py b/mattermost_api_reference_client/api/bots/disable_bot.py index fd72116..314987f 100644 --- a/mattermost_api_reference_client/api/bots/disable_bot.py +++ b/mattermost_api_reference_client/api/bots/disable_bot.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...types import Response def _get_kwargs( bot_user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/disable".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/disable".format( + bot_user_id=bot_user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Bot]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Bot]]: if response.status_code == HTTPStatus.OK: response_200 = Bot.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Bot]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Bot]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Bot]]: """Disable a bot @@ -83,11 +80,9 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +92,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Bot]]: """Disable a bot @@ -126,7 +121,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Bot]]: """Disable a bot @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Bot]]: """Disable a bot diff --git a/mattermost_api_reference_client/api/bots/enable_bot.py b/mattermost_api_reference_client/api/bots/enable_bot.py index 93febd2..9cefa47 100644 --- a/mattermost_api_reference_client/api/bots/enable_bot.py +++ b/mattermost_api_reference_client/api/bots/enable_bot.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...types import Response def _get_kwargs( bot_user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/enable".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/enable".format( + bot_user_id=bot_user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Bot]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Bot]]: if response.status_code == HTTPStatus.OK: response_200 = Bot.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Bot]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Bot]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Bot]]: """Enable a bot @@ -83,11 +80,9 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +92,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Bot]]: """Enable a bot @@ -126,7 +121,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Bot]]: """Enable a bot @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Bot]]: """Enable a bot diff --git a/mattermost_api_reference_client/api/bots/get_bot.py b/mattermost_api_reference_client/api/bots/get_bot.py index 4a2bdc8..09626c9 100644 --- a/mattermost_api_reference_client/api/bots/get_bot.py +++ b/mattermost_api_reference_client/api/bots/get_bot.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...types import UNSET, Response, Unset @@ -12,13 +12,9 @@ from ...types import UNSET, Response, Unset def _get_kwargs( bot_user_id: str, *, - client: Client, include_deleted: Union[Unset, None, bool] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_deleted"] = include_deleted @@ -27,16 +23,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}".format( + bot_user_id=bot_user_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Bot]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Bot]]: if response.status_code == HTTPStatus.OK: response_200 = Bot.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Bot]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Bot]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = UNSET, ) -> Response[Union[Any, Bot]]: """Get a bot @@ -93,12 +91,10 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = UNSET, ) -> Optional[Union[Any, Bot]]: """Get a bot @@ -141,7 +137,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = UNSET, ) -> Response[Union[Any, Bot]]: """Get a bot @@ -166,12 +162,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -179,7 +173,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = UNSET, ) -> Optional[Union[Any, Bot]]: """Get a bot diff --git a/mattermost_api_reference_client/api/bots/get_bot_icon_image.py b/mattermost_api_reference_client/api/bots/get_bot_icon_image.py index 3edcdfd..b1ff464 100644 --- a/mattermost_api_reference_client/api/bots/get_bot_icon_image.py +++ b/mattermost_api_reference_client/api/bots/get_bot_icon_image.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( bot_user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/icon".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/icon".format( + bot_user_id=bot_user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -49,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +54,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get bot's LHS icon @@ -83,11 +76,9 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +88,7 @@ def sync_detailed( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get bot's LHS icon @@ -119,10 +110,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/bots/get_bots.py b/mattermost_api_reference_client/api/bots/get_bots.py index 26e1dae..ac5d688 100644 --- a/mattermost_api_reference_client/api/bots/get_bots.py +++ b/mattermost_api_reference_client/api/bots/get_bots.py @@ -4,23 +4,19 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, include_deleted: Union[Unset, None, bool] = UNSET, only_orphaned: Union[Unset, None, bool] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/bots".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -35,16 +31,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Bot"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Bot"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -69,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Bot"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Bot"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -80,7 +76,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, include_deleted: Union[Unset, None, bool] = UNSET, @@ -109,15 +105,13 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, include_deleted=include_deleted, only_orphaned=only_orphaned, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -126,7 +120,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, include_deleted: Union[Unset, None, bool] = UNSET, @@ -165,7 +159,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, include_deleted: Union[Unset, None, bool] = UNSET, @@ -194,22 +188,20 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, include_deleted=include_deleted, only_orphaned=only_orphaned, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, include_deleted: Union[Unset, None, bool] = UNSET, diff --git a/mattermost_api_reference_client/api/bots/patch_bot.py b/mattermost_api_reference_client/api/bots/patch_bot.py index b5fc120..b04a0f2 100644 --- a/mattermost_api_reference_client/api/bots/patch_bot.py +++ b/mattermost_api_reference_client/api/bots/patch_bot.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.bot import Bot from ...models.patch_bot_json_body import PatchBotJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( bot_user_id: str, *, - client: Client, json_body: PatchBotJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}".format( + bot_user_id=bot_user_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Bot]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Bot]]: if response.status_code == HTTPStatus.OK: response_200 = Bot.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Bot]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Bot]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchBotJsonBody, ) -> Response[Union[Any, Bot]]: """Patch a bot @@ -92,12 +90,10 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +103,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchBotJsonBody, ) -> Optional[Union[Any, Bot]]: """Patch a bot @@ -141,7 +137,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchBotJsonBody, ) -> Response[Union[Any, Bot]]: """Patch a bot @@ -167,12 +163,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -180,7 +174,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchBotJsonBody, ) -> Optional[Union[Any, Bot]]: """Patch a bot diff --git a/mattermost_api_reference_client/api/bots/set_bot_icon_image.py b/mattermost_api_reference_client/api/bots/set_bot_icon_image.py index b7e991b..57ca469 100644 --- a/mattermost_api_reference_client/api/bots/set_bot_icon_image.py +++ b/mattermost_api_reference_client/api/bots/set_bot_icon_image.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.set_bot_icon_image_multipart_data import SetBotIconImageMultipartData from ...models.status_ok import StatusOK from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( bot_user_id: str, *, - client: Client, multipart_data: SetBotIconImageMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/bots/{bot_user_id}/icon".format(client.base_url, bot_user_id=bot_user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/bots/{bot_user_id}/icon".format( + bot_user_id=bot_user_id, + ), "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -63,7 +59,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,7 +73,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: SetBotIconImageMultipartData, ) -> Response[Union[Any, StatusOK]]: """Set bot's LHS icon image @@ -100,12 +98,10 @@ def sync_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -115,7 +111,7 @@ def sync_detailed( def sync( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: SetBotIconImageMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Set bot's LHS icon image @@ -148,7 +144,7 @@ def sync( async def asyncio_detailed( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: SetBotIconImageMultipartData, ) -> Response[Union[Any, StatusOK]]: """Set bot's LHS icon image @@ -173,12 +169,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( bot_user_id=bot_user_id, - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -186,7 +180,7 @@ async def asyncio_detailed( async def asyncio( bot_user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: SetBotIconImageMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Set bot's LHS icon image diff --git a/mattermost_api_reference_client/api/brand/delete_brand_image.py b/mattermost_api_reference_client/api/brand/delete_brand_image.py index 695fe10..9c9f68c 100644 --- a/mattermost_api_reference_client/api/brand/delete_brand_image.py +++ b/mattermost_api_reference_client/api/brand/delete_brand_image.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/brand/image".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/brand/image", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -48,7 +40,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +53,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete current brand image @@ -76,12 +70,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -90,7 +81,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete current brand image @@ -114,7 +105,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete current brand image @@ -131,19 +122,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete current brand image diff --git a/mattermost_api_reference_client/api/brand/get_brand_image.py b/mattermost_api_reference_client/api/brand/get_brand_image.py index 183821a..7b51c08 100644 --- a/mattermost_api_reference_client/api/brand/get_brand_image.py +++ b/mattermost_api_reference_client/api/brand/get_brand_image.py @@ -4,30 +4,22 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/brand/image".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/brand/image", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, str]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, str]]: if response.status_code == HTTPStatus.OK: response_200 = cast(str, response.json()) return response_200 @@ -43,7 +35,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, str]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, str]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -54,7 +48,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, str]]: """Get brand image @@ -70,12 +64,9 @@ def sync_detailed( Response[Union[Any, str]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -84,7 +75,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, str]]: """Get brand image @@ -107,7 +98,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, str]]: """Get brand image @@ -123,19 +114,16 @@ async def asyncio_detailed( Response[Union[Any, str]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, str]]: """Get brand image diff --git a/mattermost_api_reference_client/api/brand/upload_brand_image.py b/mattermost_api_reference_client/api/brand/upload_brand_image.py index d9c026c..cf6b3a9 100644 --- a/mattermost_api_reference_client/api/brand/upload_brand_image.py +++ b/mattermost_api_reference_client/api/brand/upload_brand_image.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.upload_brand_image_multipart_data import UploadBrandImageMultipartData from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, multipart_data: UploadBrandImageMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/brand/image".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/brand/image", "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.CREATED: response_201 = StatusOK.from_dict(response.json()) @@ -59,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadBrandImageMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload brand image @@ -91,12 +87,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,7 +99,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadBrandImageMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload brand image @@ -133,7 +127,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadBrandImageMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload brand image @@ -154,19 +148,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadBrandImageMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload brand image diff --git a/mattermost_api_reference_client/api/channels/add_channel_member.py b/mattermost_api_reference_client/api/channels/add_channel_member.py index 33a5a61..fe83431 100644 --- a/mattermost_api_reference_client/api/channels/add_channel_member.py +++ b/mattermost_api_reference_client/api/channels/add_channel_member.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.add_channel_member_json_body import AddChannelMemberJsonBody from ...models.channel_member import ChannelMember from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: AddChannelMemberJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ChannelMember]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ChannelMember]]: if response.status_code == HTTPStatus.CREATED: response_201 = ChannelMember.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ChannelMember]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ChannelMember]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddChannelMemberJsonBody, ) -> Response[Union[Any, ChannelMember]]: """Add user to channel @@ -87,12 +85,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +98,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddChannelMemberJsonBody, ) -> Optional[Union[Any, ChannelMember]]: """Add user to channel @@ -131,7 +127,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddChannelMemberJsonBody, ) -> Response[Union[Any, ChannelMember]]: """Add user to channel @@ -152,12 +148,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -165,7 +159,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddChannelMemberJsonBody, ) -> Optional[Union[Any, ChannelMember]]: """Add user to channel diff --git a/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team.py b/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team.py index 8aa2123..6a10085 100644 --- a/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team.py +++ b/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response @@ -12,13 +12,9 @@ from ...types import UNSET, Response def _get_kwargs( team_id: str, *, - client: Client, name: str, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/autocomplete".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["name"] = name @@ -27,16 +23,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/autocomplete".format( + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -64,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +74,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Response[Union[Any, List["Channel"]]]: """Autocomplete channels @@ -102,12 +100,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, name=name, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,7 +113,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Optional[Union[Any, List["Channel"]]]: """Autocomplete channels @@ -151,7 +147,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Response[Union[Any, List["Channel"]]]: """Autocomplete channels @@ -177,12 +173,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, name=name, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -190,7 +184,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Optional[Union[Any, List["Channel"]]]: """Autocomplete channels diff --git a/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team_for_search.py b/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team_for_search.py index 0dcc5b8..fb5b11b 100644 --- a/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team_for_search.py +++ b/mattermost_api_reference_client/api/channels/autocomplete_channels_for_team_for_search.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response @@ -12,13 +12,9 @@ from ...types import UNSET, Response def _get_kwargs( team_id: str, *, - client: Client, name: str, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/search_autocomplete".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["name"] = name @@ -27,16 +23,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/search_autocomplete".format( + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -64,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +74,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Response[Union[Any, List["Channel"]]]: """Autocomplete channels for search @@ -102,12 +100,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, name=name, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,7 +113,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Optional[Union[Any, List["Channel"]]]: """Autocomplete channels for search @@ -151,7 +147,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Response[Union[Any, List["Channel"]]]: """Autocomplete channels for search @@ -177,12 +173,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, name=name, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -190,7 +184,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Optional[Union[Any, List["Channel"]]]: """Autocomplete channels for search diff --git a/mattermost_api_reference_client/api/channels/channel_members_minus_group_members.py b/mattermost_api_reference_client/api/channels/channel_members_minus_group_members.py index 2eaa0c4..4ac8d62 100644 --- a/mattermost_api_reference_client/api/channels/channel_members_minus_group_members.py +++ b/mattermost_api_reference_client/api/channels/channel_members_minus_group_members.py @@ -4,22 +4,18 @@ from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import UNSET, Response, Unset def _get_kwargs( channel_id: str, *, - client: Client, group_ids: str = "", page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members_minus_group_members".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["group_ids"] = group_ids @@ -32,16 +28,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members_minus_group_members".format( + channel_id=channel_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -56,7 +50,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +62,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], group_ids: str = "", page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, @@ -103,14 +97,12 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, group_ids=group_ids, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -120,7 +112,7 @@ def sync_detailed( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], group_ids: str = "", page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, @@ -155,13 +147,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, group_ids=group_ids, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/channels/create_channel.py b/mattermost_api_reference_client/api/channels/create_channel.py index b59ec21..1283e81 100644 --- a/mattermost_api_reference_client/api/channels/create_channel.py +++ b/mattermost_api_reference_client/api/channels/create_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.create_channel_json_body import CreateChannelJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreateChannelJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.CREATED: response_201 = Channel.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +60,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Create a channel @@ -86,12 +82,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +94,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Create a channel @@ -129,7 +123,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Create a channel @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Create a channel diff --git a/mattermost_api_reference_client/api/channels/create_direct_channel.py b/mattermost_api_reference_client/api/channels/create_direct_channel.py index 16cf699..6f13021 100644 --- a/mattermost_api_reference_client/api/channels/create_direct_channel.py +++ b/mattermost_api_reference_client/api/channels/create_direct_channel.py @@ -4,35 +4,29 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import Response def _get_kwargs( *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/channels/direct".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/direct", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.CREATED: response_201 = Channel.from_dict(response.json()) @@ -52,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +59,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, Channel]]: """Create a direct message channel @@ -85,12 +81,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +93,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, Channel]]: """Create a direct message channel @@ -128,7 +122,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, Channel]]: """Create a direct message channel @@ -150,19 +144,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, Channel]]: """Create a direct message channel diff --git a/mattermost_api_reference_client/api/channels/create_group_channel.py b/mattermost_api_reference_client/api/channels/create_group_channel.py index 79b9b47..73c94a1 100644 --- a/mattermost_api_reference_client/api/channels/create_group_channel.py +++ b/mattermost_api_reference_client/api/channels/create_group_channel.py @@ -4,35 +4,29 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import Response def _get_kwargs( *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/channels/group".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/group", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.CREATED: response_201 = Channel.from_dict(response.json()) @@ -52,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +59,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, Channel]]: """Create a group message channel @@ -85,12 +81,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +93,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, Channel]]: """Create a group message channel @@ -128,7 +122,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, Channel]]: """Create a group message channel @@ -150,19 +144,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, Channel]]: """Create a group message channel diff --git a/mattermost_api_reference_client/api/channels/create_sidebar_category_for_team_for_user.py b/mattermost_api_reference_client/api/channels/create_sidebar_category_for_team_for_user.py index 0e51fa2..f424555 100644 --- a/mattermost_api_reference_client/api/channels/create_sidebar_category_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/create_sidebar_category_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.sidebar_category import SidebarCategory from ...types import Response @@ -13,30 +13,25 @@ def _get_kwargs( user_id: str, team_id: str, *, - client: Client, json_body: SidebarCategory, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories".format( - client.base_url, user_id=user_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories".format( + user_id=user_id, + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SidebarCategory]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, SidebarCategory]]: if response.status_code == HTTPStatus.OK: response_200 = SidebarCategory.from_dict(response.json()) @@ -59,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SidebarCategory]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, SidebarCategory]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +69,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Response[Union[Any, SidebarCategory]]: """Create user's sidebar category @@ -98,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -114,7 +109,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Optional[Union[Any, SidebarCategory]]: """Create user's sidebar category @@ -149,7 +144,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Response[Union[Any, SidebarCategory]]: """Create user's sidebar category @@ -175,12 +170,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -189,7 +182,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Optional[Union[Any, SidebarCategory]]: """Create user's sidebar category diff --git a/mattermost_api_reference_client/api/channels/delete_channel.py b/mattermost_api_reference_client/api/channels/delete_channel.py index da3f3e7..2b9d02c 100644 --- a/mattermost_api_reference_client/api/channels/delete_channel.py +++ b/mattermost_api_reference_client/api/channels/delete_channel.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a channel @@ -93,11 +90,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +102,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a channel @@ -146,7 +141,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a channel @@ -178,11 +173,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -190,7 +183,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a channel diff --git a/mattermost_api_reference_client/api/channels/get_all_channels.py b/mattermost_api_reference_client/api/channels/get_all_channels.py index 5461369..d9b11e0 100644 --- a/mattermost_api_reference_client/api/channels/get_all_channels.py +++ b/mattermost_api_reference_client/api/channels/get_all_channels.py @@ -4,14 +4,13 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_with_team_data import ChannelWithTeamData from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, not_associated_to_group: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, @@ -20,10 +19,7 @@ def _get_kwargs( include_total_count: Union[Unset, None, bool] = False, exclude_policy_constrained: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/channels".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["not_associated_to_group"] = not_associated_to_group @@ -44,16 +40,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -80,7 +74,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelWithTeamData"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelWithTeamData"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -91,7 +87,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], not_associated_to_group: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, @@ -123,7 +119,6 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, not_associated_to_group=not_associated_to_group, page=page, per_page=per_page, @@ -133,8 +128,7 @@ def sync_detailed( exclude_policy_constrained=exclude_policy_constrained, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -143,7 +137,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], not_associated_to_group: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, @@ -188,7 +182,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], not_associated_to_group: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, @@ -220,7 +214,6 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, not_associated_to_group=not_associated_to_group, page=page, per_page=per_page, @@ -230,15 +223,14 @@ async def asyncio_detailed( exclude_policy_constrained=exclude_policy_constrained, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], not_associated_to_group: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 0, diff --git a/mattermost_api_reference_client/api/channels/get_channel.py b/mattermost_api_reference_client/api/channels/get_channel.py index 76eb9e0..8a2f816 100644 --- a/mattermost_api_reference_client/api/channels/get_channel.py +++ b/mattermost_api_reference_client/api/channels/get_channel.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Channel]]: """Get a channel @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Channel]]: """Get a channel @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Channel]]: """Get a channel @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Channel]]: """Get a channel diff --git a/mattermost_api_reference_client/api/channels/get_channel_by_name.py b/mattermost_api_reference_client/api/channels/get_channel_by_name.py index c9e9ec1..c50fff9 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_by_name.py +++ b/mattermost_api_reference_client/api/channels/get_channel_by_name.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -13,15 +13,9 @@ def _get_kwargs( team_id: str, channel_name: str, *, - client: Client, include_deleted: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/name/{channel_name}".format( - client.base_url, team_id=team_id, channel_name=channel_name - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_deleted"] = include_deleted @@ -30,16 +24,17 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/name/{channel_name}".format( + team_id=team_id, + channel_name=channel_name, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -59,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +69,7 @@ def sync_detailed( team_id: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, Channel]]: """Get a channel by name @@ -97,12 +94,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, channel_name=channel_name, - client=client, include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +108,7 @@ def sync( team_id: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, Channel]]: """Get a channel by name @@ -147,7 +142,7 @@ async def asyncio_detailed( team_id: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, Channel]]: """Get a channel by name @@ -172,12 +167,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, channel_name=channel_name, - client=client, include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -186,7 +179,7 @@ async def asyncio( team_id: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, Channel]]: """Get a channel by name diff --git a/mattermost_api_reference_client/api/channels/get_channel_by_name_for_team_name.py b/mattermost_api_reference_client/api/channels/get_channel_by_name_for_team_name.py index 7128187..7eb621f 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_by_name_for_team_name.py +++ b/mattermost_api_reference_client/api/channels/get_channel_by_name_for_team_name.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -13,15 +13,9 @@ def _get_kwargs( team_name: str, channel_name: str, *, - client: Client, include_deleted: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/name/{team_name}/channels/name/{channel_name}".format( - client.base_url, team_name=team_name, channel_name=channel_name - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_deleted"] = include_deleted @@ -30,16 +24,17 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/name/{team_name}/channels/name/{channel_name}".format( + team_name=team_name, + channel_name=channel_name, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -59,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +69,7 @@ def sync_detailed( team_name: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, Channel]]: """Get a channel by name and team name @@ -97,12 +94,10 @@ def sync_detailed( kwargs = _get_kwargs( team_name=team_name, channel_name=channel_name, - client=client, include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +108,7 @@ def sync( team_name: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, Channel]]: """Get a channel by name and team name @@ -147,7 +142,7 @@ async def asyncio_detailed( team_name: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, Channel]]: """Get a channel by name and team name @@ -172,12 +167,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_name=team_name, channel_name=channel_name, - client=client, include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -186,7 +179,7 @@ async def asyncio( team_name: str, channel_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, Channel]]: """Get a channel by name and team name diff --git a/mattermost_api_reference_client/api/channels/get_channel_member.py b/mattermost_api_reference_client/api/channels/get_channel_member.py index d661878..c858ab1 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_member.py +++ b/mattermost_api_reference_client/api/channels/get_channel_member.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_member import ChannelMember from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( channel_id: str, user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members/{user_id}".format( - client.base_url, channel_id=channel_id, user_id=user_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members/{user_id}".format( + channel_id=channel_id, + user_id=user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ChannelMember]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ChannelMember]]: if response.status_code == HTTPStatus.OK: response_200 = ChannelMember.from_dict(response.json()) @@ -52,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ChannelMember]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ChannelMember]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +61,7 @@ def sync_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelMember]]: """Get channel member @@ -88,11 +84,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +97,7 @@ def sync( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelMember]]: """Get channel member @@ -134,7 +128,7 @@ async def asyncio_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelMember]]: """Get channel member @@ -157,11 +151,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -170,7 +162,7 @@ async def asyncio( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelMember]]: """Get channel member diff --git a/mattermost_api_reference_client/api/channels/get_channel_member_counts_by_group.py b/mattermost_api_reference_client/api/channels/get_channel_member_counts_by_group.py index a7d0321..30e02af 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_member_counts_by_group.py +++ b/mattermost_api_reference_client/api/channels/get_channel_member_counts_by_group.py @@ -4,20 +4,16 @@ from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import UNSET, Response, Unset def _get_kwargs( channel_id: str, *, - client: Client, include_timezones: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/member_counts_by_group".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_timezones"] = include_timezones @@ -26,16 +22,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/member_counts_by_group".format( + channel_id=channel_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -50,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +56,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_timezones: Union[Unset, None, bool] = False, ) -> Response[Any]: """Channel members counts for each group that has atleast one member in the channel @@ -87,12 +81,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, include_timezones=include_timezones, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +94,7 @@ def sync_detailed( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_timezones: Union[Unset, None, bool] = False, ) -> Response[Any]: """Channel members counts for each group that has atleast one member in the channel @@ -127,11 +119,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, include_timezones=include_timezones, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/channels/get_channel_members.py b/mattermost_api_reference_client/api/channels/get_channel_members.py index f9cd576..43cfd04 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_members.py +++ b/mattermost_api_reference_client/api/channels/get_channel_members.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_member import ChannelMember from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( channel_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members".format( + channel_id=channel_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelMember"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelMember"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -64,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelMember"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelMember"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +74,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["ChannelMember"]]]: @@ -101,13 +99,11 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,7 +113,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["ChannelMember"]]]: @@ -151,7 +147,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["ChannelMember"]]]: @@ -176,13 +172,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -190,7 +184,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["ChannelMember"]]]: diff --git a/mattermost_api_reference_client/api/channels/get_channel_members_by_ids.py b/mattermost_api_reference_client/api/channels/get_channel_members_by_ids.py index bf20106..79b27c1 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_members_by_ids.py +++ b/mattermost_api_reference_client/api/channels/get_channel_members_by_ids.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_member import ChannelMember from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members/ids".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members/ids".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelMember"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelMember"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -61,7 +57,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelMember"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelMember"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,7 +71,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List["ChannelMember"]]]: """Get channel members by ids @@ -96,12 +94,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +107,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List["ChannelMember"]]]: """Get channel members by ids @@ -142,7 +138,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List["ChannelMember"]]]: """Get channel members by ids @@ -165,12 +161,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -178,7 +172,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List["ChannelMember"]]]: """Get channel members by ids diff --git a/mattermost_api_reference_client/api/channels/get_channel_members_for_user.py b/mattermost_api_reference_client/api/channels/get_channel_members_for_user.py index e3253d2..ef994d6 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_members_for_user.py +++ b/mattermost_api_reference_client/api/channels/get_channel_members_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_member import ChannelMember from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( user_id: str, team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/members".format( - client.base_url, user_id=user_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/members".format( + user_id=user_id, + team_id=team_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelMember"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelMember"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -57,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelMember"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelMember"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +66,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["ChannelMember"]]]: """Get channel memberships and roles for a user @@ -95,11 +91,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +104,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["ChannelMember"]]]: """Get channel memberships and roles for a user @@ -143,7 +137,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["ChannelMember"]]]: """Get channel memberships and roles for a user @@ -168,11 +162,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -181,7 +173,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["ChannelMember"]]]: """Get channel memberships and roles for a user diff --git a/mattermost_api_reference_client/api/channels/get_channel_members_timezones.py b/mattermost_api_reference_client/api/channels/get_channel_members_timezones.py index 430a531..7c64ba1 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_members_timezones.py +++ b/mattermost_api_reference_client/api/channels/get_channel_members_timezones.py @@ -4,31 +4,26 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/timezones".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/timezones".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List[str]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List[str]]]: if response.status_code == HTTPStatus.OK: response_200 = cast(List[str], response.json()) @@ -48,7 +43,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List[str]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List[str]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +57,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List[str]]]: """Get timezones in a channel @@ -84,11 +81,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -98,7 +93,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List[str]]]: """Get timezones in a channel @@ -129,7 +124,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List[str]]]: """Get timezones in a channel @@ -153,11 +148,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -165,7 +158,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List[str]]]: """Get timezones in a channel diff --git a/mattermost_api_reference_client/api/channels/get_channel_moderations.py b/mattermost_api_reference_client/api/channels/get_channel_moderations.py index afebd53..6079098 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_moderations.py +++ b/mattermost_api_reference_client/api/channels/get_channel_moderations.py @@ -4,32 +4,27 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_moderation import ChannelModeration from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/moderations".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/moderations".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelModeration"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelModeration"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -54,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelModeration"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelModeration"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["ChannelModeration"]]]: """Get information about channel's moderation. @@ -88,11 +85,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +97,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["ChannelModeration"]]]: """Get information about channel's moderation. @@ -131,7 +126,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["ChannelModeration"]]]: """Get information about channel's moderation. @@ -153,11 +148,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -165,7 +158,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["ChannelModeration"]]]: """Get information about channel's moderation. diff --git a/mattermost_api_reference_client/api/channels/get_channel_stats.py b/mattermost_api_reference_client/api/channels/get_channel_stats.py index da70c12..d25b701 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_stats.py +++ b/mattermost_api_reference_client/api/channels/get_channel_stats.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_stats import ChannelStats from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/stats".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/stats".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ChannelStats]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ChannelStats]]: if response.status_code == HTTPStatus.OK: response_200 = ChannelStats.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ChannelStats]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ChannelStats]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelStats]]: """Get channel statistics @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelStats]]: """Get channel statistics @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelStats]]: """Get channel statistics @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelStats]]: """Get channel statistics diff --git a/mattermost_api_reference_client/api/channels/get_channel_unread.py b/mattermost_api_reference_client/api/channels/get_channel_unread.py index bc270f5..7f15026 100644 --- a/mattermost_api_reference_client/api/channels/get_channel_unread.py +++ b/mattermost_api_reference_client/api/channels/get_channel_unread.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_unread import ChannelUnread from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( user_id: str, channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/channels/{channel_id}/unread".format( - client.base_url, user_id=user_id, channel_id=channel_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/channels/{channel_id}/unread".format( + user_id=user_id, + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ChannelUnread]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ChannelUnread]]: if response.status_code == HTTPStatus.OK: response_200 = ChannelUnread.from_dict(response.json()) @@ -55,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ChannelUnread]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ChannelUnread]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +64,7 @@ def sync_detailed( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelUnread]]: """Get unread messages @@ -92,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +101,7 @@ def sync( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelUnread]]: """Get unread messages @@ -139,7 +133,7 @@ async def asyncio_detailed( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelUnread]]: """Get unread messages @@ -163,11 +157,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -176,7 +168,7 @@ async def asyncio( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelUnread]]: """Get unread messages diff --git a/mattermost_api_reference_client/api/channels/get_channels_for_team_for_user.py b/mattermost_api_reference_client/api/channels/get_channels_for_team_for_user.py index 5a51692..57e4648 100644 --- a/mattermost_api_reference_client/api/channels/get_channels_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/get_channels_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -13,14 +13,10 @@ def _get_kwargs( user_id: str, team_id: str, *, - client: Client, include_deleted: Union[Unset, None, bool] = False, last_delete_at: Union[Unset, None, int] = 0, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels".format(client.base_url, user_id=user_id, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_deleted"] = include_deleted @@ -31,16 +27,17 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels".format( + user_id=user_id, + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -68,7 +65,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,7 +80,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, last_delete_at: Union[Unset, None, int] = 0, ) -> Response[Union[Any, List["Channel"]]]: @@ -109,13 +108,11 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, include_deleted=include_deleted, last_delete_at=last_delete_at, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -126,7 +123,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, last_delete_at: Union[Unset, None, int] = 0, ) -> Optional[Union[Any, List["Channel"]]]: @@ -164,7 +161,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, last_delete_at: Union[Unset, None, int] = 0, ) -> Response[Union[Any, List["Channel"]]]: @@ -192,13 +189,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, include_deleted=include_deleted, last_delete_at=last_delete_at, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -207,7 +202,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, last_delete_at: Union[Unset, None, int] = 0, ) -> Optional[Union[Any, List["Channel"]]]: diff --git a/mattermost_api_reference_client/api/channels/get_channels_for_user.py b/mattermost_api_reference_client/api/channels/get_channels_for_user.py index 18c250a..a121a60 100644 --- a/mattermost_api_reference_client/api/channels/get_channels_for_user.py +++ b/mattermost_api_reference_client/api/channels/get_channels_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( user_id: str, *, - client: Client, last_delete_at: Union[Unset, None, int] = 0, include_deleted: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/channels".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["last_delete_at"] = last_delete_at @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/channels".format( + user_id=user_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -67,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +77,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], last_delete_at: Union[Unset, None, int] = 0, include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, List["Channel"]]]: @@ -108,13 +106,11 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, last_delete_at=last_delete_at, include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -124,7 +120,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], last_delete_at: Union[Unset, None, int] = 0, include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, List["Channel"]]]: @@ -162,7 +158,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], last_delete_at: Union[Unset, None, int] = 0, include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, List["Channel"]]]: @@ -191,13 +187,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, last_delete_at=last_delete_at, include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -205,7 +199,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], last_delete_at: Union[Unset, None, int] = 0, include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, List["Channel"]]]: diff --git a/mattermost_api_reference_client/api/channels/get_deleted_channels_for_team.py b/mattermost_api_reference_client/api/channels/get_deleted_channels_for_team.py index 23871ed..47641ac 100644 --- a/mattermost_api_reference_client/api/channels/get_deleted_channels_for_team.py +++ b/mattermost_api_reference_client/api/channels/get_deleted_channels_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( team_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/deleted".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/deleted".format( + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -67,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +77,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Channel"]]]: @@ -105,13 +103,11 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -121,7 +117,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Channel"]]]: @@ -156,7 +152,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Channel"]]]: @@ -182,13 +178,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -196,7 +190,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Channel"]]]: diff --git a/mattermost_api_reference_client/api/channels/get_pinned_posts.py b/mattermost_api_reference_client/api/channels/get_pinned_posts.py index f037dd3..629052c 100644 --- a/mattermost_api_reference_client/api/channels/get_pinned_posts.py +++ b/mattermost_api_reference_client/api/channels/get_pinned_posts.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post_list import PostList from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/pinned".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/pinned".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PostList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PostList]]: if response.status_code == HTTPStatus.OK: response_200 = PostList.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PostList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PostList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, PostList]]: """Get a channel's pinned posts @@ -80,11 +77,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -94,7 +89,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, PostList]]: """Get a channel's pinned posts @@ -120,7 +115,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, PostList]]: """Get a channel's pinned posts @@ -139,11 +134,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -151,7 +144,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, PostList]]: """Get a channel's pinned posts diff --git a/mattermost_api_reference_client/api/channels/get_private_channels_for_team.py b/mattermost_api_reference_client/api/channels/get_private_channels_for_team.py index fb43d7f..1e58e48 100644 --- a/mattermost_api_reference_client/api/channels/get_private_channels_for_team.py +++ b/mattermost_api_reference_client/api/channels/get_private_channels_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( team_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/private".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/private".format( + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -67,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +77,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Channel"]]]: @@ -108,13 +106,11 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -124,7 +120,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Channel"]]]: @@ -162,7 +158,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Channel"]]]: @@ -191,13 +187,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -205,7 +199,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Channel"]]]: diff --git a/mattermost_api_reference_client/api/channels/get_public_channels_by_ids_for_team.py b/mattermost_api_reference_client/api/channels/get_public_channels_by_ids_for_team.py index d40db2d..3b7df9e 100644 --- a/mattermost_api_reference_client/api/channels/get_public_channels_by_ids_for_team.py +++ b/mattermost_api_reference_client/api/channels/get_public_channels_by_ids_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( team_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/ids".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/ids".format( + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -58,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +68,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List["Channel"]]]: """Get a list of channels by ids @@ -93,12 +91,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List["Channel"]]]: """Get a list of channels by ids @@ -139,7 +135,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List["Channel"]]]: """Get a list of channels by ids @@ -162,12 +158,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -175,7 +169,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List["Channel"]]]: """Get a list of channels by ids diff --git a/mattermost_api_reference_client/api/channels/get_public_channels_for_team.py b/mattermost_api_reference_client/api/channels/get_public_channels_for_team.py index 8284aee..75bb08b 100644 --- a/mattermost_api_reference_client/api/channels/get_public_channels_for_team.py +++ b/mattermost_api_reference_client/api/channels/get_public_channels_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( team_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels".format( + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -67,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +77,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Channel"]]]: @@ -104,13 +102,11 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -120,7 +116,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Channel"]]]: @@ -154,7 +150,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Channel"]]]: @@ -179,13 +175,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -193,7 +187,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Channel"]]]: diff --git a/mattermost_api_reference_client/api/channels/get_sidebar_categories_for_team_for_user.py b/mattermost_api_reference_client/api/channels/get_sidebar_categories_for_team_for_user.py index 49a2f01..ca765bc 100644 --- a/mattermost_api_reference_client/api/channels/get_sidebar_categories_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/get_sidebar_categories_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.ordered_sidebar_categories import OrderedSidebarCategories from ...types import Response @@ -12,28 +12,20 @@ from ...types import Response def _get_kwargs( user_id: str, team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories".format( - client.base_url, user_id=user_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories".format( + user_id=user_id, + team_id=team_id, + ), } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, List["OrderedSidebarCategories"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -63,7 +55,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, List["OrderedSidebarCategories"]]]: return Response( status_code=HTTPStatus(response.status_code), @@ -77,7 +69,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["OrderedSidebarCategories"]]]: """Get user's sidebar categories @@ -102,11 +94,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,7 +107,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["OrderedSidebarCategories"]]]: """Get user's sidebar categories @@ -150,7 +140,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["OrderedSidebarCategories"]]]: """Get user's sidebar categories @@ -175,11 +165,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -188,7 +176,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["OrderedSidebarCategories"]]]: """Get user's sidebar categories diff --git a/mattermost_api_reference_client/api/channels/get_sidebar_category_for_team_for_user.py b/mattermost_api_reference_client/api/channels/get_sidebar_category_for_team_for_user.py index 1410158..ef1b6af 100644 --- a/mattermost_api_reference_client/api/channels/get_sidebar_category_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/get_sidebar_category_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.sidebar_category import SidebarCategory from ...types import Response @@ -13,27 +13,22 @@ def _get_kwargs( user_id: str, team_id: str, category_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}".format( - client.base_url, user_id=user_id, team_id=team_id, category_id=category_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}".format( + user_id=user_id, + team_id=team_id, + category_id=category_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SidebarCategory]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, SidebarCategory]]: if response.status_code == HTTPStatus.OK: response_200 = SidebarCategory.from_dict(response.json()) @@ -56,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SidebarCategory]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, SidebarCategory]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +67,7 @@ def sync_detailed( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, SidebarCategory]]: """Get sidebar category @@ -96,11 +93,9 @@ def sync_detailed( user_id=user_id, team_id=team_id, category_id=category_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -112,7 +107,7 @@ def sync( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, SidebarCategory]]: """Get sidebar category @@ -147,7 +142,7 @@ async def asyncio_detailed( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, SidebarCategory]]: """Get sidebar category @@ -173,11 +168,9 @@ async def asyncio_detailed( user_id=user_id, team_id=team_id, category_id=category_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -187,7 +180,7 @@ async def asyncio( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, SidebarCategory]]: """Get sidebar category diff --git a/mattermost_api_reference_client/api/channels/get_sidebar_category_order_for_team_for_user.py b/mattermost_api_reference_client/api/channels/get_sidebar_category_order_for_team_for_user.py index ee87e32..6bcc8f8 100644 --- a/mattermost_api_reference_client/api/channels/get_sidebar_category_order_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/get_sidebar_category_order_for_team_for_user.py @@ -4,34 +4,28 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( user_id: str, team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/order".format( - client.base_url, user_id=user_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories/order".format( + user_id=user_id, + team_id=team_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List[str]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List[str]]]: if response.status_code == HTTPStatus.OK: response_200 = cast(List[str], response.json()) @@ -54,7 +48,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List[str]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List[str]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List[str]]]: """Get user's sidebar category order @@ -91,11 +87,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +100,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List[str]]]: """Get user's sidebar category order @@ -138,7 +132,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List[str]]]: """Get user's sidebar category order @@ -162,11 +156,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -175,7 +167,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List[str]]]: """Get user's sidebar category order diff --git a/mattermost_api_reference_client/api/channels/move_channel.py b/mattermost_api_reference_client/api/channels/move_channel.py index e324f5f..b179711 100644 --- a/mattermost_api_reference_client/api/channels/move_channel.py +++ b/mattermost_api_reference_client/api/channels/move_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.move_channel_json_body import MoveChannelJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: MoveChannelJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/move".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/move".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Move a channel @@ -96,12 +94,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +107,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Move a channel @@ -146,7 +142,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Move a channel @@ -173,12 +169,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -186,7 +180,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Move a channel diff --git a/mattermost_api_reference_client/api/channels/patch_channel.py b/mattermost_api_reference_client/api/channels/patch_channel.py index 93d3e55..cf83dd3 100644 --- a/mattermost_api_reference_client/api/channels/patch_channel.py +++ b/mattermost_api_reference_client/api/channels/patch_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.patch_channel_json_body import PatchChannelJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: PatchChannelJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/patch".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/patch".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Patch a channel @@ -95,12 +93,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +106,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Patch a channel @@ -144,7 +140,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Patch a channel @@ -170,12 +166,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -183,7 +177,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Patch a channel diff --git a/mattermost_api_reference_client/api/channels/patch_channel_moderations.py b/mattermost_api_reference_client/api/channels/patch_channel_moderations.py index b410751..eb76109 100644 --- a/mattermost_api_reference_client/api/channels/patch_channel_moderations.py +++ b/mattermost_api_reference_client/api/channels/patch_channel_moderations.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_moderation import ChannelModeration from ...models.channel_moderation_patch import ChannelModerationPatch from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: ChannelModerationPatch, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/moderations/patch".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/moderations/patch".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelModeration"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelModeration"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -59,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelModeration"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelModeration"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +69,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelModerationPatch, ) -> Response[Union[Any, List["ChannelModeration"]]]: """Update a channel's moderation settings. @@ -95,12 +93,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +106,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelModerationPatch, ) -> Optional[Union[Any, List["ChannelModeration"]]]: """Update a channel's moderation settings. @@ -142,7 +138,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelModerationPatch, ) -> Response[Union[Any, List["ChannelModeration"]]]: """Update a channel's moderation settings. @@ -166,12 +162,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -179,7 +173,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelModerationPatch, ) -> Optional[Union[Any, List["ChannelModeration"]]]: """Update a channel's moderation settings. diff --git a/mattermost_api_reference_client/api/channels/remove_sidebar_category_for_team_for_user.py b/mattermost_api_reference_client/api/channels/remove_sidebar_category_for_team_for_user.py index 599eed2..c1262aa 100644 --- a/mattermost_api_reference_client/api/channels/remove_sidebar_category_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/remove_sidebar_category_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.sidebar_category import SidebarCategory from ...types import Response @@ -13,27 +13,22 @@ def _get_kwargs( user_id: str, team_id: str, category_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}".format( - client.base_url, user_id=user_id, team_id=team_id, category_id=category_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}".format( + user_id=user_id, + team_id=team_id, + category_id=category_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SidebarCategory]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, SidebarCategory]]: if response.status_code == HTTPStatus.OK: response_200 = SidebarCategory.from_dict(response.json()) @@ -56,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SidebarCategory]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, SidebarCategory]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +67,7 @@ def sync_detailed( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, SidebarCategory]]: """Delete sidebar category @@ -97,11 +94,9 @@ def sync_detailed( user_id=user_id, team_id=team_id, category_id=category_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +108,7 @@ def sync( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, SidebarCategory]]: """Delete sidebar category @@ -149,7 +144,7 @@ async def asyncio_detailed( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, SidebarCategory]]: """Delete sidebar category @@ -176,11 +171,9 @@ async def asyncio_detailed( user_id=user_id, team_id=team_id, category_id=category_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -190,7 +183,7 @@ async def asyncio( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, SidebarCategory]]: """Delete sidebar category diff --git a/mattermost_api_reference_client/api/channels/remove_user_from_channel.py b/mattermost_api_reference_client/api/channels/remove_user_from_channel.py index 45f3923..3f64668 100644 --- a/mattermost_api_reference_client/api/channels/remove_user_from_channel.py +++ b/mattermost_api_reference_client/api/channels/remove_user_from_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( channel_id: str, user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members/{user_id}".format( - client.base_url, channel_id=channel_id, user_id=user_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members/{user_id}".format( + channel_id=channel_id, + user_id=user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -52,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +61,7 @@ def sync_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove user from channel @@ -92,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +101,7 @@ def sync( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove user from channel @@ -142,7 +136,7 @@ async def asyncio_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove user from channel @@ -169,11 +163,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -182,7 +174,7 @@ async def asyncio( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove user from channel diff --git a/mattermost_api_reference_client/api/channels/restore_channel.py b/mattermost_api_reference_client/api/channels/restore_channel.py index a26501c..360199b 100644 --- a/mattermost_api_reference_client/api/channels/restore_channel.py +++ b/mattermost_api_reference_client/api/channels/restore_channel.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...types import Response def _get_kwargs( channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/restore".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/restore".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Channel]]: """Restore a channel @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Channel]]: """Restore a channel @@ -130,7 +125,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Channel]]: """Restore a channel @@ -154,11 +149,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -166,7 +159,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Channel]]: """Restore a channel diff --git a/mattermost_api_reference_client/api/channels/search_all_channels.py b/mattermost_api_reference_client/api/channels/search_all_channels.py index 0cd8d4a..36400bd 100644 --- a/mattermost_api_reference_client/api/channels/search_all_channels.py +++ b/mattermost_api_reference_client/api/channels/search_all_channels.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.search_all_channels_json_body import SearchAllChannelsJsonBody from ...models.search_all_channels_response_200 import SearchAllChannelsResponse200 from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, json_body: SearchAllChannelsJsonBody, system_console: Union[Unset, None, bool] = True, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/search".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["system_console"] = system_console @@ -30,17 +26,15 @@ def _get_kwargs( return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/search", "json": json_json_body, "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SearchAllChannelsResponse200]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, SearchAllChannelsResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = SearchAllChannelsResponse200.from_dict(response.json()) @@ -57,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SearchAllChannelsResponse200]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, SearchAllChannelsResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchAllChannelsJsonBody, system_console: Union[Unset, None, bool] = True, ) -> Response[Union[Any, SearchAllChannelsResponse200]]: @@ -98,13 +94,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, system_console=system_console, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +107,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchAllChannelsJsonBody, system_console: Union[Unset, None, bool] = True, ) -> Optional[Union[Any, SearchAllChannelsResponse200]]: @@ -151,7 +145,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchAllChannelsJsonBody, system_console: Union[Unset, None, bool] = True, ) -> Response[Union[Any, SearchAllChannelsResponse200]]: @@ -181,20 +175,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, system_console=system_console, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchAllChannelsJsonBody, system_console: Union[Unset, None, bool] = True, ) -> Optional[Union[Any, SearchAllChannelsResponse200]]: diff --git a/mattermost_api_reference_client/api/channels/search_archived_channels.py b/mattermost_api_reference_client/api/channels/search_archived_channels.py index ce68be3..5ac110f 100644 --- a/mattermost_api_reference_client/api/channels/search_archived_channels.py +++ b/mattermost_api_reference_client/api/channels/search_archived_channels.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.search_archived_channels_json_body import SearchArchivedChannelsJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( team_id: str, *, - client: Client, json_body: SearchArchivedChannelsJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/search_archived".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/search_archived".format( + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.CREATED: response_201 = [] _response_201 = response.json() @@ -62,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +72,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchArchivedChannelsJsonBody, ) -> Response[Union[Any, List["Channel"]]]: """Search archived channels @@ -103,12 +101,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -118,7 +114,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchArchivedChannelsJsonBody, ) -> Optional[Union[Any, List["Channel"]]]: """Search archived channels @@ -155,7 +151,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchArchivedChannelsJsonBody, ) -> Response[Union[Any, List["Channel"]]]: """Search archived channels @@ -184,12 +180,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -197,7 +191,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchArchivedChannelsJsonBody, ) -> Optional[Union[Any, List["Channel"]]]: """Search archived channels diff --git a/mattermost_api_reference_client/api/channels/search_channels.py b/mattermost_api_reference_client/api/channels/search_channels.py index 76b0e0f..c691abd 100644 --- a/mattermost_api_reference_client/api/channels/search_channels.py +++ b/mattermost_api_reference_client/api/channels/search_channels.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.search_channels_json_body import SearchChannelsJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( team_id: str, *, - client: Client, json_body: SearchChannelsJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/channels/search".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/channels/search".format( + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.CREATED: response_201 = [] _response_201 = response.json() @@ -62,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +72,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsJsonBody, ) -> Response[Union[Any, List["Channel"]]]: """Search channels @@ -100,12 +98,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -115,7 +111,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsJsonBody, ) -> Optional[Union[Any, List["Channel"]]]: """Search channels @@ -149,7 +145,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsJsonBody, ) -> Response[Union[Any, List["Channel"]]]: """Search channels @@ -175,12 +171,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -188,7 +182,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsJsonBody, ) -> Optional[Union[Any, List["Channel"]]]: """Search channels diff --git a/mattermost_api_reference_client/api/channels/search_group_channels.py b/mattermost_api_reference_client/api/channels/search_group_channels.py index 68fbf71..e105313 100644 --- a/mattermost_api_reference_client/api/channels/search_group_channels.py +++ b/mattermost_api_reference_client/api/channels/search_group_channels.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.search_group_channels_json_body import SearchGroupChannelsJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: SearchGroupChannelsJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/group/search".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/group/search", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Channel"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Channel"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -55,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Channel"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Channel"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +62,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchGroupChannelsJsonBody, ) -> Response[Union[Any, List["Channel"]]]: """Search Group Channels @@ -87,12 +83,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -101,7 +95,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchGroupChannelsJsonBody, ) -> Optional[Union[Any, List["Channel"]]]: """Search Group Channels @@ -129,7 +123,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchGroupChannelsJsonBody, ) -> Response[Union[Any, List["Channel"]]]: """Search Group Channels @@ -150,19 +144,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchGroupChannelsJsonBody, ) -> Optional[Union[Any, List["Channel"]]]: """Search Group Channels diff --git a/mattermost_api_reference_client/api/channels/update_channel.py b/mattermost_api_reference_client/api/channels/update_channel.py index 29bb19f..00cef9c 100644 --- a/mattermost_api_reference_client/api/channels/update_channel.py +++ b/mattermost_api_reference_client/api/channels/update_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.update_channel_json_body import UpdateChannelJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: UpdateChannelJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Update a channel @@ -94,12 +92,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +105,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Update a channel @@ -142,7 +138,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelJsonBody, ) -> Response[Union[Any, Channel]]: """Update a channel @@ -167,12 +163,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -180,7 +174,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelJsonBody, ) -> Optional[Union[Any, Channel]]: """Update a channel diff --git a/mattermost_api_reference_client/api/channels/update_channel_member_scheme_roles.py b/mattermost_api_reference_client/api/channels/update_channel_member_scheme_roles.py index 5a0fd0a..df1b218 100644 --- a/mattermost_api_reference_client/api/channels/update_channel_member_scheme_roles.py +++ b/mattermost_api_reference_client/api/channels/update_channel_member_scheme_roles.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.update_channel_member_scheme_roles_json_body import UpdateChannelMemberSchemeRolesJsonBody from ...types import Response @@ -14,30 +14,25 @@ def _get_kwargs( channel_id: str, user_id: str, *, - client: Client, json_body: UpdateChannelMemberSchemeRolesJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members/{user_id}/schemeRoles".format( - client.base_url, channel_id=channel_id, user_id=user_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members/{user_id}/schemeRoles".format( + channel_id=channel_id, + user_id=user_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -60,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,7 +70,7 @@ def sync_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelMemberSchemeRolesJsonBody, ) -> Response[Union[Any, StatusOK]]: """Update the scheme-derived roles of a channel member. @@ -101,12 +98,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,7 +112,7 @@ def sync( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelMemberSchemeRolesJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Update the scheme-derived roles of a channel member. @@ -154,7 +149,7 @@ async def asyncio_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelMemberSchemeRolesJsonBody, ) -> Response[Union[Any, StatusOK]]: """Update the scheme-derived roles of a channel member. @@ -182,12 +177,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -196,7 +189,7 @@ async def asyncio( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelMemberSchemeRolesJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Update the scheme-derived roles of a channel member. diff --git a/mattermost_api_reference_client/api/channels/update_channel_notify_props.py b/mattermost_api_reference_client/api/channels/update_channel_notify_props.py index d0a1049..8cc1286 100644 --- a/mattermost_api_reference_client/api/channels/update_channel_notify_props.py +++ b/mattermost_api_reference_client/api/channels/update_channel_notify_props.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_notify_props import ChannelNotifyProps from ...models.status_ok import StatusOK from ...types import Response @@ -14,30 +14,25 @@ def _get_kwargs( channel_id: str, user_id: str, *, - client: Client, json_body: ChannelNotifyProps, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members/{user_id}/notify_props".format( - client.base_url, channel_id=channel_id, user_id=user_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members/{user_id}/notify_props".format( + channel_id=channel_id, + user_id=user_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -60,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,7 +70,7 @@ def sync_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelNotifyProps, ) -> Response[Union[Any, StatusOK]]: """Update channel notifications @@ -98,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -114,7 +109,7 @@ def sync( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelNotifyProps, ) -> Optional[Union[Any, StatusOK]]: """Update channel notifications @@ -148,7 +143,7 @@ async def asyncio_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelNotifyProps, ) -> Response[Union[Any, StatusOK]]: """Update channel notifications @@ -173,12 +168,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -187,7 +180,7 @@ async def asyncio( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ChannelNotifyProps, ) -> Optional[Union[Any, StatusOK]]: """Update channel notifications diff --git a/mattermost_api_reference_client/api/channels/update_channel_privacy.py b/mattermost_api_reference_client/api/channels/update_channel_privacy.py index f12ac8d..5ec452c 100644 --- a/mattermost_api_reference_client/api/channels/update_channel_privacy.py +++ b/mattermost_api_reference_client/api/channels/update_channel_privacy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel import Channel from ...models.update_channel_privacy_json_body import UpdateChannelPrivacyJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: UpdateChannelPrivacyJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/privacy".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/privacy".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Channel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Channel]]: if response.status_code == HTTPStatus.OK: response_200 = Channel.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Channel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Channel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelPrivacyJsonBody, ) -> Response[Union[Any, Channel]]: """Update channel's privacy @@ -98,12 +96,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +109,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelPrivacyJsonBody, ) -> Optional[Union[Any, Channel]]: """Update channel's privacy @@ -150,7 +146,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelPrivacyJsonBody, ) -> Response[Union[Any, Channel]]: """Update channel's privacy @@ -179,12 +175,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -192,7 +186,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelPrivacyJsonBody, ) -> Optional[Union[Any, Channel]]: """Update channel's privacy diff --git a/mattermost_api_reference_client/api/channels/update_channel_roles.py b/mattermost_api_reference_client/api/channels/update_channel_roles.py index a83bbcf..65b7028 100644 --- a/mattermost_api_reference_client/api/channels/update_channel_roles.py +++ b/mattermost_api_reference_client/api/channels/update_channel_roles.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.update_channel_roles_json_body import UpdateChannelRolesJsonBody from ...types import Response @@ -14,30 +14,25 @@ def _get_kwargs( channel_id: str, user_id: str, *, - client: Client, json_body: UpdateChannelRolesJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/members/{user_id}/roles".format( - client.base_url, channel_id=channel_id, user_id=user_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/members/{user_id}/roles".format( + channel_id=channel_id, + user_id=user_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -57,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +67,7 @@ def sync_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelRolesJsonBody, ) -> Response[Union[Any, StatusOK]]: """Update channel roles @@ -95,12 +92,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +106,7 @@ def sync( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelRolesJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Update channel roles @@ -145,7 +140,7 @@ async def asyncio_detailed( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelRolesJsonBody, ) -> Response[Union[Any, StatusOK]]: """Update channel roles @@ -170,12 +165,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, user_id=user_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -184,7 +177,7 @@ async def asyncio( channel_id: str, user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelRolesJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Update channel roles diff --git a/mattermost_api_reference_client/api/channels/update_channel_scheme.py b/mattermost_api_reference_client/api/channels/update_channel_scheme.py index a35c9df..db5edae 100644 --- a/mattermost_api_reference_client/api/channels/update_channel_scheme.py +++ b/mattermost_api_reference_client/api/channels/update_channel_scheme.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.update_channel_scheme_json_body import UpdateChannelSchemeJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( channel_id: str, *, - client: Client, json_body: UpdateChannelSchemeJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/scheme".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/scheme".format( + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelSchemeJsonBody, ) -> Response[Union[Any, StatusOK]]: """Set a channel's scheme @@ -95,12 +93,10 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +106,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelSchemeJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Set a channel's scheme @@ -144,7 +140,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelSchemeJsonBody, ) -> Response[Union[Any, StatusOK]]: """Set a channel's scheme @@ -170,12 +166,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -183,7 +177,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateChannelSchemeJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Set a channel's scheme diff --git a/mattermost_api_reference_client/api/channels/update_sidebar_categories_for_team_for_user.py b/mattermost_api_reference_client/api/channels/update_sidebar_categories_for_team_for_user.py index b8a9efb..1d53c7f 100644 --- a/mattermost_api_reference_client/api/channels/update_sidebar_categories_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/update_sidebar_categories_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.sidebar_category import SidebarCategory from ...types import Response @@ -13,15 +13,9 @@ def _get_kwargs( user_id: str, team_id: str, *, - client: Client, json_body: List["SidebarCategory"], ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories".format( - client.base_url, user_id=user_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = [] for json_body_item_data in json_body: @@ -31,16 +25,17 @@ def _get_kwargs( return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories".format( + user_id=user_id, + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SidebarCategory]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, SidebarCategory]]: if response.status_code == HTTPStatus.OK: response_200 = SidebarCategory.from_dict(response.json()) @@ -63,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SidebarCategory]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, SidebarCategory]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +73,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["SidebarCategory"], ) -> Response[Union[Any, SidebarCategory]]: """Update user's sidebar categories @@ -103,12 +100,10 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -119,7 +114,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["SidebarCategory"], ) -> Optional[Union[Any, SidebarCategory]]: """Update user's sidebar categories @@ -155,7 +150,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["SidebarCategory"], ) -> Response[Union[Any, SidebarCategory]]: """Update user's sidebar categories @@ -182,12 +177,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -196,7 +189,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["SidebarCategory"], ) -> Optional[Union[Any, SidebarCategory]]: """Update user's sidebar categories diff --git a/mattermost_api_reference_client/api/channels/update_sidebar_category_for_team_for_user.py b/mattermost_api_reference_client/api/channels/update_sidebar_category_for_team_for_user.py index 8bf6910..0095d11 100644 --- a/mattermost_api_reference_client/api/channels/update_sidebar_category_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/update_sidebar_category_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.sidebar_category import SidebarCategory from ...types import Response @@ -14,30 +14,26 @@ def _get_kwargs( team_id: str, category_id: str, *, - client: Client, json_body: SidebarCategory, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}".format( - client.base_url, user_id=user_id, team_id=team_id, category_id=category_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories/{category_id}".format( + user_id=user_id, + team_id=team_id, + category_id=category_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, SidebarCategory]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, SidebarCategory]]: if response.status_code == HTTPStatus.OK: response_200 = SidebarCategory.from_dict(response.json()) @@ -60,7 +56,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, SidebarCategory]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, SidebarCategory]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +72,7 @@ def sync_detailed( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Response[Union[Any, SidebarCategory]]: """Update sidebar category @@ -102,12 +100,10 @@ def sync_detailed( user_id=user_id, team_id=team_id, category_id=category_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -119,7 +115,7 @@ def sync( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Optional[Union[Any, SidebarCategory]]: """Update sidebar category @@ -157,7 +153,7 @@ async def asyncio_detailed( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Response[Union[Any, SidebarCategory]]: """Update sidebar category @@ -185,12 +181,10 @@ async def asyncio_detailed( user_id=user_id, team_id=team_id, category_id=category_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -200,7 +194,7 @@ async def asyncio( team_id: str, category_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SidebarCategory, ) -> Optional[Union[Any, SidebarCategory]]: """Update sidebar category diff --git a/mattermost_api_reference_client/api/channels/update_sidebar_category_order_for_team_for_user.py b/mattermost_api_reference_client/api/channels/update_sidebar_category_order_for_team_for_user.py index c9fa8ac..b039983 100644 --- a/mattermost_api_reference_client/api/channels/update_sidebar_category_order_for_team_for_user.py +++ b/mattermost_api_reference_client/api/channels/update_sidebar_category_order_for_team_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response @@ -12,30 +12,25 @@ def _get_kwargs( user_id: str, team_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/teams/{team_id}/channels/categories/order".format( - client.base_url, user_id=user_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/teams/{team_id}/channels/categories/order".format( + user_id=user_id, + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List[str]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List[str]]]: if response.status_code == HTTPStatus.OK: response_200 = cast(List[str], response.json()) @@ -58,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List[str]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List[str]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +68,7 @@ def sync_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List[str]]]: """Update user's sidebar category order @@ -98,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -114,7 +109,7 @@ def sync( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List[str]]]: """Update user's sidebar category order @@ -150,7 +145,7 @@ async def asyncio_detailed( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List[str]]]: """Update user's sidebar category order @@ -177,12 +172,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -191,7 +184,7 @@ async def asyncio( user_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List[str]]]: """Update user's sidebar category order diff --git a/mattermost_api_reference_client/api/channels/view_channel.py b/mattermost_api_reference_client/api/channels/view_channel.py index 276ccbb..c238ed7 100644 --- a/mattermost_api_reference_client/api/channels/view_channel.py +++ b/mattermost_api_reference_client/api/channels/view_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.view_channel_json_body import ViewChannelJsonBody from ...models.view_channel_response_200 import ViewChannelResponse200 from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( user_id: str, *, - client: Client, json_body: ViewChannelJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/members/{user_id}/view".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/members/{user_id}/view".format( + user_id=user_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ViewChannelResponse200]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ViewChannelResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = ViewChannelResponse200.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ViewChannelResponse200]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ViewChannelResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ViewChannelJsonBody, ) -> Response[Union[Any, ViewChannelResponse200]]: """View channel @@ -92,12 +90,10 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +103,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ViewChannelJsonBody, ) -> Optional[Union[Any, ViewChannelResponse200]]: """View channel @@ -141,7 +137,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ViewChannelJsonBody, ) -> Response[Union[Any, ViewChannelResponse200]]: """View channel @@ -167,12 +163,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -180,7 +174,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ViewChannelJsonBody, ) -> Optional[Union[Any, ViewChannelResponse200]]: """View channel diff --git a/mattermost_api_reference_client/api/cloud/confirm_customer_payment.py b/mattermost_api_reference_client/api/cloud/confirm_customer_payment.py index ffdb064..e7b944c 100644 --- a/mattermost_api_reference_client/api/cloud/confirm_customer_payment.py +++ b/mattermost_api_reference_client/api/cloud/confirm_customer_payment.py @@ -1,38 +1,30 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.confirm_customer_payment_multipart_data import ConfirmCustomerPaymentMultipartData from ...types import Response def _get_kwargs( *, - client: Client, multipart_data: ConfirmCustomerPaymentMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/cloud/payment/confirm".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/payment/confirm", "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -49,7 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +52,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: ConfirmCustomerPaymentMultipartData, ) -> Response[Any]: """Completes the payment setup intent @@ -83,12 +75,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +87,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: ConfirmCustomerPaymentMultipartData, ) -> Response[Any]: """Completes the payment setup intent @@ -120,11 +110,9 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/cloud/create_customer_payment.py b/mattermost_api_reference_client/api/cloud/create_customer_payment.py index caae929..af4d05e 100644 --- a/mattermost_api_reference_client/api/cloud/create_customer_payment.py +++ b/mattermost_api_reference_client/api/cloud/create_customer_payment.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.payment_setup_intent import PaymentSetupIntent from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/payment".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/payment", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PaymentSetupIntent]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PaymentSetupIntent]]: if response.status_code == HTTPStatus.CREATED: response_201 = PaymentSetupIntent.from_dict(response.json()) @@ -51,7 +43,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PaymentSetupIntent]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PaymentSetupIntent]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +56,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, PaymentSetupIntent]]: """Create a customer setup payment intent @@ -83,12 +77,9 @@ def sync_detailed( Response[Union[Any, PaymentSetupIntent]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +88,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, PaymentSetupIntent]]: """Create a customer setup payment intent @@ -125,7 +116,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, PaymentSetupIntent]]: """Create a customer setup payment intent @@ -146,19 +137,16 @@ async def asyncio_detailed( Response[Union[Any, PaymentSetupIntent]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, PaymentSetupIntent]]: """Create a customer setup payment intent diff --git a/mattermost_api_reference_client/api/cloud/get_cloud_customer.py b/mattermost_api_reference_client/api/cloud/get_cloud_customer.py index 88be431..c4e4a91 100644 --- a/mattermost_api_reference_client/api/cloud/get_cloud_customer.py +++ b/mattermost_api_reference_client/api/cloud/get_cloud_customer.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.cloud_customer import CloudCustomer from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/customer".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/customer", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, CloudCustomer]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, CloudCustomer]]: if response.status_code == HTTPStatus.OK: response_200 = CloudCustomer.from_dict(response.json()) @@ -51,7 +43,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, CloudCustomer]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, CloudCustomer]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +56,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, CloudCustomer]]: """Get cloud customer @@ -80,12 +74,9 @@ def sync_detailed( Response[Union[Any, CloudCustomer]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -94,7 +85,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, CloudCustomer]]: """Get cloud customer @@ -119,7 +110,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, CloudCustomer]]: """Get cloud customer @@ -137,19 +128,16 @@ async def asyncio_detailed( Response[Union[Any, CloudCustomer]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, CloudCustomer]]: """Get cloud customer diff --git a/mattermost_api_reference_client/api/cloud/get_cloud_limits.py b/mattermost_api_reference_client/api/cloud/get_cloud_limits.py index b0080be..75affae 100644 --- a/mattermost_api_reference_client/api/cloud/get_cloud_limits.py +++ b/mattermost_api_reference_client/api/cloud/get_cloud_limits.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.product_limits import ProductLimits from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/limits".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/limits", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ProductLimits]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ProductLimits]]: if response.status_code == HTTPStatus.OK: response_200 = ProductLimits.from_dict(response.json()) @@ -48,7 +40,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ProductLimits]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ProductLimits]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +53,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ProductLimits]]: """Get cloud workspace limits @@ -77,12 +71,9 @@ def sync_detailed( Response[Union[Any, ProductLimits]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -91,7 +82,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ProductLimits]]: """Get cloud workspace limits @@ -116,7 +107,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ProductLimits]]: """Get cloud workspace limits @@ -134,19 +125,16 @@ async def asyncio_detailed( Response[Union[Any, ProductLimits]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ProductLimits]]: """Get cloud workspace limits diff --git a/mattermost_api_reference_client/api/cloud/get_cloud_products.py b/mattermost_api_reference_client/api/cloud/get_cloud_products.py index 4522b70..e9f0e21 100644 --- a/mattermost_api_reference_client/api/cloud/get_cloud_products.py +++ b/mattermost_api_reference_client/api/cloud/get_cloud_products.py @@ -4,31 +4,23 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.product import Product from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/products".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/products", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Product"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Product"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -56,7 +48,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Product"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Product"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Product"]]]: """Get cloud products @@ -85,12 +79,9 @@ def sync_detailed( Response[Union[Any, List['Product']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +90,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Product"]]]: """Get cloud products @@ -124,7 +115,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Product"]]]: """Get cloud products @@ -142,19 +133,16 @@ async def asyncio_detailed( Response[Union[Any, List['Product']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Product"]]]: """Get cloud products diff --git a/mattermost_api_reference_client/api/cloud/get_invoice_for_subscription_as_pdf.py b/mattermost_api_reference_client/api/cloud/get_invoice_for_subscription_as_pdf.py index 69cb6cb..3bc8008 100644 --- a/mattermost_api_reference_client/api/cloud/get_invoice_for_subscription_as_pdf.py +++ b/mattermost_api_reference_client/api/cloud/get_invoice_for_subscription_as_pdf.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( invoice_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/cloud/subscription/invoices/{invoice_id}/pdf".format(client.base_url, invoice_id=invoice_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/subscription/invoices/{invoice_id}/pdf".format( + invoice_id=invoice_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -43,7 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -55,7 +48,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( invoice_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get cloud invoice PDF @@ -78,11 +71,9 @@ def sync_detailed( kwargs = _get_kwargs( invoice_id=invoice_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -92,7 +83,7 @@ def sync_detailed( async def asyncio_detailed( invoice_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get cloud invoice PDF @@ -115,10 +106,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( invoice_id=invoice_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/cloud/get_invoices_for_subscription.py b/mattermost_api_reference_client/api/cloud/get_invoices_for_subscription.py index ea35be2..9c7b4a7 100644 --- a/mattermost_api_reference_client/api/cloud/get_invoices_for_subscription.py +++ b/mattermost_api_reference_client/api/cloud/get_invoices_for_subscription.py @@ -4,31 +4,23 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.invoice import Invoice from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/subscription/invoices".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/subscription/invoices", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Invoice"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Invoice"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -56,7 +48,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Invoice"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Invoice"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Invoice"]]]: """Get cloud subscription invoices @@ -85,12 +79,9 @@ def sync_detailed( Response[Union[Any, List['Invoice']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +90,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Invoice"]]]: """Get cloud subscription invoices @@ -124,7 +115,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Invoice"]]]: """Get cloud subscription invoices @@ -142,19 +133,16 @@ async def asyncio_detailed( Response[Union[Any, List['Invoice']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Invoice"]]]: """Get cloud subscription invoices diff --git a/mattermost_api_reference_client/api/cloud/get_subscription.py b/mattermost_api_reference_client/api/cloud/get_subscription.py index 79a3dd6..1a07755 100644 --- a/mattermost_api_reference_client/api/cloud/get_subscription.py +++ b/mattermost_api_reference_client/api/cloud/get_subscription.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.subscription import Subscription from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/subscription".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/subscription", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Subscription]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Subscription]]: if response.status_code == HTTPStatus.OK: response_200 = Subscription.from_dict(response.json()) @@ -51,7 +43,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Subscription]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Subscription]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +56,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Subscription]]: """Get cloud subscription @@ -80,12 +74,9 @@ def sync_detailed( Response[Union[Any, Subscription]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -94,7 +85,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Subscription]]: """Get cloud subscription @@ -119,7 +110,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Subscription]]: """Get cloud subscription @@ -137,19 +128,16 @@ async def asyncio_detailed( Response[Union[Any, Subscription]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Subscription]]: """Get cloud subscription diff --git a/mattermost_api_reference_client/api/cloud/post_endpoint_for_cws_webhooks.py b/mattermost_api_reference_client/api/cloud/post_endpoint_for_cws_webhooks.py index d034aa9..3bb67c8 100644 --- a/mattermost_api_reference_client/api/cloud/post_endpoint_for_cws_webhooks.py +++ b/mattermost_api_reference_client/api/cloud/post_endpoint_for_cws_webhooks.py @@ -1,33 +1,23 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cloud/webhook".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/webhook", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -42,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +43,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """POST endpoint for CWS Webhooks @@ -71,12 +61,9 @@ def sync_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -85,7 +72,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """POST endpoint for CWS Webhooks @@ -103,11 +90,8 @@ async def asyncio_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/cloud/update_cloud_customer.py b/mattermost_api_reference_client/api/cloud/update_cloud_customer.py index 069f680..e669597 100644 --- a/mattermost_api_reference_client/api/cloud/update_cloud_customer.py +++ b/mattermost_api_reference_client/api/cloud/update_cloud_customer.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.cloud_customer import CloudCustomer from ...models.update_cloud_customer_json_body import UpdateCloudCustomerJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: UpdateCloudCustomerJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/cloud/customer".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/customer", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, CloudCustomer]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, CloudCustomer]]: if response.status_code == HTTPStatus.OK: response_200 = CloudCustomer.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, CloudCustomer]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, CloudCustomer]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateCloudCustomerJsonBody, ) -> Response[Union[Any, CloudCustomer]]: """Update cloud customer @@ -90,12 +86,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +98,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateCloudCustomerJsonBody, ) -> Optional[Union[Any, CloudCustomer]]: """Update cloud customer @@ -134,7 +128,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateCloudCustomerJsonBody, ) -> Response[Union[Any, CloudCustomer]]: """Update cloud customer @@ -157,19 +151,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateCloudCustomerJsonBody, ) -> Optional[Union[Any, CloudCustomer]]: """Update cloud customer diff --git a/mattermost_api_reference_client/api/cloud/update_cloud_customer_address.py b/mattermost_api_reference_client/api/cloud/update_cloud_customer_address.py index 9ed44f9..2e74c8f 100644 --- a/mattermost_api_reference_client/api/cloud/update_cloud_customer_address.py +++ b/mattermost_api_reference_client/api/cloud/update_cloud_customer_address.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.address import Address from ...models.cloud_customer import CloudCustomer from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: Address, ) -> Dict[str, Any]: - url = "{}/api/v4/cloud/customer/address".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cloud/customer/address", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, CloudCustomer]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, CloudCustomer]]: if response.status_code == HTTPStatus.OK: response_200 = CloudCustomer.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, CloudCustomer]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, CloudCustomer]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Address, ) -> Response[Union[Any, CloudCustomer]]: """Update cloud customer address @@ -90,12 +86,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +98,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Address, ) -> Optional[Union[Any, CloudCustomer]]: """Update cloud customer address @@ -134,7 +128,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Address, ) -> Response[Union[Any, CloudCustomer]]: """Update cloud customer address @@ -157,19 +151,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Address, ) -> Optional[Union[Any, CloudCustomer]]: """Update cloud customer address diff --git a/mattermost_api_reference_client/api/cluster/get_cluster_status.py b/mattermost_api_reference_client/api/cluster/get_cluster_status.py index 8aeb41c..99f8928 100644 --- a/mattermost_api_reference_client/api/cluster/get_cluster_status.py +++ b/mattermost_api_reference_client/api/cluster/get_cluster_status.py @@ -4,31 +4,23 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.cluster_info import ClusterInfo from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/cluster/status".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/cluster/status", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ClusterInfo"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ClusterInfo"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -47,7 +39,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ClusterInfo"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ClusterInfo"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +52,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["ClusterInfo"]]]: """Get cluster status @@ -75,12 +69,9 @@ def sync_detailed( Response[Union[Any, List['ClusterInfo']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -89,7 +80,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["ClusterInfo"]]]: """Get cluster status @@ -113,7 +104,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["ClusterInfo"]]]: """Get cluster status @@ -130,19 +121,16 @@ async def asyncio_detailed( Response[Union[Any, List['ClusterInfo']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["ClusterInfo"]]]: """Get cluster status diff --git a/mattermost_api_reference_client/api/commands/create_command.py b/mattermost_api_reference_client/api/commands/create_command.py index 00bf3f9..836bc3b 100644 --- a/mattermost_api_reference_client/api/commands/create_command.py +++ b/mattermost_api_reference_client/api/commands/create_command.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.command import Command from ...models.create_command_json_body import CreateCommandJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreateCommandJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/commands".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Command]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Command]]: if response.status_code == HTTPStatus.CREATED: response_201 = Command.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Command]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Command]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateCommandJsonBody, ) -> Response[Union[Any, Command]]: """Create a command @@ -88,12 +84,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +96,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateCommandJsonBody, ) -> Optional[Union[Any, Command]]: """Create a command @@ -130,7 +124,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateCommandJsonBody, ) -> Response[Union[Any, Command]]: """Create a command @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateCommandJsonBody, ) -> Optional[Union[Any, Command]]: """Create a command diff --git a/mattermost_api_reference_client/api/commands/delete_command.py b/mattermost_api_reference_client/api/commands/delete_command.py index c654233..db06b95 100644 --- a/mattermost_api_reference_client/api/commands/delete_command.py +++ b/mattermost_api_reference_client/api/commands/delete_command.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( command_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/commands/{command_id}".format(client.base_url, command_id=command_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands/{command_id}".format( + command_id=command_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a command @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a command @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a command @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a command diff --git a/mattermost_api_reference_client/api/commands/execute_command.py b/mattermost_api_reference_client/api/commands/execute_command.py index ac8603f..a32d7fc 100644 --- a/mattermost_api_reference_client/api/commands/execute_command.py +++ b/mattermost_api_reference_client/api/commands/execute_command.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.command_response import CommandResponse from ...models.execute_command_json_body import ExecuteCommandJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: ExecuteCommandJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/commands/execute".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands/execute", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, CommandResponse]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, CommandResponse]]: if response.status_code == HTTPStatus.OK: response_200 = CommandResponse.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, CommandResponse]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, CommandResponse]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ExecuteCommandJsonBody, ) -> Response[Union[Any, CommandResponse]]: """Execute a command @@ -88,12 +84,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +96,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ExecuteCommandJsonBody, ) -> Optional[Union[Any, CommandResponse]]: """Execute a command @@ -130,7 +124,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ExecuteCommandJsonBody, ) -> Response[Union[Any, CommandResponse]]: """Execute a command @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: ExecuteCommandJsonBody, ) -> Optional[Union[Any, CommandResponse]]: """Execute a command diff --git a/mattermost_api_reference_client/api/commands/get_command_by_id.py b/mattermost_api_reference_client/api/commands/get_command_by_id.py index e309381..93a98ec 100644 --- a/mattermost_api_reference_client/api/commands/get_command_by_id.py +++ b/mattermost_api_reference_client/api/commands/get_command_by_id.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.command import Command from ...types import Response def _get_kwargs( command_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/commands/{command_id}".format(client.base_url, command_id=command_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands/{command_id}".format( + command_id=command_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Command]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Command]]: if response.status_code == HTTPStatus.OK: response_200 = Command.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Command]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Command]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Command]]: """Get a command @@ -84,11 +81,9 @@ def sync_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -98,7 +93,7 @@ def sync_detailed( def sync( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Command]]: """Get a command @@ -128,7 +123,7 @@ def sync( async def asyncio_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Command]]: """Get a command @@ -151,11 +146,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -163,7 +156,7 @@ async def asyncio_detailed( async def asyncio( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Command]]: """Get a command diff --git a/mattermost_api_reference_client/api/commands/list_autocomplete_commands.py b/mattermost_api_reference_client/api/commands/list_autocomplete_commands.py index b92918b..7843f48 100644 --- a/mattermost_api_reference_client/api/commands/list_autocomplete_commands.py +++ b/mattermost_api_reference_client/api/commands/list_autocomplete_commands.py @@ -4,32 +4,27 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.command import Command from ...types import Response def _get_kwargs( team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/commands/autocomplete".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/commands/autocomplete".format( + team_id=team_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Command"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Command"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -54,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Command"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Command"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Command"]]]: """List autocomplete commands @@ -87,11 +84,9 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -101,7 +96,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Command"]]]: """List autocomplete commands @@ -129,7 +124,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Command"]]]: """List autocomplete commands @@ -150,11 +145,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -162,7 +155,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Command"]]]: """List autocomplete commands diff --git a/mattermost_api_reference_client/api/commands/list_command_autocomplete_suggestions.py b/mattermost_api_reference_client/api/commands/list_command_autocomplete_suggestions.py index 781180e..8e22cd7 100644 --- a/mattermost_api_reference_client/api/commands/list_command_autocomplete_suggestions.py +++ b/mattermost_api_reference_client/api/commands/list_command_autocomplete_suggestions.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.autocomplete_suggestion import AutocompleteSuggestion from ...types import UNSET, Response @@ -12,13 +12,9 @@ from ...types import UNSET, Response def _get_kwargs( team_id: str, *, - client: Client, user_input: str, ) -> Dict[str, Any]: - url = "{}/teams/{team_id}/commands/autocomplete_suggestions".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["user_input"] = user_input @@ -27,17 +23,15 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/commands/autocomplete_suggestions".format( + team_id=team_id, + ), "params": params, } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, List["AutocompleteSuggestion"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -64,7 +58,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, List["AutocompleteSuggestion"]]]: return Response( status_code=HTTPStatus(response.status_code), @@ -77,7 +71,7 @@ def _build_response( def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], user_input: str, ) -> Response[Union[Any, List["AutocompleteSuggestion"]]]: """List commands' autocomplete data @@ -101,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, user_input=user_input, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -116,7 +108,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], user_input: str, ) -> Optional[Union[Any, List["AutocompleteSuggestion"]]]: """List commands' autocomplete data @@ -148,7 +140,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], user_input: str, ) -> Response[Union[Any, List["AutocompleteSuggestion"]]]: """List commands' autocomplete data @@ -172,12 +164,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, user_input=user_input, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -185,7 +175,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], user_input: str, ) -> Optional[Union[Any, List["AutocompleteSuggestion"]]]: """List commands' autocomplete data diff --git a/mattermost_api_reference_client/api/commands/list_commands.py b/mattermost_api_reference_client/api/commands/list_commands.py index 7553d08..ecac7c7 100644 --- a/mattermost_api_reference_client/api/commands/list_commands.py +++ b/mattermost_api_reference_client/api/commands/list_commands.py @@ -4,21 +4,17 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.command import Command from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, team_id: Union[Unset, None, str] = UNSET, custom_only: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/commands".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["team_id"] = team_id @@ -29,16 +25,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Command"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Command"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -66,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Command"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Command"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +73,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, custom_only: Union[Unset, None, bool] = False, ) -> Response[Union[Any, List["Command"]]]: @@ -100,13 +96,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, custom_only=custom_only, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -115,7 +109,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, custom_only: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, List["Command"]]]: @@ -146,7 +140,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, custom_only: Union[Unset, None, bool] = False, ) -> Response[Union[Any, List["Command"]]]: @@ -169,20 +163,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, custom_only=custom_only, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, custom_only: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, List["Command"]]]: diff --git a/mattermost_api_reference_client/api/commands/move_command.py b/mattermost_api_reference_client/api/commands/move_command.py index 29280db..792c5ea 100644 --- a/mattermost_api_reference_client/api/commands/move_command.py +++ b/mattermost_api_reference_client/api/commands/move_command.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.move_command_json_body import MoveCommandJsonBody from ...models.status_ok import StatusOK from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( command_id: str, *, - client: Client, json_body: MoveCommandJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/commands/{command_id}/move".format(client.base_url, command_id=command_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands/{command_id}/move".format( + command_id=command_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveCommandJsonBody, ) -> Response[Union[Any, StatusOK]]: """Move a command @@ -95,12 +93,10 @@ def sync_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +106,7 @@ def sync_detailed( def sync( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveCommandJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Move a command @@ -144,7 +140,7 @@ def sync( async def asyncio_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveCommandJsonBody, ) -> Response[Union[Any, StatusOK]]: """Move a command @@ -170,12 +166,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -183,7 +177,7 @@ async def asyncio_detailed( async def asyncio( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MoveCommandJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Move a command diff --git a/mattermost_api_reference_client/api/commands/regen_command_token.py b/mattermost_api_reference_client/api/commands/regen_command_token.py index 8bf0f0a..6f9234b 100644 --- a/mattermost_api_reference_client/api/commands/regen_command_token.py +++ b/mattermost_api_reference_client/api/commands/regen_command_token.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.regen_command_token_response_200 import RegenCommandTokenResponse200 from ...types import Response def _get_kwargs( command_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/commands/{command_id}/regen_token".format(client.base_url, command_id=command_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands/{command_id}/regen_token".format( + command_id=command_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, RegenCommandTokenResponse200]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, RegenCommandTokenResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = RegenCommandTokenResponse200.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, RegenCommandTokenResponse200]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, RegenCommandTokenResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, RegenCommandTokenResponse200]]: """Generate a new token @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, RegenCommandTokenResponse200]]: """Generate a new token @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, RegenCommandTokenResponse200]]: """Generate a new token @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, RegenCommandTokenResponse200]]: """Generate a new token diff --git a/mattermost_api_reference_client/api/commands/update_command.py b/mattermost_api_reference_client/api/commands/update_command.py index 6363555..bba23c1 100644 --- a/mattermost_api_reference_client/api/commands/update_command.py +++ b/mattermost_api_reference_client/api/commands/update_command.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.command import Command from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( command_id: str, *, - client: Client, json_body: Command, ) -> Dict[str, Any]: - url = "{}/api/v4/commands/{command_id}".format(client.base_url, command_id=command_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/commands/{command_id}".format( + command_id=command_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Command]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Command]]: if response.status_code == HTTPStatus.OK: response_200 = Command.from_dict(response.json()) @@ -53,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Command]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Command]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Command, ) -> Response[Union[Any, Command]]: """Update a command @@ -88,12 +86,10 @@ def sync_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +99,7 @@ def sync_detailed( def sync( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Command, ) -> Optional[Union[Any, Command]]: """Update a command @@ -134,7 +130,7 @@ def sync( async def asyncio_detailed( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Command, ) -> Response[Union[Any, Command]]: """Update a command @@ -157,12 +153,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( command_id=command_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -170,7 +164,7 @@ async def asyncio_detailed( async def asyncio( command_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: Command, ) -> Optional[Union[Any, Command]]: """Update a command diff --git a/mattermost_api_reference_client/api/compliance/create_compliance_report.py b/mattermost_api_reference_client/api/compliance/create_compliance_report.py index d6bcac1..5f62672 100644 --- a/mattermost_api_reference_client/api/compliance/create_compliance_report.py +++ b/mattermost_api_reference_client/api/compliance/create_compliance_report.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.compliance import Compliance from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/compliance/reports".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/compliance/reports", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Compliance]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Compliance]]: if response.status_code == HTTPStatus.CREATED: response_201 = Compliance.from_dict(response.json()) @@ -51,7 +43,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Compliance]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Compliance]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +56,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Compliance]]: """Create report @@ -78,12 +72,9 @@ def sync_detailed( Response[Union[Any, Compliance]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -92,7 +83,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Compliance]]: """Create report @@ -115,7 +106,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Compliance]]: """Create report @@ -131,19 +122,16 @@ async def asyncio_detailed( Response[Union[Any, Compliance]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Compliance]]: """Create report diff --git a/mattermost_api_reference_client/api/compliance/download_compliance_report.py b/mattermost_api_reference_client/api/compliance/download_compliance_report.py index 2bf5f8d..a38b6a0 100644 --- a/mattermost_api_reference_client/api/compliance/download_compliance_report.py +++ b/mattermost_api_reference_client/api/compliance/download_compliance_report.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( report_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/compliance/reports/{report_id}/download".format(client.base_url, report_id=report_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/compliance/reports/{report_id}/download".format( + report_id=report_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -45,7 +38,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -57,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( report_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Download a report @@ -78,11 +71,9 @@ def sync_detailed( kwargs = _get_kwargs( report_id=report_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -92,7 +83,7 @@ def sync_detailed( async def asyncio_detailed( report_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Download a report @@ -113,10 +104,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( report_id=report_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/compliance/get_compliance_report.py b/mattermost_api_reference_client/api/compliance/get_compliance_report.py index 5f913bf..096a627 100644 --- a/mattermost_api_reference_client/api/compliance/get_compliance_report.py +++ b/mattermost_api_reference_client/api/compliance/get_compliance_report.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.compliance import Compliance from ...types import Response def _get_kwargs( report_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/compliance/reports/{report_id}".format(client.base_url, report_id=report_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/compliance/reports/{report_id}".format( + report_id=report_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Compliance]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Compliance]]: if response.status_code == HTTPStatus.OK: response_200 = Compliance.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Compliance]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Compliance]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( report_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Compliance]]: """Get a report @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( report_id=report_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( report_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Compliance]]: """Get a report @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( report_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Compliance]]: """Get a report @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( report_id=report_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( report_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Compliance]]: """Get a report diff --git a/mattermost_api_reference_client/api/compliance/get_compliance_reports.py b/mattermost_api_reference_client/api/compliance/get_compliance_reports.py index 82374eb..b7af5b8 100644 --- a/mattermost_api_reference_client/api/compliance/get_compliance_reports.py +++ b/mattermost_api_reference_client/api/compliance/get_compliance_reports.py @@ -4,21 +4,17 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.compliance import Compliance from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/compliance/reports".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -29,16 +25,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/compliance/reports", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Compliance"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Compliance"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -66,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Compliance"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Compliance"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +73,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Compliance"]]]: @@ -101,13 +97,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -116,7 +110,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Compliance"]]]: @@ -148,7 +142,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Compliance"]]]: @@ -172,20 +166,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Compliance"]]]: diff --git a/mattermost_api_reference_client/api/data_retention/add_channels_to_retention_policy.py b/mattermost_api_reference_client/api/data_retention/add_channels_to_retention_policy.py index 334caaf..f7c47b3 100644 --- a/mattermost_api_reference_client/api/data_retention/add_channels_to_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/add_channels_to_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/channels".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/channels".format( + policy_id=policy_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Add channels to a granular data retention policy @@ -97,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -112,7 +108,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Add channels to a granular data retention policy @@ -149,7 +145,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Add channels to a granular data retention policy @@ -178,12 +174,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -191,7 +185,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Add channels to a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/add_teams_to_retention_policy.py b/mattermost_api_reference_client/api/data_retention/add_teams_to_retention_policy.py index ab9ac08..c1e1550 100644 --- a/mattermost_api_reference_client/api/data_retention/add_teams_to_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/add_teams_to_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/teams".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/teams".format( + policy_id=policy_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Add teams to a granular data retention policy @@ -97,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -112,7 +108,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Add teams to a granular data retention policy @@ -149,7 +145,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Add teams to a granular data retention policy @@ -178,12 +174,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -191,7 +185,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Add teams to a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/create_data_retention_policy.py b/mattermost_api_reference_client/api/data_retention/create_data_retention_policy.py index 49440e0..0d43806 100644 --- a/mattermost_api_reference_client/api/data_retention/create_data_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/create_data_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.data_retention_policy_with_team_and_channel_counts import DataRetentionPolicyWithTeamAndChannelCounts from ...models.data_retention_policy_with_team_and_channel_ids import DataRetentionPolicyWithTeamAndChannelIds from ...types import Response @@ -12,29 +12,21 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies", "json": json_json_body, } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: if response.status_code == HTTPStatus.CREATED: response_201 = DataRetentionPolicyWithTeamAndChannelCounts.from_dict(response.json()) @@ -59,7 +51,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: return Response( status_code=HTTPStatus(response.status_code), @@ -71,7 +63,7 @@ def _build_response( def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Create a new granular data retention policy @@ -99,12 +91,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +103,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Create a new granular data retention policy @@ -148,7 +138,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Create a new granular data retention policy @@ -176,19 +166,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Create a new granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/delete_data_retention_policy.py b/mattermost_api_reference_client/api/data_retention/delete_data_retention_policy.py index a174382..c494938 100644 --- a/mattermost_api_reference_client/api/data_retention/delete_data_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/delete_data_retention_policy.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( policy_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}".format( + policy_id=policy_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a granular data retention policy @@ -91,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,7 +100,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a granular data retention policy @@ -139,7 +134,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a granular data retention policy @@ -166,11 +161,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -178,7 +171,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/get_channel_policies_for_user.py b/mattermost_api_reference_client/api/data_retention/get_channel_policies_for_user.py index ae39723..7eb684f 100644 --- a/mattermost_api_reference_client/api/data_retention/get_channel_policies_for_user.py +++ b/mattermost_api_reference_client/api/data_retention/get_channel_policies_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.retention_policy_for_channel_list import RetentionPolicyForChannelList from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( user_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/data_retention/channel_policies".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/data_retention/channel_policies".format( + user_id=user_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, RetentionPolicyForChannelList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, RetentionPolicyForChannelList]]: if response.status_code == HTTPStatus.OK: response_200 = RetentionPolicyForChannelList.from_dict(response.json()) @@ -62,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, RetentionPolicyForChannelList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, RetentionPolicyForChannelList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +72,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, RetentionPolicyForChannelList]]: @@ -105,13 +103,11 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -121,7 +117,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, RetentionPolicyForChannelList]]: @@ -161,7 +157,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, RetentionPolicyForChannelList]]: @@ -192,13 +188,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -206,7 +200,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, RetentionPolicyForChannelList]]: diff --git a/mattermost_api_reference_client/api/data_retention/get_channels_for_retention_policy.py b/mattermost_api_reference_client/api/data_retention/get_channels_for_retention_policy.py index 0235890..a7bd541 100644 --- a/mattermost_api_reference_client/api/data_retention/get_channels_for_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/get_channels_for_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_with_team_data import ChannelWithTeamData from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( policy_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/channels".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/channels".format( + policy_id=policy_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -69,7 +65,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelWithTeamData"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelWithTeamData"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,7 +79,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["ChannelWithTeamData"]]]: @@ -112,13 +110,11 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -128,7 +124,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: @@ -168,7 +164,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["ChannelWithTeamData"]]]: @@ -199,13 +195,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -213,7 +207,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: diff --git a/mattermost_api_reference_client/api/data_retention/get_data_retention_policies.py b/mattermost_api_reference_client/api/data_retention/get_data_retention_policies.py index 9f0855c..c9fc6f1 100644 --- a/mattermost_api_reference_client/api/data_retention/get_data_retention_policies.py +++ b/mattermost_api_reference_client/api/data_retention/get_data_retention_policies.py @@ -4,21 +4,17 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.data_retention_policy_with_team_and_channel_counts import DataRetentionPolicyWithTeamAndChannelCounts from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -29,17 +25,13 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies", "params": params, } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, List["DataRetentionPolicyWithTeamAndChannelCounts"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -69,7 +61,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, List["DataRetentionPolicyWithTeamAndChannelCounts"]]]: return Response( status_code=HTTPStatus(response.status_code), @@ -81,7 +73,7 @@ def _build_response( def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["DataRetentionPolicyWithTeamAndChannelCounts"]]]: @@ -111,13 +103,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -126,7 +116,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["DataRetentionPolicyWithTeamAndChannelCounts"]]]: @@ -164,7 +154,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["DataRetentionPolicyWithTeamAndChannelCounts"]]]: @@ -194,20 +184,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["DataRetentionPolicyWithTeamAndChannelCounts"]]]: diff --git a/mattermost_api_reference_client/api/data_retention/get_data_retention_policies_count.py b/mattermost_api_reference_client/api/data_retention/get_data_retention_policies_count.py index 113e83e..4aaa29f 100644 --- a/mattermost_api_reference_client/api/data_retention/get_data_retention_policies_count.py +++ b/mattermost_api_reference_client/api/data_retention/get_data_retention_policies_count.py @@ -4,32 +4,22 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.get_data_retention_policies_count_response_200 import GetDataRetentionPoliciesCountResponse200 from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies_count".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies_count", } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, GetDataRetentionPoliciesCountResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = GetDataRetentionPoliciesCountResponse200.from_dict(response.json()) @@ -54,7 +44,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, GetDataRetentionPoliciesCountResponse200]]: return Response( status_code=HTTPStatus(response.status_code), @@ -66,7 +56,7 @@ def _build_response( def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GetDataRetentionPoliciesCountResponse200]]: """Get the number of granular data retention policies @@ -89,12 +79,9 @@ def sync_detailed( Response[Union[Any, GetDataRetentionPoliciesCountResponse200]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +90,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GetDataRetentionPoliciesCountResponse200]]: """Get the number of granular data retention policies @@ -133,7 +120,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GetDataRetentionPoliciesCountResponse200]]: """Get the number of granular data retention policies @@ -156,19 +143,16 @@ async def asyncio_detailed( Response[Union[Any, GetDataRetentionPoliciesCountResponse200]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GetDataRetentionPoliciesCountResponse200]]: """Get the number of granular data retention policies diff --git a/mattermost_api_reference_client/api/data_retention/get_data_retention_policy.py b/mattermost_api_reference_client/api/data_retention/get_data_retention_policy.py index 2d9a9bc..7b7bd00 100644 --- a/mattermost_api_reference_client/api/data_retention/get_data_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/get_data_retention_policy.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.global_data_retention_policy import GlobalDataRetentionPolicy from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policy".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policy", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GlobalDataRetentionPolicy]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GlobalDataRetentionPolicy]]: if response.status_code == HTTPStatus.OK: response_200 = GlobalDataRetentionPolicy.from_dict(response.json()) @@ -51,7 +43,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GlobalDataRetentionPolicy]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GlobalDataRetentionPolicy]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +56,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GlobalDataRetentionPolicy]]: """Get the global data retention policy @@ -86,12 +80,9 @@ def sync_detailed( Response[Union[Any, GlobalDataRetentionPolicy]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +91,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GlobalDataRetentionPolicy]]: """Get the global data retention policy @@ -131,7 +122,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GlobalDataRetentionPolicy]]: """Get the global data retention policy @@ -155,19 +146,16 @@ async def asyncio_detailed( Response[Union[Any, GlobalDataRetentionPolicy]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GlobalDataRetentionPolicy]]: """Get the global data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/get_data_retention_policy_by_id.py b/mattermost_api_reference_client/api/data_retention/get_data_retention_policy_by_id.py index fc3e3d9..aa51464 100644 --- a/mattermost_api_reference_client/api/data_retention/get_data_retention_policy_by_id.py +++ b/mattermost_api_reference_client/api/data_retention/get_data_retention_policy_by_id.py @@ -4,33 +4,26 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.data_retention_policy_with_team_and_channel_counts import DataRetentionPolicyWithTeamAndChannelCounts from ...types import Response def _get_kwargs( policy_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}".format( + policy_id=policy_id, + ), } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: if response.status_code == HTTPStatus.OK: response_200 = DataRetentionPolicyWithTeamAndChannelCounts.from_dict(response.json()) @@ -55,7 +48,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: return Response( status_code=HTTPStatus(response.status_code), @@ -68,7 +61,7 @@ def _build_response( def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Get a granular data retention policy @@ -95,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +100,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Get a granular data retention policy @@ -143,7 +134,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Get a granular data retention policy @@ -170,11 +161,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -182,7 +171,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Get a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/get_team_policies_for_user.py b/mattermost_api_reference_client/api/data_retention/get_team_policies_for_user.py index 3720a78..a37694a 100644 --- a/mattermost_api_reference_client/api/data_retention/get_team_policies_for_user.py +++ b/mattermost_api_reference_client/api/data_retention/get_team_policies_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.retention_policy_for_team_list import RetentionPolicyForTeamList from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( user_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/data_retention/team_policies".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/data_retention/team_policies".format( + user_id=user_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, RetentionPolicyForTeamList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, RetentionPolicyForTeamList]]: if response.status_code == HTTPStatus.OK: response_200 = RetentionPolicyForTeamList.from_dict(response.json()) @@ -62,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, RetentionPolicyForTeamList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, RetentionPolicyForTeamList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +72,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, RetentionPolicyForTeamList]]: @@ -105,13 +103,11 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -121,7 +117,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, RetentionPolicyForTeamList]]: @@ -161,7 +157,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, RetentionPolicyForTeamList]]: @@ -192,13 +188,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -206,7 +200,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, RetentionPolicyForTeamList]]: diff --git a/mattermost_api_reference_client/api/data_retention/get_teams_for_retention_policy.py b/mattermost_api_reference_client/api/data_retention/get_teams_for_retention_policy.py index 80d2687..b5cd4f7 100644 --- a/mattermost_api_reference_client/api/data_retention/get_teams_for_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/get_teams_for_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.team import Team from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( policy_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/teams".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/teams".format( + policy_id=policy_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Team"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Team"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -67,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Team"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Team"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +77,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Team"]]]: @@ -110,13 +108,11 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -126,7 +122,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Team"]]]: @@ -166,7 +162,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Team"]]]: @@ -197,13 +193,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -211,7 +205,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Team"]]]: diff --git a/mattermost_api_reference_client/api/data_retention/patch_data_retention_policy.py b/mattermost_api_reference_client/api/data_retention/patch_data_retention_policy.py index 908ec38..cf2e8f8 100644 --- a/mattermost_api_reference_client/api/data_retention/patch_data_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/patch_data_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.data_retention_policy_with_team_and_channel_counts import DataRetentionPolicyWithTeamAndChannelCounts from ...models.data_retention_policy_with_team_and_channel_ids import DataRetentionPolicyWithTeamAndChannelIds from ...types import Response @@ -13,29 +13,23 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "patch", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}".format( + policy_id=policy_id, + ), "json": json_json_body, } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: if response.status_code == HTTPStatus.OK: response_200 = DataRetentionPolicyWithTeamAndChannelCounts.from_dict(response.json()) @@ -60,7 +54,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: return Response( status_code=HTTPStatus(response.status_code), @@ -73,7 +67,7 @@ def _build_response( def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Patch a granular data retention policy @@ -103,12 +97,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -118,7 +110,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Patch a granular data retention policy @@ -156,7 +148,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Response[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Patch a granular data retention policy @@ -186,12 +178,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -199,7 +189,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DataRetentionPolicyWithTeamAndChannelIds, ) -> Optional[Union[Any, DataRetentionPolicyWithTeamAndChannelCounts]]: """Patch a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/remove_channels_from_retention_policy.py b/mattermost_api_reference_client/api/data_retention/remove_channels_from_retention_policy.py index 41a4cfd..b2fbea7 100644 --- a/mattermost_api_reference_client/api/data_retention/remove_channels_from_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/remove_channels_from_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/channels".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/channels".format( + policy_id=policy_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Delete channels from a granular data retention policy @@ -97,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -112,7 +108,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Delete channels from a granular data retention policy @@ -149,7 +145,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Delete channels from a granular data retention policy @@ -178,12 +174,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -191,7 +185,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Delete channels from a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/remove_teams_from_retention_policy.py b/mattermost_api_reference_client/api/data_retention/remove_teams_from_retention_policy.py index bee9538..3609d64 100644 --- a/mattermost_api_reference_client/api/data_retention/remove_teams_from_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/remove_teams_from_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,28 +12,24 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/teams".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/teams".format( + policy_id=policy_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Delete teams from a granular data retention policy @@ -97,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -112,7 +108,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Delete teams from a granular data retention policy @@ -149,7 +145,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, StatusOK]]: """Delete teams from a granular data retention policy @@ -178,12 +174,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -191,7 +185,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, StatusOK]]: """Delete teams from a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/search_channels_for_retention_policy.py b/mattermost_api_reference_client/api/data_retention/search_channels_for_retention_policy.py index b19bc52..8b98643 100644 --- a/mattermost_api_reference_client/api/data_retention/search_channels_for_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/search_channels_for_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_with_team_data import ChannelWithTeamData from ...models.search_channels_for_retention_policy_json_body import SearchChannelsForRetentionPolicyJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: SearchChannelsForRetentionPolicyJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/channels/search".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/channels/search".format( + policy_id=policy_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -64,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["ChannelWithTeamData"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["ChannelWithTeamData"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +74,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsForRetentionPolicyJsonBody, ) -> Response[Union[Any, List["ChannelWithTeamData"]]]: """Search for the channels in a granular data retention policy @@ -105,12 +103,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -120,7 +116,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsForRetentionPolicyJsonBody, ) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: """Search for the channels in a granular data retention policy @@ -157,7 +153,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsForRetentionPolicyJsonBody, ) -> Response[Union[Any, List["ChannelWithTeamData"]]]: """Search for the channels in a granular data retention policy @@ -186,12 +182,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -199,7 +193,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchChannelsForRetentionPolicyJsonBody, ) -> Optional[Union[Any, List["ChannelWithTeamData"]]]: """Search for the channels in a granular data retention policy diff --git a/mattermost_api_reference_client/api/data_retention/search_teams_for_retention_policy.py b/mattermost_api_reference_client/api/data_retention/search_teams_for_retention_policy.py index 57bcb75..678f7d9 100644 --- a/mattermost_api_reference_client/api/data_retention/search_teams_for_retention_policy.py +++ b/mattermost_api_reference_client/api/data_retention/search_teams_for_retention_policy.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.search_teams_for_retention_policy_json_body import SearchTeamsForRetentionPolicyJsonBody from ...models.team import Team from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( policy_id: str, *, - client: Client, json_body: SearchTeamsForRetentionPolicyJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/data_retention/policies/{policy_id}/teams/search".format(client.base_url, policy_id=policy_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/data_retention/policies/{policy_id}/teams/search".format( + policy_id=policy_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Team"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Team"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -62,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Team"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Team"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +72,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchTeamsForRetentionPolicyJsonBody, ) -> Response[Union[Any, List["Team"]]]: """Search for the teams in a granular data retention policy @@ -103,12 +101,10 @@ def sync_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -118,7 +114,7 @@ def sync_detailed( def sync( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchTeamsForRetentionPolicyJsonBody, ) -> Optional[Union[Any, List["Team"]]]: """Search for the teams in a granular data retention policy @@ -155,7 +151,7 @@ def sync( async def asyncio_detailed( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchTeamsForRetentionPolicyJsonBody, ) -> Response[Union[Any, List["Team"]]]: """Search for the teams in a granular data retention policy @@ -184,12 +180,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( policy_id=policy_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -197,7 +191,7 @@ async def asyncio_detailed( async def asyncio( policy_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchTeamsForRetentionPolicyJsonBody, ) -> Optional[Union[Any, List["Team"]]]: """Search for the teams in a granular data retention policy diff --git a/mattermost_api_reference_client/api/elasticsearch/purge_elasticsearch_indexes.py b/mattermost_api_reference_client/api/elasticsearch/purge_elasticsearch_indexes.py index bc818b0..c71918d 100644 --- a/mattermost_api_reference_client/api/elasticsearch/purge_elasticsearch_indexes.py +++ b/mattermost_api_reference_client/api/elasticsearch/purge_elasticsearch_indexes.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/elasticsearch/purge_indexes".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/elasticsearch/purge_indexes", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -45,7 +37,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -56,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Purge all Elasticsearch indexes @@ -74,12 +68,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -88,7 +79,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Purge all Elasticsearch indexes @@ -113,7 +104,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Purge all Elasticsearch indexes @@ -131,19 +122,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Purge all Elasticsearch indexes diff --git a/mattermost_api_reference_client/api/elasticsearch/test_elasticsearch.py b/mattermost_api_reference_client/api/elasticsearch/test_elasticsearch.py index 4ed2f0c..9e7585a 100644 --- a/mattermost_api_reference_client/api/elasticsearch/test_elasticsearch.py +++ b/mattermost_api_reference_client/api/elasticsearch/test_elasticsearch.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/elasticsearch/test".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/elasticsearch/test", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -48,7 +40,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +53,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Test Elasticsearch configuration @@ -81,12 +75,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -95,7 +86,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Test Elasticsearch configuration @@ -124,7 +115,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Test Elasticsearch configuration @@ -146,19 +137,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Test Elasticsearch configuration diff --git a/mattermost_api_reference_client/api/emoji/autocomplete_emoji.py b/mattermost_api_reference_client/api/emoji/autocomplete_emoji.py index 1f57fec..172722c 100644 --- a/mattermost_api_reference_client/api/emoji/autocomplete_emoji.py +++ b/mattermost_api_reference_client/api/emoji/autocomplete_emoji.py @@ -4,20 +4,16 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.emoji import Emoji from ...types import UNSET, Response def _get_kwargs( *, - client: Client, name: str, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji/autocomplete".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["name"] = name @@ -26,16 +22,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji/autocomplete", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Emoji]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Emoji]]: if response.status_code == HTTPStatus.OK: response_200 = Emoji.from_dict(response.json()) @@ -58,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Emoji]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Emoji]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +65,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Response[Union[Any, Emoji]]: """Autocomplete custom emoji @@ -93,12 +89,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, name=name, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +101,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Optional[Union[Any, Emoji]]: """Autocomplete custom emoji @@ -138,7 +132,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Response[Union[Any, Emoji]]: """Autocomplete custom emoji @@ -162,19 +156,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, name=name, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], name: str, ) -> Optional[Union[Any, Emoji]]: """Autocomplete custom emoji diff --git a/mattermost_api_reference_client/api/emoji/create_emoji.py b/mattermost_api_reference_client/api/emoji/create_emoji.py index 6461399..58aa56e 100644 --- a/mattermost_api_reference_client/api/emoji/create_emoji.py +++ b/mattermost_api_reference_client/api/emoji/create_emoji.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.create_emoji_multipart_data import CreateEmojiMultipartData from ...models.emoji import Emoji from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, multipart_data: CreateEmojiMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji", "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Emoji]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Emoji]]: if response.status_code == HTTPStatus.CREATED: response_201 = Emoji.from_dict(response.json()) @@ -59,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Emoji]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Emoji]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: CreateEmojiMultipartData, ) -> Response[Union[Any, Emoji]]: """Create a custom emoji @@ -91,12 +87,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,7 +99,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: CreateEmojiMultipartData, ) -> Optional[Union[Any, Emoji]]: """Create a custom emoji @@ -133,7 +127,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: CreateEmojiMultipartData, ) -> Response[Union[Any, Emoji]]: """Create a custom emoji @@ -154,19 +148,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: CreateEmojiMultipartData, ) -> Optional[Union[Any, Emoji]]: """Create a custom emoji diff --git a/mattermost_api_reference_client/api/emoji/delete_emoji.py b/mattermost_api_reference_client/api/emoji/delete_emoji.py index 6dbc625..32daac4 100644 --- a/mattermost_api_reference_client/api/emoji/delete_emoji.py +++ b/mattermost_api_reference_client/api/emoji/delete_emoji.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.emoji import Emoji from ...types import Response def _get_kwargs( emoji_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji/{emoji_id}".format(client.base_url, emoji_id=emoji_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji/{emoji_id}".format( + emoji_id=emoji_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Emoji]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Emoji]]: if response.status_code == HTTPStatus.OK: response_200 = Emoji.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Emoji]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Emoji]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Emoji]]: """Delete a custom emoji @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( emoji_id=emoji_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Emoji]]: """Delete a custom emoji @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Emoji]]: """Delete a custom emoji @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( emoji_id=emoji_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Emoji]]: """Delete a custom emoji diff --git a/mattermost_api_reference_client/api/emoji/get_emoji.py b/mattermost_api_reference_client/api/emoji/get_emoji.py index f32df38..5f71cc0 100644 --- a/mattermost_api_reference_client/api/emoji/get_emoji.py +++ b/mattermost_api_reference_client/api/emoji/get_emoji.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.emoji import Emoji from ...types import Response def _get_kwargs( emoji_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji/{emoji_id}".format(client.base_url, emoji_id=emoji_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji/{emoji_id}".format( + emoji_id=emoji_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Emoji]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Emoji]]: if response.status_code == HTTPStatus.OK: response_200 = Emoji.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Emoji]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Emoji]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Emoji]]: """Get a custom emoji @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( emoji_id=emoji_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Emoji]]: """Get a custom emoji @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Emoji]]: """Get a custom emoji @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( emoji_id=emoji_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Emoji]]: """Get a custom emoji diff --git a/mattermost_api_reference_client/api/emoji/get_emoji_by_name.py b/mattermost_api_reference_client/api/emoji/get_emoji_by_name.py index 7ea01ff..778a581 100644 --- a/mattermost_api_reference_client/api/emoji/get_emoji_by_name.py +++ b/mattermost_api_reference_client/api/emoji/get_emoji_by_name.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.emoji import Emoji from ...types import Response def _get_kwargs( emoji_name: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji/name/{emoji_name}".format(client.base_url, emoji_name=emoji_name) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji/name/{emoji_name}".format( + emoji_name=emoji_name, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Emoji]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Emoji]]: if response.status_code == HTTPStatus.OK: response_200 = Emoji.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Emoji]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Emoji]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( emoji_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Emoji]]: """Get a custom emoji by name @@ -87,11 +84,9 @@ def sync_detailed( kwargs = _get_kwargs( emoji_name=emoji_name, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -101,7 +96,7 @@ def sync_detailed( def sync( emoji_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Emoji]]: """Get a custom emoji by name @@ -131,7 +126,7 @@ def sync( async def asyncio_detailed( emoji_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Emoji]]: """Get a custom emoji by name @@ -154,11 +149,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( emoji_name=emoji_name, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -166,7 +159,7 @@ async def asyncio_detailed( async def asyncio( emoji_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Emoji]]: """Get a custom emoji by name diff --git a/mattermost_api_reference_client/api/emoji/get_emoji_image.py b/mattermost_api_reference_client/api/emoji/get_emoji_image.py index ac5496b..e1c4799 100644 --- a/mattermost_api_reference_client/api/emoji/get_emoji_image.py +++ b/mattermost_api_reference_client/api/emoji/get_emoji_image.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( emoji_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji/{emoji_id}/image".format(client.base_url, emoji_id=emoji_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji/{emoji_id}/image".format( + emoji_id=emoji_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -47,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +52,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get custom emoji image @@ -80,11 +73,9 @@ def sync_detailed( kwargs = _get_kwargs( emoji_id=emoji_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -94,7 +85,7 @@ def sync_detailed( async def asyncio_detailed( emoji_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get custom emoji image @@ -115,10 +106,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( emoji_id=emoji_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/emoji/get_emoji_list.py b/mattermost_api_reference_client/api/emoji/get_emoji_list.py index 32cf50b..b01e12b 100644 --- a/mattermost_api_reference_client/api/emoji/get_emoji_list.py +++ b/mattermost_api_reference_client/api/emoji/get_emoji_list.py @@ -4,22 +4,18 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.emoji import Emoji from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, sort: Union[Unset, None, str] = "", ) -> Dict[str, Any]: - url = "{}/api/v4/emoji".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -32,16 +28,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Emoji]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Emoji]]: if response.status_code == HTTPStatus.OK: response_200 = Emoji.from_dict(response.json()) @@ -64,7 +58,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Emoji]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Emoji]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,7 +71,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, sort: Union[Unset, None, str] = "", @@ -101,14 +97,12 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, sort=sort, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,7 +111,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, sort: Union[Unset, None, str] = "", @@ -152,7 +146,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, sort: Union[Unset, None, str] = "", @@ -178,21 +172,19 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, sort=sort, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, sort: Union[Unset, None, str] = "", diff --git a/mattermost_api_reference_client/api/emoji/search_emoji.py b/mattermost_api_reference_client/api/emoji/search_emoji.py index 6b979b0..4ebaab0 100644 --- a/mattermost_api_reference_client/api/emoji/search_emoji.py +++ b/mattermost_api_reference_client/api/emoji/search_emoji.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.emoji import Emoji from ...models.search_emoji_json_body import SearchEmojiJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: SearchEmojiJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/emoji/search".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/emoji/search", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Emoji"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Emoji"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -61,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Emoji"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Emoji"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +68,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchEmojiJsonBody, ) -> Response[Union[Any, List["Emoji"]]]: """Search custom emoji @@ -96,12 +92,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +104,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchEmojiJsonBody, ) -> Optional[Union[Any, List["Emoji"]]]: """Search custom emoji @@ -141,7 +135,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchEmojiJsonBody, ) -> Response[Union[Any, List["Emoji"]]]: """Search custom emoji @@ -165,19 +159,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchEmojiJsonBody, ) -> Optional[Union[Any, List["Emoji"]]]: """Search custom emoji diff --git a/mattermost_api_reference_client/api/exports/delete_export.py b/mattermost_api_reference_client/api/exports/delete_export.py index 1f8a92f..569ca28 100644 --- a/mattermost_api_reference_client/api/exports/delete_export.py +++ b/mattermost_api_reference_client/api/exports/delete_export.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( export_name: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/exports/{export_name}".format(client.base_url, export_name=export_name) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/exports/{export_name}".format( + export_name=export_name, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -43,7 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -55,7 +48,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( export_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Delete an export file @@ -81,11 +74,9 @@ def sync_detailed( kwargs = _get_kwargs( export_name=export_name, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -95,7 +86,7 @@ def sync_detailed( async def asyncio_detailed( export_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Delete an export file @@ -121,10 +112,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( export_name=export_name, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/exports/download_export.py b/mattermost_api_reference_client/api/exports/download_export.py index 9f0643a..1cbe337 100644 --- a/mattermost_api_reference_client/api/exports/download_export.py +++ b/mattermost_api_reference_client/api/exports/download_export.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( export_name: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/exports/{export_name}".format(client.base_url, export_name=export_name) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/exports/{export_name}".format( + export_name=export_name, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -45,7 +38,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -57,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( export_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Download an export file @@ -83,11 +76,9 @@ def sync_detailed( kwargs = _get_kwargs( export_name=export_name, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +88,7 @@ def sync_detailed( async def asyncio_detailed( export_name: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Download an export file @@ -123,10 +114,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( export_name=export_name, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/exports/list_exports.py b/mattermost_api_reference_client/api/exports/list_exports.py index 8ecf543..89164ab 100644 --- a/mattermost_api_reference_client/api/exports/list_exports.py +++ b/mattermost_api_reference_client/api/exports/list_exports.py @@ -1,33 +1,23 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/exports".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/exports", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -42,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +43,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """List export files @@ -70,12 +60,9 @@ def sync_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -84,7 +71,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """List export files @@ -101,11 +88,8 @@ async def asyncio_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/files/get_file.py b/mattermost_api_reference_client/api/files/get_file.py index 66614d4..549a4ac 100644 --- a/mattermost_api_reference_client/api/files/get_file.py +++ b/mattermost_api_reference_client/api/files/get_file.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.app_error import AppError from ...types import Response def _get_kwargs( file_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/files/{file_id}".format(client.base_url, file_id=file_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/files/{file_id}".format( + file_id=file_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, AppError]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, AppError]]: if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, AppError]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, AppError]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError]]: """Get a file @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError]]: """Get a file @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError]]: """Get a file @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError]]: """Get a file diff --git a/mattermost_api_reference_client/api/files/get_file_info.py b/mattermost_api_reference_client/api/files/get_file_info.py index 23170e3..7bc7593 100644 --- a/mattermost_api_reference_client/api/files/get_file_info.py +++ b/mattermost_api_reference_client/api/files/get_file_info.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.app_error import AppError from ...models.file_info import FileInfo from ...types import Response @@ -12,25 +12,20 @@ from ...types import Response def _get_kwargs( file_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/files/{file_id}/info".format(client.base_url, file_id=file_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/files/{file_id}/info".format( + file_id=file_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, AppError, FileInfo]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, AppError, FileInfo]]: if response.status_code == HTTPStatus.OK: response_200 = FileInfo.from_dict(response.json()) @@ -57,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, AppError, FileInfo]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, AppError, FileInfo]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError, FileInfo]]: """Get metadata for a file @@ -90,11 +87,9 @@ def sync_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +99,7 @@ def sync_detailed( def sync( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError, FileInfo]]: """Get metadata for a file @@ -132,7 +127,7 @@ def sync( async def asyncio_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError, FileInfo]]: """Get metadata for a file @@ -153,11 +148,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -165,7 +158,7 @@ async def asyncio_detailed( async def asyncio( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError, FileInfo]]: """Get metadata for a file diff --git a/mattermost_api_reference_client/api/files/get_file_link.py b/mattermost_api_reference_client/api/files/get_file_link.py index 23a7df3..931a421 100644 --- a/mattermost_api_reference_client/api/files/get_file_link.py +++ b/mattermost_api_reference_client/api/files/get_file_link.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.app_error import AppError from ...models.get_file_link_response_200 import GetFileLinkResponse200 from ...types import Response @@ -12,26 +12,19 @@ from ...types import Response def _get_kwargs( file_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/files/{file_id}/link".format(client.base_url, file_id=file_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/files/{file_id}/link".format( + file_id=file_id, + ), } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, AppError, GetFileLinkResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = GetFileLinkResponse200.from_dict(response.json()) @@ -60,7 +53,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, AppError, GetFileLinkResponse200]]: return Response( status_code=HTTPStatus(response.status_code), @@ -73,7 +66,7 @@ def _build_response( def sync_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError, GetFileLinkResponse200]]: """Get a public file link @@ -94,11 +87,9 @@ def sync_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +99,7 @@ def sync_detailed( def sync( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError, GetFileLinkResponse200]]: """Get a public file link @@ -136,7 +127,7 @@ def sync( async def asyncio_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError, GetFileLinkResponse200]]: """Get a public file link @@ -157,11 +148,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -169,7 +158,7 @@ async def asyncio_detailed( async def asyncio( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError, GetFileLinkResponse200]]: """Get a public file link diff --git a/mattermost_api_reference_client/api/files/get_file_preview.py b/mattermost_api_reference_client/api/files/get_file_preview.py index 11263a5..71285a4 100644 --- a/mattermost_api_reference_client/api/files/get_file_preview.py +++ b/mattermost_api_reference_client/api/files/get_file_preview.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.app_error import AppError from ...types import Response def _get_kwargs( file_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/files/{file_id}/preview".format(client.base_url, file_id=file_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/files/{file_id}/preview".format( + file_id=file_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, AppError]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, AppError]]: if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, AppError]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, AppError]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError]]: """Get a file's preview @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError]]: """Get a file's preview @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError]]: """Get a file's preview @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError]]: """Get a file's preview diff --git a/mattermost_api_reference_client/api/files/get_file_public.py b/mattermost_api_reference_client/api/files/get_file_public.py index 20e1119..0e80a74 100644 --- a/mattermost_api_reference_client/api/files/get_file_public.py +++ b/mattermost_api_reference_client/api/files/get_file_public.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.app_error import AppError from ...types import UNSET, Response @@ -12,13 +12,9 @@ from ...types import UNSET, Response def _get_kwargs( file_id: str, *, - client: Client, h: str, ) -> Dict[str, Any]: - url = "{}/api/v4/files/{file_id}/public".format(client.base_url, file_id=file_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["h"] = h @@ -27,16 +23,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/files/{file_id}/public".format( + file_id=file_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, AppError]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, AppError]]: if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 @@ -59,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, AppError]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, AppError]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +69,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], h: str, ) -> Response[Union[Any, AppError]]: """Get a public file @@ -93,12 +91,10 @@ def sync_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, h=h, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync_detailed( def sync( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], h: str, ) -> Optional[Union[Any, AppError]]: """Get a public file @@ -138,7 +134,7 @@ def sync( async def asyncio_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], h: str, ) -> Response[Union[Any, AppError]]: """Get a public file @@ -160,12 +156,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, h=h, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -173,7 +167,7 @@ async def asyncio_detailed( async def asyncio( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], h: str, ) -> Optional[Union[Any, AppError]]: """Get a public file diff --git a/mattermost_api_reference_client/api/files/get_file_thumbnail.py b/mattermost_api_reference_client/api/files/get_file_thumbnail.py index 828e386..b57875f 100644 --- a/mattermost_api_reference_client/api/files/get_file_thumbnail.py +++ b/mattermost_api_reference_client/api/files/get_file_thumbnail.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.app_error import AppError from ...types import Response def _get_kwargs( file_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/files/{file_id}/thumbnail".format(client.base_url, file_id=file_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/files/{file_id}/thumbnail".format( + file_id=file_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, AppError]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, AppError]]: if response.status_code == HTTPStatus.BAD_REQUEST: response_400 = cast(Any, None) return response_400 @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, AppError]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, AppError]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError]]: """Get a file's thumbnail @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError]]: """Get a file's thumbnail @@ -127,7 +122,7 @@ def sync( async def asyncio_detailed( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, AppError]]: """Get a file's thumbnail @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( file_id=file_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( file_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, AppError]]: """Get a file's thumbnail diff --git a/mattermost_api_reference_client/api/files/upload_file.py b/mattermost_api_reference_client/api/files/upload_file.py index 55f6b13..a9b2126 100644 --- a/mattermost_api_reference_client/api/files/upload_file.py +++ b/mattermost_api_reference_client/api/files/upload_file.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.upload_file_multipart_data import UploadFileMultipartData from ...models.upload_file_response_201 import UploadFileResponse201 from ...types import UNSET, Response, Unset @@ -12,15 +12,11 @@ from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, multipart_data: UploadFileMultipartData, channel_id: Union[Unset, None, str] = UNSET, filename: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/files".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["channel_id"] = channel_id @@ -33,17 +29,15 @@ def _get_kwargs( return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/files", "files": multipart_multipart_data, "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, UploadFileResponse201]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, UploadFileResponse201]]: if response.status_code == HTTPStatus.CREATED: response_201 = UploadFileResponse201.from_dict(response.json()) @@ -69,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, UploadFileResponse201]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, UploadFileResponse201]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -80,7 +76,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadFileMultipartData, channel_id: Union[Unset, None, str] = UNSET, filename: Union[Unset, None, str] = UNSET, @@ -113,14 +109,12 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, channel_id=channel_id, filename=filename, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -129,7 +123,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadFileMultipartData, channel_id: Union[Unset, None, str] = UNSET, filename: Union[Unset, None, str] = UNSET, @@ -171,7 +165,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadFileMultipartData, channel_id: Union[Unset, None, str] = UNSET, filename: Union[Unset, None, str] = UNSET, @@ -204,21 +198,19 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, channel_id=channel_id, filename=filename, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadFileMultipartData, channel_id: Union[Unset, None, str] = UNSET, filename: Union[Unset, None, str] = UNSET, diff --git a/mattermost_api_reference_client/api/groups/add_group_members.py b/mattermost_api_reference_client/api/groups/add_group_members.py index ecc3825..49892aa 100644 --- a/mattermost_api_reference_client/api/groups/add_group_members.py +++ b/mattermost_api_reference_client/api/groups/add_group_members.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.add_group_members_json_body import AddGroupMembersJsonBody from ...models.status_ok import StatusOK from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( group_id: str, *, - client: Client, json_body: AddGroupMembersJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/members".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/members".format( + group_id=group_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddGroupMembersJsonBody, ) -> Response[Union[Any, StatusOK]]: """Adds members to a custom group @@ -93,12 +91,10 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddGroupMembersJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Adds members to a custom group @@ -143,7 +139,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddGroupMembersJsonBody, ) -> Response[Union[Any, StatusOK]]: """Adds members to a custom group @@ -170,12 +166,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -183,7 +177,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: AddGroupMembersJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Adds members to a custom group diff --git a/mattermost_api_reference_client/api/groups/create_group.py b/mattermost_api_reference_client/api/groups/create_group.py index c177032..ee70e81 100644 --- a/mattermost_api_reference_client/api/groups/create_group.py +++ b/mattermost_api_reference_client/api/groups/create_group.py @@ -1,38 +1,30 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.create_group_json_body import CreateGroupJsonBody from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreateGroupJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/groups".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.CREATED: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -47,7 +39,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateGroupJsonBody, ) -> Response[Any]: """Create a custom group @@ -82,12 +74,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +86,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateGroupJsonBody, ) -> Response[Any]: """Create a custom group @@ -120,11 +110,9 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/groups/delete_group.py b/mattermost_api_reference_client/api/groups/delete_group.py index 59b649b..b649ac8 100644 --- a/mattermost_api_reference_client/api/groups/delete_group.py +++ b/mattermost_api_reference_client/api/groups/delete_group.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( group_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}".format( + group_id=group_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Deletes a custom group @@ -85,11 +82,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +94,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Deletes a custom group @@ -130,7 +125,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Deletes a custom group @@ -154,11 +149,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -166,7 +159,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Deletes a custom group diff --git a/mattermost_api_reference_client/api/groups/delete_group_members.py b/mattermost_api_reference_client/api/groups/delete_group_members.py index 4ba38aa..47fc85f 100644 --- a/mattermost_api_reference_client/api/groups/delete_group_members.py +++ b/mattermost_api_reference_client/api/groups/delete_group_members.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.delete_group_members_json_body import DeleteGroupMembersJsonBody from ...models.status_ok import StatusOK from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( group_id: str, *, - client: Client, json_body: DeleteGroupMembersJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/members".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/members".format( + group_id=group_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DeleteGroupMembersJsonBody, ) -> Response[Union[Any, StatusOK]]: """Removes members from a custom group @@ -93,12 +91,10 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DeleteGroupMembersJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Removes members from a custom group @@ -143,7 +139,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DeleteGroupMembersJsonBody, ) -> Response[Union[Any, StatusOK]]: """Removes members from a custom group @@ -170,12 +166,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -183,7 +177,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: DeleteGroupMembersJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Removes members from a custom group diff --git a/mattermost_api_reference_client/api/groups/get_group.py b/mattermost_api_reference_client/api/groups/get_group.py index 2822417..9e34b0a 100644 --- a/mattermost_api_reference_client/api/groups/get_group.py +++ b/mattermost_api_reference_client/api/groups/get_group.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group import Group from ...types import Response def _get_kwargs( group_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}".format( + group_id=group_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Group]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Group]]: if response.status_code == HTTPStatus.OK: response_200 = Group.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Group]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Group]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Group]]: """Get a group @@ -88,11 +85,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +97,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Group]]: """Get a group @@ -133,7 +128,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Group]]: """Get a group @@ -157,11 +152,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -169,7 +162,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Group]]: """Get a group diff --git a/mattermost_api_reference_client/api/groups/get_group_stats.py b/mattermost_api_reference_client/api/groups/get_group_stats.py index 19b0d37..fa43ff8 100644 --- a/mattermost_api_reference_client/api/groups/get_group_stats.py +++ b/mattermost_api_reference_client/api/groups/get_group_stats.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.get_group_stats_response_200 import GetGroupStatsResponse200 from ...types import Response def _get_kwargs( group_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/stats".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/stats".format( + group_id=group_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GetGroupStatsResponse200]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GetGroupStatsResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = GetGroupStatsResponse200.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GetGroupStatsResponse200]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GetGroupStatsResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GetGroupStatsResponse200]]: """Get group stats @@ -91,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,7 +100,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GetGroupStatsResponse200]]: """Get group stats @@ -136,7 +131,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GetGroupStatsResponse200]]: """Get group stats @@ -160,11 +155,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -172,7 +165,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GetGroupStatsResponse200]]: """Get group stats diff --git a/mattermost_api_reference_client/api/groups/get_group_syncable_for_channel_id.py b/mattermost_api_reference_client/api/groups/get_group_syncable_for_channel_id.py index 280f8fa..a56b1a9 100644 --- a/mattermost_api_reference_client/api/groups/get_group_syncable_for_channel_id.py +++ b/mattermost_api_reference_client/api/groups/get_group_syncable_for_channel_id.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_channel import GroupSyncableChannel from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( group_id: str, channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/channels/{channel_id}".format( - client.base_url, group_id=group_id, channel_id=channel_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/channels/{channel_id}".format( + group_id=group_id, + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GroupSyncableChannel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GroupSyncableChannel]]: if response.status_code == HTTPStatus.OK: response_200 = GroupSyncableChannel.from_dict(response.json()) @@ -58,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GroupSyncableChannel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GroupSyncableChannel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +67,7 @@ def sync_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableChannel]]: """Get GroupSyncable from channel ID @@ -96,11 +92,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +105,7 @@ def sync( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableChannel]]: """Get GroupSyncable from channel ID @@ -144,7 +138,7 @@ async def asyncio_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableChannel]]: """Get GroupSyncable from channel ID @@ -169,11 +163,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -182,7 +174,7 @@ async def asyncio( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableChannel]]: """Get GroupSyncable from channel ID diff --git a/mattermost_api_reference_client/api/groups/get_group_syncable_for_team_id.py b/mattermost_api_reference_client/api/groups/get_group_syncable_for_team_id.py index a210304..e355567 100644 --- a/mattermost_api_reference_client/api/groups/get_group_syncable_for_team_id.py +++ b/mattermost_api_reference_client/api/groups/get_group_syncable_for_team_id.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_team import GroupSyncableTeam from ...types import Response @@ -12,25 +12,21 @@ from ...types import Response def _get_kwargs( group_id: str, team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/teams/{team_id}".format(client.base_url, group_id=group_id, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/teams/{team_id}".format( + group_id=group_id, + team_id=team_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GroupSyncableTeam]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GroupSyncableTeam]]: if response.status_code == HTTPStatus.OK: response_200 = GroupSyncableTeam.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GroupSyncableTeam]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GroupSyncableTeam]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def sync_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableTeam]]: """Get GroupSyncable from Team ID @@ -94,11 +92,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +105,7 @@ def sync( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableTeam]]: """Get GroupSyncable from Team ID @@ -142,7 +138,7 @@ async def asyncio_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableTeam]]: """Get GroupSyncable from Team ID @@ -167,11 +163,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -180,7 +174,7 @@ async def asyncio( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableTeam]]: """Get GroupSyncable from Team ID diff --git a/mattermost_api_reference_client/api/groups/get_group_syncables_channels.py b/mattermost_api_reference_client/api/groups/get_group_syncables_channels.py index 008e32a..6cafcb4 100644 --- a/mattermost_api_reference_client/api/groups/get_group_syncables_channels.py +++ b/mattermost_api_reference_client/api/groups/get_group_syncables_channels.py @@ -4,32 +4,27 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_channels import GroupSyncableChannels from ...types import Response def _get_kwargs( group_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/channels".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/channels".format( + group_id=group_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["GroupSyncableChannels"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["GroupSyncableChannels"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -60,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["GroupSyncableChannels"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["GroupSyncableChannels"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +69,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["GroupSyncableChannels"]]]: """Get group channels @@ -95,11 +92,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +104,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["GroupSyncableChannels"]]]: """Get group channels @@ -139,7 +134,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["GroupSyncableChannels"]]]: """Get group channels @@ -162,11 +157,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -174,7 +167,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["GroupSyncableChannels"]]]: """Get group channels diff --git a/mattermost_api_reference_client/api/groups/get_group_syncables_teams.py b/mattermost_api_reference_client/api/groups/get_group_syncables_teams.py index e1a807c..e0a9b79 100644 --- a/mattermost_api_reference_client/api/groups/get_group_syncables_teams.py +++ b/mattermost_api_reference_client/api/groups/get_group_syncables_teams.py @@ -4,32 +4,27 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_teams import GroupSyncableTeams from ...types import Response def _get_kwargs( group_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/teams".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/teams".format( + group_id=group_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["GroupSyncableTeams"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["GroupSyncableTeams"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -60,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["GroupSyncableTeams"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["GroupSyncableTeams"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +69,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["GroupSyncableTeams"]]]: """Get group teams @@ -95,11 +92,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +104,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["GroupSyncableTeams"]]]: """Get group teams @@ -139,7 +134,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["GroupSyncableTeams"]]]: """Get group teams @@ -162,11 +157,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -174,7 +167,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["GroupSyncableTeams"]]]: """Get group teams diff --git a/mattermost_api_reference_client/api/groups/get_group_users.py b/mattermost_api_reference_client/api/groups/get_group_users.py index 3f5dbe0..0b5620c 100644 --- a/mattermost_api_reference_client/api/groups/get_group_users.py +++ b/mattermost_api_reference_client/api/groups/get_group_users.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.get_group_users_response_200 import GetGroupUsersResponse200 from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( group_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/members".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/members".format( + group_id=group_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GetGroupUsersResponse200]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GetGroupUsersResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = GetGroupUsersResponse200.from_dict(response.json()) @@ -65,7 +61,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GetGroupUsersResponse200]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GetGroupUsersResponse200]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +75,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, GetGroupUsersResponse200]]: @@ -105,13 +103,11 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -121,7 +117,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, GetGroupUsersResponse200]]: @@ -158,7 +154,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, GetGroupUsersResponse200]]: @@ -186,13 +182,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -200,7 +194,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, GetGroupUsersResponse200]]: diff --git a/mattermost_api_reference_client/api/groups/get_groups.py b/mattermost_api_reference_client/api/groups/get_groups.py index 78629f0..e9c72ad 100644 --- a/mattermost_api_reference_client/api/groups/get_groups.py +++ b/mattermost_api_reference_client/api/groups/get_groups.py @@ -4,14 +4,13 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group import Group from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, q: Union[Unset, None, str] = UNSET, @@ -21,10 +20,7 @@ def _get_kwargs( since: Union[Unset, None, int] = UNSET, filter_allow_reference: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/groups".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -47,16 +43,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Group"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Group"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -84,7 +78,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Group"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Group"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -95,7 +91,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, q: Union[Unset, None, str] = UNSET, @@ -138,7 +134,6 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, q=q, @@ -149,8 +144,7 @@ def sync_detailed( filter_allow_reference=filter_allow_reference, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -159,7 +153,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, q: Union[Unset, None, str] = UNSET, @@ -216,7 +210,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, q: Union[Unset, None, str] = UNSET, @@ -259,7 +253,6 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, q=q, @@ -270,15 +263,14 @@ async def asyncio_detailed( filter_allow_reference=filter_allow_reference, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, q: Union[Unset, None, str] = UNSET, diff --git a/mattermost_api_reference_client/api/groups/get_groups_associated_to_channels_by_team.py b/mattermost_api_reference_client/api/groups/get_groups_associated_to_channels_by_team.py index ae7a3b0..07d8b9b 100644 --- a/mattermost_api_reference_client/api/groups/get_groups_associated_to_channels_by_team.py +++ b/mattermost_api_reference_client/api/groups/get_groups_associated_to_channels_by_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.get_groups_associated_to_channels_by_team_response_200 import ( GetGroupsAssociatedToChannelsByTeamResponse200, ) @@ -14,16 +14,12 @@ from ...types import UNSET, Response, Unset def _get_kwargs( team_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, paginate: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/groups_by_channels".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -38,17 +34,15 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/groups_by_channels".format( + team_id=team_id, + ), "params": params, } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, GetGroupsAssociatedToChannelsByTeamResponse200]]: if response.status_code == HTTPStatus.OK: response_200 = GetGroupsAssociatedToChannelsByTeamResponse200.from_dict(response.json()) @@ -76,7 +70,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, GetGroupsAssociatedToChannelsByTeamResponse200]]: return Response( status_code=HTTPStatus(response.status_code), @@ -89,7 +83,7 @@ def _build_response( def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -121,15 +115,13 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, filter_allow_reference=filter_allow_reference, paginate=paginate, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -139,7 +131,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -182,7 +174,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -214,15 +206,13 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, filter_allow_reference=filter_allow_reference, paginate=paginate, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -230,7 +220,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, diff --git a/mattermost_api_reference_client/api/groups/get_groups_by_channel.py b/mattermost_api_reference_client/api/groups/get_groups_by_channel.py index b8ea328..a5b3e07 100644 --- a/mattermost_api_reference_client/api/groups/get_groups_by_channel.py +++ b/mattermost_api_reference_client/api/groups/get_groups_by_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group import Group from ...types import UNSET, Response, Unset @@ -12,15 +12,11 @@ from ...types import UNSET, Response, Unset def _get_kwargs( channel_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/groups".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -33,16 +29,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/groups".format( + channel_id=channel_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Group"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Group"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -73,7 +69,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Group"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Group"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,7 +83,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -115,14 +113,12 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, page=page, per_page=per_page, filter_allow_reference=filter_allow_reference, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -132,7 +128,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -172,7 +168,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -202,14 +198,12 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, page=page, per_page=per_page, filter_allow_reference=filter_allow_reference, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -217,7 +211,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, diff --git a/mattermost_api_reference_client/api/groups/get_groups_by_team.py b/mattermost_api_reference_client/api/groups/get_groups_by_team.py index 1d85fb0..56302cd 100644 --- a/mattermost_api_reference_client/api/groups/get_groups_by_team.py +++ b/mattermost_api_reference_client/api/groups/get_groups_by_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group import Group from ...types import UNSET, Response, Unset @@ -12,15 +12,11 @@ from ...types import UNSET, Response, Unset def _get_kwargs( team_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/groups".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -33,16 +29,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/groups".format( + team_id=team_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Group"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Group"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -73,7 +69,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Group"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Group"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,7 +83,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -112,14 +110,12 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, filter_allow_reference=filter_allow_reference, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -129,7 +125,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -166,7 +162,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, @@ -193,14 +189,12 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, page=page, per_page=per_page, filter_allow_reference=filter_allow_reference, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -208,7 +202,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, filter_allow_reference: Union[Unset, None, bool] = False, diff --git a/mattermost_api_reference_client/api/groups/get_groups_by_user_id.py b/mattermost_api_reference_client/api/groups/get_groups_by_user_id.py index 2132004..1e3864b 100644 --- a/mattermost_api_reference_client/api/groups/get_groups_by_user_id.py +++ b/mattermost_api_reference_client/api/groups/get_groups_by_user_id.py @@ -4,32 +4,27 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group import Group from ...types import Response def _get_kwargs( user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/groups".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/groups".format( + user_id=user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Group"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Group"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -51,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Group"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Group"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +60,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Group"]]]: """Get groups for a userId @@ -84,11 +81,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -98,7 +93,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Group"]]]: """Get groups for a userId @@ -126,7 +121,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Group"]]]: """Get groups for a userId @@ -147,11 +142,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -159,7 +152,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Group"]]]: """Get groups for a userId diff --git a/mattermost_api_reference_client/api/groups/link_group_syncable_for_channel.py b/mattermost_api_reference_client/api/groups/link_group_syncable_for_channel.py index b214e76..bea8756 100644 --- a/mattermost_api_reference_client/api/groups/link_group_syncable_for_channel.py +++ b/mattermost_api_reference_client/api/groups/link_group_syncable_for_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_channel import GroupSyncableChannel from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( group_id: str, channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/channels/{channel_id}/link".format( - client.base_url, group_id=group_id, channel_id=channel_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/channels/{channel_id}/link".format( + group_id=group_id, + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GroupSyncableChannel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GroupSyncableChannel]]: if response.status_code == HTTPStatus.CREATED: response_201 = GroupSyncableChannel.from_dict(response.json()) @@ -55,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GroupSyncableChannel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GroupSyncableChannel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +64,7 @@ def sync_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableChannel]]: """Link a channel to a group @@ -94,11 +90,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +103,7 @@ def sync( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableChannel]]: """Link a channel to a group @@ -143,7 +137,7 @@ async def asyncio_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableChannel]]: """Link a channel to a group @@ -169,11 +163,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -182,7 +174,7 @@ async def asyncio( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableChannel]]: """Link a channel to a group diff --git a/mattermost_api_reference_client/api/groups/link_group_syncable_for_team.py b/mattermost_api_reference_client/api/groups/link_group_syncable_for_team.py index ec42b10..b8ecd02 100644 --- a/mattermost_api_reference_client/api/groups/link_group_syncable_for_team.py +++ b/mattermost_api_reference_client/api/groups/link_group_syncable_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_team import GroupSyncableTeam from ...types import Response @@ -12,25 +12,21 @@ from ...types import Response def _get_kwargs( group_id: str, team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/teams/{team_id}/link".format(client.base_url, group_id=group_id, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/teams/{team_id}/link".format( + group_id=group_id, + team_id=team_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GroupSyncableTeam]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GroupSyncableTeam]]: if response.status_code == HTTPStatus.CREATED: response_201 = GroupSyncableTeam.from_dict(response.json()) @@ -53,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GroupSyncableTeam]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GroupSyncableTeam]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def sync_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableTeam]]: """Link a team to a group @@ -91,11 +89,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +102,7 @@ def sync( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableTeam]]: """Link a team to a group @@ -139,7 +135,7 @@ async def asyncio_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, GroupSyncableTeam]]: """Link a team to a group @@ -164,11 +160,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -177,7 +171,7 @@ async def asyncio( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, GroupSyncableTeam]]: """Link a team to a group diff --git a/mattermost_api_reference_client/api/groups/patch_group.py b/mattermost_api_reference_client/api/groups/patch_group.py index 6931d49..66eca60 100644 --- a/mattermost_api_reference_client/api/groups/patch_group.py +++ b/mattermost_api_reference_client/api/groups/patch_group.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group import Group from ...models.patch_group_json_body import PatchGroupJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( group_id: str, *, - client: Client, json_body: PatchGroupJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/patch".format(client.base_url, group_id=group_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/patch".format( + group_id=group_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Group]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Group]]: if response.status_code == HTTPStatus.OK: response_200 = Group.from_dict(response.json()) @@ -57,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Group]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Group]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupJsonBody, ) -> Response[Union[Any, Group]]: """Patch a group @@ -97,12 +95,10 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -112,7 +108,7 @@ def sync_detailed( def sync( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupJsonBody, ) -> Optional[Union[Any, Group]]: """Patch a group @@ -148,7 +144,7 @@ def sync( async def asyncio_detailed( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupJsonBody, ) -> Response[Union[Any, Group]]: """Patch a group @@ -176,12 +172,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -189,7 +183,7 @@ async def asyncio_detailed( async def asyncio( group_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupJsonBody, ) -> Optional[Union[Any, Group]]: """Patch a group diff --git a/mattermost_api_reference_client/api/groups/patch_group_syncable_for_channel.py b/mattermost_api_reference_client/api/groups/patch_group_syncable_for_channel.py index bcef64e..7964096 100644 --- a/mattermost_api_reference_client/api/groups/patch_group_syncable_for_channel.py +++ b/mattermost_api_reference_client/api/groups/patch_group_syncable_for_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_channel import GroupSyncableChannel from ...models.patch_group_syncable_for_channel_json_body import PatchGroupSyncableForChannelJsonBody from ...types import Response @@ -14,30 +14,25 @@ def _get_kwargs( group_id: str, channel_id: str, *, - client: Client, json_body: PatchGroupSyncableForChannelJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/channels/{channel_id}/patch".format( - client.base_url, group_id=group_id, channel_id=channel_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/channels/{channel_id}/patch".format( + group_id=group_id, + channel_id=channel_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GroupSyncableChannel]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GroupSyncableChannel]]: if response.status_code == HTTPStatus.OK: response_200 = GroupSyncableChannel.from_dict(response.json()) @@ -60,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GroupSyncableChannel]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GroupSyncableChannel]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,7 +70,7 @@ def sync_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForChannelJsonBody, ) -> Response[Union[Any, GroupSyncableChannel]]: """Patch a GroupSyncable associated to Channel @@ -103,12 +100,10 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -119,7 +114,7 @@ def sync( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForChannelJsonBody, ) -> Optional[Union[Any, GroupSyncableChannel]]: """Patch a GroupSyncable associated to Channel @@ -158,7 +153,7 @@ async def asyncio_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForChannelJsonBody, ) -> Response[Union[Any, GroupSyncableChannel]]: """Patch a GroupSyncable associated to Channel @@ -188,12 +183,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -202,7 +195,7 @@ async def asyncio( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForChannelJsonBody, ) -> Optional[Union[Any, GroupSyncableChannel]]: """Patch a GroupSyncable associated to Channel diff --git a/mattermost_api_reference_client/api/groups/patch_group_syncable_for_team.py b/mattermost_api_reference_client/api/groups/patch_group_syncable_for_team.py index cb254d3..be5e0e7 100644 --- a/mattermost_api_reference_client/api/groups/patch_group_syncable_for_team.py +++ b/mattermost_api_reference_client/api/groups/patch_group_syncable_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.group_syncable_team import GroupSyncableTeam from ...models.patch_group_syncable_for_team_json_body import PatchGroupSyncableForTeamJsonBody from ...types import Response @@ -14,30 +14,25 @@ def _get_kwargs( group_id: str, team_id: str, *, - client: Client, json_body: PatchGroupSyncableForTeamJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/teams/{team_id}/patch".format( - client.base_url, group_id=group_id, team_id=team_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/teams/{team_id}/patch".format( + group_id=group_id, + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, GroupSyncableTeam]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, GroupSyncableTeam]]: if response.status_code == HTTPStatus.OK: response_200 = GroupSyncableTeam.from_dict(response.json()) @@ -60,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, GroupSyncableTeam]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, GroupSyncableTeam]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,7 +70,7 @@ def sync_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForTeamJsonBody, ) -> Response[Union[Any, GroupSyncableTeam]]: """Patch a GroupSyncable associated to Team @@ -103,12 +100,10 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -119,7 +114,7 @@ def sync( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForTeamJsonBody, ) -> Optional[Union[Any, GroupSyncableTeam]]: """Patch a GroupSyncable associated to Team @@ -158,7 +153,7 @@ async def asyncio_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForTeamJsonBody, ) -> Response[Union[Any, GroupSyncableTeam]]: """Patch a GroupSyncable associated to Team @@ -188,12 +183,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -202,7 +195,7 @@ async def asyncio( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchGroupSyncableForTeamJsonBody, ) -> Optional[Union[Any, GroupSyncableTeam]]: """Patch a GroupSyncable associated to Team diff --git a/mattermost_api_reference_client/api/groups/restore_group.py b/mattermost_api_reference_client/api/groups/restore_group.py new file mode 100644 index 0000000..1c6b6f8 --- /dev/null +++ b/mattermost_api_reference_client/api/groups/restore_group.py @@ -0,0 +1,184 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.status_ok import StatusOK +from ...types import Response + + +def _get_kwargs( + group_id: str, +) -> Dict[str, Any]: + pass + + return { + "method": "post", + "url": "/api/v4/groups/{group_id}/restore".format( + group_id=group_id, + ), + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: + if response.status_code == HTTPStatus.OK: + response_200 = StatusOK.from_dict(response.json()) + + return response_200 + if response.status_code == HTTPStatus.BAD_REQUEST: + response_400 = cast(Any, None) + return response_400 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = cast(Any, None) + return response_401 + if response.status_code == HTTPStatus.FORBIDDEN: + response_403 = cast(Any, None) + return response_403 + if response.status_code == HTTPStatus.NOT_IMPLEMENTED: + response_501 = cast(Any, None) + return response_501 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + group_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Response[Union[Any, StatusOK]]: + """Restore a previously deleted group. + + Restores a previously deleted custom group, allowing it to be used normally. + May not be used with LDAP groups. + ##### Permissions Must have `restore_custom_group` permission for the given group. + __Minimum server version__: 7.7 + + Args: + group_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, StatusOK]] + """ + + kwargs = _get_kwargs( + group_id=group_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + group_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[Union[Any, StatusOK]]: + """Restore a previously deleted group. + + Restores a previously deleted custom group, allowing it to be used normally. + May not be used with LDAP groups. + ##### Permissions Must have `restore_custom_group` permission for the given group. + __Minimum server version__: 7.7 + + Args: + group_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, StatusOK] + """ + + return sync_detailed( + group_id=group_id, + client=client, + ).parsed + + +async def asyncio_detailed( + group_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Response[Union[Any, StatusOK]]: + """Restore a previously deleted group. + + Restores a previously deleted custom group, allowing it to be used normally. + May not be used with LDAP groups. + ##### Permissions Must have `restore_custom_group` permission for the given group. + __Minimum server version__: 7.7 + + Args: + group_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, StatusOK]] + """ + + kwargs = _get_kwargs( + group_id=group_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + group_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[Union[Any, StatusOK]]: + """Restore a previously deleted group. + + Restores a previously deleted custom group, allowing it to be used normally. + May not be used with LDAP groups. + ##### Permissions Must have `restore_custom_group` permission for the given group. + __Minimum server version__: 7.7 + + Args: + group_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, StatusOK] + """ + + return ( + await asyncio_detailed( + group_id=group_id, + client=client, + ) + ).parsed diff --git a/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_channel.py b/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_channel.py index 109de0e..b1a1b46 100644 --- a/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_channel.py +++ b/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( group_id: str, channel_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/channels/{channel_id}/link".format( - client.base_url, group_id=group_id, channel_id=channel_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/channels/{channel_id}/link".format( + group_id=group_id, + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -55,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +64,7 @@ def sync_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a link from a channel to a group @@ -94,11 +90,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +103,7 @@ def sync( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a link from a channel to a group @@ -143,7 +137,7 @@ async def asyncio_detailed( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a link from a channel to a group @@ -169,11 +163,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -182,7 +174,7 @@ async def asyncio( group_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a link from a channel to a group diff --git a/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_team.py b/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_team.py index a9ac85a..d749e5b 100644 --- a/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_team.py +++ b/mattermost_api_reference_client/api/groups/unlink_group_syncable_for_team.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,25 +12,21 @@ from ...types import Response def _get_kwargs( group_id: str, team_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/groups/{group_id}/teams/{team_id}/link".format(client.base_url, group_id=group_id, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/groups/{group_id}/teams/{team_id}/link".format( + group_id=group_id, + team_id=team_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -53,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def sync_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a link from a team to a group @@ -91,11 +89,9 @@ def sync_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +102,7 @@ def sync( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a link from a team to a group @@ -139,7 +135,7 @@ async def asyncio_detailed( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a link from a team to a group @@ -164,11 +160,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( group_id=group_id, team_id=team_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -177,7 +171,7 @@ async def asyncio( group_id: str, team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a link from a team to a group diff --git a/mattermost_api_reference_client/api/groups/unlink_ldap_group.py b/mattermost_api_reference_client/api/groups/unlink_ldap_group.py index 6628c0d..03def52 100644 --- a/mattermost_api_reference_client/api/groups/unlink_ldap_group.py +++ b/mattermost_api_reference_client/api/groups/unlink_ldap_group.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( remote_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/ldap/groups/{remote_id}/link".format(client.base_url, remote_id=remote_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/groups/{remote_id}/link".format( + remote_id=remote_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a link for LDAP group @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( remote_id=remote_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a link for LDAP group @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a link for LDAP group @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( remote_id=remote_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a link for LDAP group diff --git a/mattermost_api_reference_client/api/imports/list_imports.py b/mattermost_api_reference_client/api/imports/list_imports.py index 21d7a9a..98c10fb 100644 --- a/mattermost_api_reference_client/api/imports/list_imports.py +++ b/mattermost_api_reference_client/api/imports/list_imports.py @@ -1,33 +1,23 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/imports".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/imports", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -42,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +43,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """List import files @@ -71,12 +61,9 @@ def sync_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -85,7 +72,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """List import files @@ -103,11 +90,8 @@ async def asyncio_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/insights/__init__.py b/mattermost_api_reference_client/api/insights/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/mattermost_api_reference_client/api/insights/get_new_team_members.py b/mattermost_api_reference_client/api/insights/get_new_team_members.py deleted file mode 100644 index ba20d22..0000000 --- a/mattermost_api_reference_client/api/insights/get_new_team_members.py +++ /dev/null @@ -1,234 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.new_team_members_list import NewTeamMembersList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/top/team_members".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, NewTeamMembersList]]: - if response.status_code == HTTPStatus.OK: - response_200 = NewTeamMembersList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, NewTeamMembersList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, NewTeamMembersList]]: - """Get a list of new team members. - - Get a list of all of the new team members that have joined the given team during the given time - period. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, NewTeamMembersList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, NewTeamMembersList]]: - """Get a list of new team members. - - Get a list of all of the new team members that have joined the given team during the given time - period. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, NewTeamMembersList] - """ - - return sync_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ).parsed - - -async def asyncio_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, NewTeamMembersList]]: - """Get a list of new team members. - - Get a list of all of the new team members that have joined the given team during the given time - period. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, NewTeamMembersList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, NewTeamMembersList]]: - """Get a list of new team members. - - Get a list of all of the new team members that have joined the given team during the given time - period. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, NewTeamMembersList] - """ - - return ( - await asyncio_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/insights/get_top_channels_for_team.py b/mattermost_api_reference_client/api/insights/get_top_channels_for_team.py deleted file mode 100644 index 8328a39..0000000 --- a/mattermost_api_reference_client/api/insights/get_top_channels_for_team.py +++ /dev/null @@ -1,230 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.top_channel_list import TopChannelList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/top/channels".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TopChannelList]]: - if response.status_code == HTTPStatus.OK: - response_200 = TopChannelList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TopChannelList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, TopChannelList]]: - """Get a list of the top channels for a team. - - Get a list of the top public and private channels (the user is a member of) for a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopChannelList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, TopChannelList]]: - """Get a list of the top channels for a team. - - Get a list of the top public and private channels (the user is a member of) for a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopChannelList] - """ - - return sync_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ).parsed - - -async def asyncio_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, TopChannelList]]: - """Get a list of the top channels for a team. - - Get a list of the top public and private channels (the user is a member of) for a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopChannelList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, TopChannelList]]: - """Get a list of the top channels for a team. - - Get a list of the top public and private channels (the user is a member of) for a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopChannelList] - """ - - return ( - await asyncio_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/insights/get_top_channels_for_user.py b/mattermost_api_reference_client/api/insights/get_top_channels_for_user.py deleted file mode 100644 index a2f7363..0000000 --- a/mattermost_api_reference_client/api/insights/get_top_channels_for_user.py +++ /dev/null @@ -1,232 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.top_channel_list import TopChannelList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Dict[str, Any]: - url = "{}/api/v4/users/me/top/channels".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params["team_id"] = team_id - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TopChannelList]]: - if response.status_code == HTTPStatus.OK: - response_200 = TopChannelList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TopChannelList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Response[Union[Any, TopChannelList]]: - """Get a list of the top channels for a user. - - Get a list of the top public and private channels (the user is a member of) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopChannelList]] - """ - - kwargs = _get_kwargs( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Optional[Union[Any, TopChannelList]]: - """Get a list of the top channels for a user. - - Get a list of the top public and private channels (the user is a member of) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopChannelList] - """ - - return sync_detailed( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ).parsed - - -async def asyncio_detailed( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Response[Union[Any, TopChannelList]]: - """Get a list of the top channels for a user. - - Get a list of the top public and private channels (the user is a member of) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopChannelList]] - """ - - kwargs = _get_kwargs( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Optional[Union[Any, TopChannelList]]: - """Get a list of the top channels for a user. - - Get a list of the top public and private channels (the user is a member of) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopChannelList] - """ - - return ( - await asyncio_detailed( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/insights/get_top_reactions_for_team.py b/mattermost_api_reference_client/api/insights/get_top_reactions_for_team.py deleted file mode 100644 index fdafc1b..0000000 --- a/mattermost_api_reference_client/api/insights/get_top_reactions_for_team.py +++ /dev/null @@ -1,234 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.top_reaction_list import TopReactionList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/top/reactions".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TopReactionList]]: - if response.status_code == HTTPStatus.OK: - response_200 = TopReactionList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TopReactionList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a team. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopReactionList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a team. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopReactionList] - """ - - return sync_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ).parsed - - -async def asyncio_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a team. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopReactionList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a team. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopReactionList] - """ - - return ( - await asyncio_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/insights/get_top_reactions_for_user.py b/mattermost_api_reference_client/api/insights/get_top_reactions_for_user.py deleted file mode 100644 index 373e87b..0000000 --- a/mattermost_api_reference_client/api/insights/get_top_reactions_for_user.py +++ /dev/null @@ -1,244 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.top_reaction_list import TopReactionList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Dict[str, Any]: - url = "{}/api/v4/users/me/top/reactions".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params["team_id"] = team_id - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TopReactionList]]: - if response.status_code == HTTPStatus.OK: - response_200 = TopReactionList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TopReactionList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Response[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a user. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given user. - If no `team_id` is provided, this will also include reactions posted by the given user in direct and - group messages. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopReactionList]] - """ - - kwargs = _get_kwargs( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Optional[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a user. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given user. - If no `team_id` is provided, this will also include reactions posted by the given user in direct and - group messages. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopReactionList] - """ - - return sync_detailed( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ).parsed - - -async def asyncio_detailed( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Response[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a user. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given user. - If no `team_id` is provided, this will also include reactions posted by the given user in direct and - group messages. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopReactionList]] - """ - - kwargs = _get_kwargs( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Optional[Union[Any, TopReactionList]]: - """Get a list of the top reactions for a user. - - Get a list of the top reactions across all public and private channels (the user is a member of) for - a given user. - If no `team_id` is provided, this will also include reactions posted by the given user in direct and - group messages. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopReactionList] - """ - - return ( - await asyncio_detailed( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/insights/get_top_threads_for_team.py b/mattermost_api_reference_client/api/insights/get_top_threads_for_team.py deleted file mode 100644 index aa70ccf..0000000 --- a/mattermost_api_reference_client/api/insights/get_top_threads_for_team.py +++ /dev/null @@ -1,234 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.top_thread_list import TopThreadList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/top/threads".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TopThreadList]]: - if response.status_code == HTTPStatus.OK: - response_200 = TopThreadList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TopThreadList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, TopThreadList]]: - """Get a list of the top threads for a team. - - Get a list of the top threads from public and private channels (the user is a member of) for a given - team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopThreadList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, TopThreadList]]: - """Get a list of the top threads for a team. - - Get a list of the top threads from public and private channels (the user is a member of) for a given - team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopThreadList] - """ - - return sync_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ).parsed - - -async def asyncio_detailed( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Response[Union[Any, TopThreadList]]: - """Get a list of the top threads for a team. - - Get a list of the top threads from public and private channels (the user is a member of) for a given - team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopThreadList]] - """ - - kwargs = _get_kwargs( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - team_id: str, - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, -) -> Optional[Union[Any, TopThreadList]]: - """Get a list of the top threads for a team. - - Get a list of the top threads from public and private channels (the user is a member of) for a given - team. - ##### Permissions - Must have `view_team` permission for the team. - - Args: - team_id (str): - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopThreadList] - """ - - return ( - await asyncio_detailed( - team_id=team_id, - client=client, - time_range=time_range, - page=page, - per_page=per_page, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/insights/get_top_threads_for_user.py b/mattermost_api_reference_client/api/insights/get_top_threads_for_user.py deleted file mode 100644 index 0d58721..0000000 --- a/mattermost_api_reference_client/api/insights/get_top_threads_for_user.py +++ /dev/null @@ -1,236 +0,0 @@ -from http import HTTPStatus -from typing import Any, Dict, Optional, Union, cast - -import httpx - -from ... import errors -from ...client import Client -from ...models.top_thread_list import TopThreadList -from ...types import UNSET, Response, Unset - - -def _get_kwargs( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Dict[str, Any]: - url = "{}/api/v4/users/me/top/threads".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() - - params: Dict[str, Any] = {} - params["time_range"] = time_range - - params["page"] = page - - params["per_page"] = per_page - - params["team_id"] = team_id - - params = {k: v for k, v in params.items() if v is not UNSET and v is not None} - - return { - "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, - "params": params, - } - - -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TopThreadList]]: - if response.status_code == HTTPStatus.OK: - response_200 = TopThreadList.from_dict(response.json()) - - return response_200 - if response.status_code == HTTPStatus.BAD_REQUEST: - response_400 = cast(Any, None) - return response_400 - if response.status_code == HTTPStatus.FORBIDDEN: - response_403 = cast(Any, None) - return response_403 - if client.raise_on_unexpected_status: - raise errors.UnexpectedStatus(response.status_code, response.content) - else: - return None - - -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TopThreadList]]: - return Response( - status_code=HTTPStatus(response.status_code), - content=response.content, - headers=response.headers, - parsed=_parse_response(client=client, response=response), - ) - - -def sync_detailed( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Response[Union[Any, TopThreadList]]: - """Get a list of the top threads for a user. - - Get a list of the top threads from public and private channels (the user is a member of and - participating in the thread) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopThreadList]] - """ - - kwargs = _get_kwargs( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - - response = httpx.request( - verify=client.verify_ssl, - **kwargs, - ) - - return _build_response(client=client, response=response) - - -def sync( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Optional[Union[Any, TopThreadList]]: - """Get a list of the top threads for a user. - - Get a list of the top threads from public and private channels (the user is a member of and - participating in the thread) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopThreadList] - """ - - return sync_detailed( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ).parsed - - -async def asyncio_detailed( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Response[Union[Any, TopThreadList]]: - """Get a list of the top threads for a user. - - Get a list of the top threads from public and private channels (the user is a member of and - participating in the thread) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Response[Union[Any, TopThreadList]] - """ - - kwargs = _get_kwargs( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) - - return _build_response(client=client, response=response) - - -async def asyncio( - *, - client: Client, - time_range: str, - page: Union[Unset, None, int] = 0, - per_page: Union[Unset, None, int] = 60, - team_id: Union[Unset, None, str] = UNSET, -) -> Optional[Union[Any, TopThreadList]]: - """Get a list of the top threads for a user. - - Get a list of the top threads from public and private channels (the user is a member of and - participating in the thread) for a given user. - ##### Permissions - Must be logged in as the user. - - Args: - time_range (str): - page (Union[Unset, None, int]): - per_page (Union[Unset, None, int]): Default: 60. - team_id (Union[Unset, None, str]): - - Raises: - errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. - httpx.TimeoutException: If the request takes longer than Client.timeout. - - Returns: - Union[Any, TopThreadList] - """ - - return ( - await asyncio_detailed( - client=client, - time_range=time_range, - page=page, - per_page=per_page, - team_id=team_id, - ) - ).parsed diff --git a/mattermost_api_reference_client/api/integration_actions/open_interactive_dialog.py b/mattermost_api_reference_client/api/integration_actions/open_interactive_dialog.py index 76a4626..0ce0320 100644 --- a/mattermost_api_reference_client/api/integration_actions/open_interactive_dialog.py +++ b/mattermost_api_reference_client/api/integration_actions/open_interactive_dialog.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.open_interactive_dialog_json_body import OpenInteractiveDialogJsonBody from ...models.status_ok import StatusOK from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: OpenInteractiveDialogJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/actions/dialogs/open".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/actions/dialogs/open", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -47,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +54,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenInteractiveDialogJsonBody, ) -> Response[Union[Any, StatusOK]]: """Open a dialog @@ -80,12 +76,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -94,7 +88,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenInteractiveDialogJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Open a dialog @@ -123,7 +117,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenInteractiveDialogJsonBody, ) -> Response[Union[Any, StatusOK]]: """Open a dialog @@ -145,19 +139,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenInteractiveDialogJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Open a dialog diff --git a/mattermost_api_reference_client/api/integration_actions/submit_interactive_dialog.py b/mattermost_api_reference_client/api/integration_actions/submit_interactive_dialog.py index 3b1041e..aa10e76 100644 --- a/mattermost_api_reference_client/api/integration_actions/submit_interactive_dialog.py +++ b/mattermost_api_reference_client/api/integration_actions/submit_interactive_dialog.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.submit_interactive_dialog_json_body import SubmitInteractiveDialogJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: SubmitInteractiveDialogJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/actions/dialogs/submit".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/actions/dialogs/submit", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +60,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SubmitInteractiveDialogJsonBody, ) -> Response[Union[Any, StatusOK]]: """Submit a dialog @@ -86,12 +82,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +94,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SubmitInteractiveDialogJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Submit a dialog @@ -129,7 +123,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SubmitInteractiveDialogJsonBody, ) -> Response[Union[Any, StatusOK]]: """Submit a dialog @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SubmitInteractiveDialogJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Submit a dialog diff --git a/mattermost_api_reference_client/api/internal/create_playbook_run_from_dialog.py b/mattermost_api_reference_client/api/internal/create_playbook_run_from_dialog.py index 8444f78..cd0601d 100644 --- a/mattermost_api_reference_client/api/internal/create_playbook_run_from_dialog.py +++ b/mattermost_api_reference_client/api/internal/create_playbook_run_from_dialog.py @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: AuthenticatedClient, json_body: CreatePlaybookRunFromDialogJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/dialog".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/dialog", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookRun]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookRun]]: if response.status_code == HTTPStatus.CREATED: response_201 = PlaybookRun.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookRun]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookRun]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,12 +81,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -148,12 +142,10 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/internal/end_playbook_run_dialog.py b/mattermost_api_reference_client/api/internal/end_playbook_run_dialog.py index 2db6279..8c93db7 100644 --- a/mattermost_api_reference_client/api/internal/end_playbook_run_dialog.py +++ b/mattermost_api_reference_client/api/internal/end_playbook_run_dialog.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -10,25 +10,18 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/end".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/end".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR: @@ -39,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,11 +64,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,10 +96,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/internal/get_checklist_autocomplete.py b/mattermost_api_reference_client/api/internal/get_checklist_autocomplete.py index 067e394..c4a014d 100644 --- a/mattermost_api_reference_client/api/internal/get_checklist_autocomplete.py +++ b/mattermost_api_reference_client/api/internal/get_checklist_autocomplete.py @@ -11,13 +11,9 @@ from ...types import UNSET, Response def _get_kwargs( *, - client: AuthenticatedClient, channel_id: str, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/checklist-autocomplete".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["channel_ID"] = channel_id @@ -26,17 +22,13 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/checklist-autocomplete", "params": params, } def _parse_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Optional[Union[Any, List["GetChecklistAutocompleteResponse200Item"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] @@ -57,7 +49,7 @@ def _parse_response( def _build_response( - *, client: Client, response: httpx.Response + *, client: Union[AuthenticatedClient, Client], response: httpx.Response ) -> Response[Union[Any, List["GetChecklistAutocompleteResponse200Item"]]]: return Response( status_code=HTTPStatus(response.status_code), @@ -89,12 +81,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, channel_id=channel_id, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -150,12 +140,10 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, channel_id=channel_id, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/internal/next_stage_dialog.py b/mattermost_api_reference_client/api/internal/next_stage_dialog.py index 6a77192..8194409 100644 --- a/mattermost_api_reference_client/api/internal/next_stage_dialog.py +++ b/mattermost_api_reference_client/api/internal/next_stage_dialog.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( id: str, *, - client: AuthenticatedClient, json_body: NextStageDialogJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/next-stage-dialog".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/next-stage-dialog".format( + id=id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -46,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -80,12 +74,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,11 +109,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/jobs/cancel_job.py b/mattermost_api_reference_client/api/jobs/cancel_job.py index eb5ce3e..33bf31c 100644 --- a/mattermost_api_reference_client/api/jobs/cancel_job.py +++ b/mattermost_api_reference_client/api/jobs/cancel_job.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( job_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/jobs/{job_id}/cancel".format(client.base_url, job_id=job_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/jobs/{job_id}/cancel".format( + job_id=job_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Cancel a job. @@ -86,11 +83,9 @@ def sync_detailed( kwargs = _get_kwargs( job_id=job_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +95,7 @@ def sync_detailed( def sync( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Cancel a job. @@ -129,7 +124,7 @@ def sync( async def asyncio_detailed( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Cancel a job. @@ -151,11 +146,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( job_id=job_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -163,7 +156,7 @@ async def asyncio_detailed( async def asyncio( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Cancel a job. diff --git a/mattermost_api_reference_client/api/jobs/create_job.py b/mattermost_api_reference_client/api/jobs/create_job.py index 46df323..adbd40f 100644 --- a/mattermost_api_reference_client/api/jobs/create_job.py +++ b/mattermost_api_reference_client/api/jobs/create_job.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.create_job_json_body import CreateJobJsonBody from ...models.job import Job from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreateJobJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/jobs".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/jobs", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Job]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Job]]: if response.status_code == HTTPStatus.CREATED: response_201 = Job.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Job]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Job]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +60,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateJobJsonBody, ) -> Response[Union[Any, Job]]: """Create a new job. @@ -86,12 +82,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +94,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateJobJsonBody, ) -> Optional[Union[Any, Job]]: """Create a new job. @@ -129,7 +123,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateJobJsonBody, ) -> Response[Union[Any, Job]]: """Create a new job. @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateJobJsonBody, ) -> Optional[Union[Any, Job]]: """Create a new job. diff --git a/mattermost_api_reference_client/api/jobs/download_job.py b/mattermost_api_reference_client/api/jobs/download_job.py index d90adf1..edb2118 100644 --- a/mattermost_api_reference_client/api/jobs/download_job.py +++ b/mattermost_api_reference_client/api/jobs/download_job.py @@ -1,34 +1,27 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response def _get_kwargs( job_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/jobs/{job_id}/download".format(client.base_url, job_id=job_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/jobs/{job_id}/download".format( + job_id=job_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -43,7 +36,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -55,7 +48,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Download the results of a job. @@ -77,11 +70,9 @@ def sync_detailed( kwargs = _get_kwargs( job_id=job_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -91,7 +82,7 @@ def sync_detailed( async def asyncio_detailed( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Download the results of a job. @@ -113,10 +104,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( job_id=job_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/jobs/get_job.py b/mattermost_api_reference_client/api/jobs/get_job.py index 0285202..32a138b 100644 --- a/mattermost_api_reference_client/api/jobs/get_job.py +++ b/mattermost_api_reference_client/api/jobs/get_job.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.job import Job from ...types import Response def _get_kwargs( job_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/jobs/{job_id}".format(client.base_url, job_id=job_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/jobs/{job_id}".format( + job_id=job_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Job]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Job]]: if response.status_code == HTTPStatus.OK: response_200 = Job.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Job]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Job]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Job]]: """Get a job. @@ -86,11 +83,9 @@ def sync_detailed( kwargs = _get_kwargs( job_id=job_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +95,7 @@ def sync_detailed( def sync( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Job]]: """Get a job. @@ -129,7 +124,7 @@ def sync( async def asyncio_detailed( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, Job]]: """Get a job. @@ -151,11 +146,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( job_id=job_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -163,7 +156,7 @@ async def asyncio_detailed( async def asyncio( job_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, Job]]: """Get a job. diff --git a/mattermost_api_reference_client/api/jobs/get_jobs.py b/mattermost_api_reference_client/api/jobs/get_jobs.py index bdeba28..964f2ff 100644 --- a/mattermost_api_reference_client/api/jobs/get_jobs.py +++ b/mattermost_api_reference_client/api/jobs/get_jobs.py @@ -4,21 +4,17 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.job import Job from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/jobs".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -29,16 +25,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/jobs", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Job"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Job"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -63,7 +57,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Job"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Job"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +70,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Job"]]]: @@ -98,13 +94,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,7 +107,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Job"]]]: @@ -145,7 +139,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Job"]]]: @@ -169,20 +163,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Job"]]]: diff --git a/mattermost_api_reference_client/api/jobs/get_jobs_by_type.py b/mattermost_api_reference_client/api/jobs/get_jobs_by_type.py index 39e3726..8292caa 100644 --- a/mattermost_api_reference_client/api/jobs/get_jobs_by_type.py +++ b/mattermost_api_reference_client/api/jobs/get_jobs_by_type.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.job import Job from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( type: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/jobs/type/{type}".format(client.base_url, type=type) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/jobs/type/{type}".format( + type=type, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Job"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Job"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -64,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Job"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Job"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +74,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( type: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Job"]]]: @@ -103,13 +101,11 @@ def sync_detailed( kwargs = _get_kwargs( type=type, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -119,7 +115,7 @@ def sync_detailed( def sync( type: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Job"]]]: @@ -155,7 +151,7 @@ def sync( async def asyncio_detailed( type: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["Job"]]]: @@ -182,13 +178,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( type=type, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -196,7 +190,7 @@ async def asyncio_detailed( async def asyncio( type: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["Job"]]]: diff --git a/mattermost_api_reference_client/api/ldap/add_user_to_group_syncables.py b/mattermost_api_reference_client/api/ldap/add_user_to_group_syncables.py new file mode 100644 index 0000000..749974f --- /dev/null +++ b/mattermost_api_reference_client/api/ldap/add_user_to_group_syncables.py @@ -0,0 +1,180 @@ +from http import HTTPStatus +from typing import Any, Dict, Optional, Union, cast + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.status_ok import StatusOK +from ...types import Response + + +def _get_kwargs( + user_id: str, +) -> Dict[str, Any]: + pass + + return { + "method": "post", + "url": "/api/v4/ldap/users/{user_id}/group_sync_memberships".format( + user_id=user_id, + ), + } + + +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: + if response.status_code == HTTPStatus.OK: + response_200 = StatusOK.from_dict(response.json()) + + return response_200 + if response.status_code == HTTPStatus.BAD_REQUEST: + response_400 = cast(Any, None) + return response_400 + if response.status_code == HTTPStatus.UNAUTHORIZED: + response_401 = cast(Any, None) + return response_401 + if response.status_code == HTTPStatus.FORBIDDEN: + response_403 = cast(Any, None) + return response_403 + if response.status_code == HTTPStatus.NOT_IMPLEMENTED: + response_501 = cast(Any, None) + return response_501 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + user_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Response[Union[Any, StatusOK]]: + """Create memberships for LDAP configured channels and teams for this user + + Add the user to each channel and team configured for each LDAP group of whicht the user is a member. + ##### Permissions + Must have `sysconsole_write_user_management_groups` permission. + + Args: + user_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, StatusOK]] + """ + + kwargs = _get_kwargs( + user_id=user_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + user_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[Union[Any, StatusOK]]: + """Create memberships for LDAP configured channels and teams for this user + + Add the user to each channel and team configured for each LDAP group of whicht the user is a member. + ##### Permissions + Must have `sysconsole_write_user_management_groups` permission. + + Args: + user_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, StatusOK] + """ + + return sync_detailed( + user_id=user_id, + client=client, + ).parsed + + +async def asyncio_detailed( + user_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Response[Union[Any, StatusOK]]: + """Create memberships for LDAP configured channels and teams for this user + + Add the user to each channel and team configured for each LDAP group of whicht the user is a member. + ##### Permissions + Must have `sysconsole_write_user_management_groups` permission. + + Args: + user_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Union[Any, StatusOK]] + """ + + kwargs = _get_kwargs( + user_id=user_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + user_id: str, + *, + client: Union[AuthenticatedClient, Client], +) -> Optional[Union[Any, StatusOK]]: + """Create memberships for LDAP configured channels and teams for this user + + Add the user to each channel and team configured for each LDAP group of whicht the user is a member. + ##### Permissions + Must have `sysconsole_write_user_management_groups` permission. + + Args: + user_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Union[Any, StatusOK] + """ + + return ( + await asyncio_detailed( + user_id=user_id, + client=client, + ) + ).parsed diff --git a/mattermost_api_reference_client/api/ldap/delete_ldap_private_certificate.py b/mattermost_api_reference_client/api/ldap/delete_ldap_private_certificate.py index 45152b5..b8a924c 100644 --- a/mattermost_api_reference_client/api/ldap/delete_ldap_private_certificate.py +++ b/mattermost_api_reference_client/api/ldap/delete_ldap_private_certificate.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/ldap/certificate/private".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/certificate/private", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -48,7 +40,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +53,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove private key @@ -75,12 +69,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -89,7 +80,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove private key @@ -112,7 +103,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove private key @@ -128,19 +119,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove private key diff --git a/mattermost_api_reference_client/api/ldap/delete_ldap_public_certificate.py b/mattermost_api_reference_client/api/ldap/delete_ldap_public_certificate.py index 8125fdf..3fe351b 100644 --- a/mattermost_api_reference_client/api/ldap/delete_ldap_public_certificate.py +++ b/mattermost_api_reference_client/api/ldap/delete_ldap_public_certificate.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/ldap/certificate/public".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/certificate/public", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -48,7 +40,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +53,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove public certificate @@ -75,12 +69,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -89,7 +80,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove public certificate @@ -112,7 +103,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove public certificate @@ -128,19 +119,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove public certificate diff --git a/mattermost_api_reference_client/api/ldap/get_ldap_groups.py b/mattermost_api_reference_client/api/ldap/get_ldap_groups.py index 804b9bd..e26c772 100644 --- a/mattermost_api_reference_client/api/ldap/get_ldap_groups.py +++ b/mattermost_api_reference_client/api/ldap/get_ldap_groups.py @@ -4,22 +4,18 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.ldap_groups_paged import LDAPGroupsPaged from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, q: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/ldap/groups".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["q"] = q @@ -32,16 +28,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/groups", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["LDAPGroupsPaged"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["LDAPGroupsPaged"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -66,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["LDAPGroupsPaged"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["LDAPGroupsPaged"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +73,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], q: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, @@ -102,14 +98,12 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, q=q, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -118,7 +112,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], q: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, @@ -152,7 +146,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], q: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, @@ -177,21 +171,19 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, q=q, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], q: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, diff --git a/mattermost_api_reference_client/api/ldap/link_ldap_group.py b/mattermost_api_reference_client/api/ldap/link_ldap_group.py index 5d9c70e..c7b2eaf 100644 --- a/mattermost_api_reference_client/api/ldap/link_ldap_group.py +++ b/mattermost_api_reference_client/api/ldap/link_ldap_group.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( remote_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/ldap/groups/{remote_id}/link".format(client.base_url, remote_id=remote_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/groups/{remote_id}/link".format( + remote_id=remote_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.CREATED: response_201 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Link a LDAP group @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( remote_id=remote_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Link a LDAP group @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Link a LDAP group @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( remote_id=remote_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( remote_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Link a LDAP group diff --git a/mattermost_api_reference_client/api/ldap/migrate_id_ldap.py b/mattermost_api_reference_client/api/ldap/migrate_id_ldap.py index feb4997..2e6030d 100644 --- a/mattermost_api_reference_client/api/ldap/migrate_id_ldap.py +++ b/mattermost_api_reference_client/api/ldap/migrate_id_ldap.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.migrate_id_ldap_json_body import MigrateIdLdapJsonBody from ...models.status_ok import StatusOK from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: MigrateIdLdapJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/ldap/migrateid".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/migrateid", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -59,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MigrateIdLdapJsonBody, ) -> Response[Union[Any, StatusOK]]: """Migrate Id LDAP @@ -92,12 +88,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +100,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MigrateIdLdapJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Migrate Id LDAP @@ -135,7 +129,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MigrateIdLdapJsonBody, ) -> Response[Union[Any, StatusOK]]: """Migrate Id LDAP @@ -157,19 +151,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: MigrateIdLdapJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Migrate Id LDAP diff --git a/mattermost_api_reference_client/api/ldap/sync_ldap.py b/mattermost_api_reference_client/api/ldap/sync_ldap.py index be0a248..e5d881a 100644 --- a/mattermost_api_reference_client/api/ldap/sync_ldap.py +++ b/mattermost_api_reference_client/api/ldap/sync_ldap.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/ldap/sync".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/sync", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -42,7 +34,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +47,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Sync with LDAP @@ -69,12 +63,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -83,7 +74,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Sync with LDAP @@ -106,7 +97,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Sync with LDAP @@ -122,19 +113,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Sync with LDAP diff --git a/mattermost_api_reference_client/api/ldap/test_ldap.py b/mattermost_api_reference_client/api/ldap/test_ldap.py index 63fbf8f..69fc98f 100644 --- a/mattermost_api_reference_client/api/ldap/test_ldap.py +++ b/mattermost_api_reference_client/api/ldap/test_ldap.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/ldap/test".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/test", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -45,7 +37,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -56,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Test LDAP configuration @@ -72,12 +66,9 @@ def sync_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -86,7 +77,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Test LDAP configuration @@ -109,7 +100,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Test LDAP configuration @@ -125,19 +116,16 @@ async def asyncio_detailed( Response[Union[Any, StatusOK]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Test LDAP configuration diff --git a/mattermost_api_reference_client/api/ldap/upload_ldap_private_certificate.py b/mattermost_api_reference_client/api/ldap/upload_ldap_private_certificate.py index d150b0d..4a0ee9d 100644 --- a/mattermost_api_reference_client/api/ldap/upload_ldap_private_certificate.py +++ b/mattermost_api_reference_client/api/ldap/upload_ldap_private_certificate.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.upload_ldap_private_certificate_multipart_data import UploadLdapPrivateCertificateMultipartData from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, multipart_data: UploadLdapPrivateCertificateMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/ldap/certificate/private".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/certificate/private", "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPrivateCertificateMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload private key @@ -89,12 +85,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +97,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPrivateCertificateMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload private key @@ -132,7 +126,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPrivateCertificateMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload private key @@ -154,19 +148,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPrivateCertificateMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload private key diff --git a/mattermost_api_reference_client/api/ldap/upload_ldap_public_certificate.py b/mattermost_api_reference_client/api/ldap/upload_ldap_public_certificate.py index edb3732..77b1e18 100644 --- a/mattermost_api_reference_client/api/ldap/upload_ldap_public_certificate.py +++ b/mattermost_api_reference_client/api/ldap/upload_ldap_public_certificate.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.upload_ldap_public_certificate_multipart_data import UploadLdapPublicCertificateMultipartData from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, multipart_data: UploadLdapPublicCertificateMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/ldap/certificate/public".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/ldap/certificate/public", "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPublicCertificateMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload public certificate @@ -89,12 +85,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +97,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPublicCertificateMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload public certificate @@ -132,7 +126,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPublicCertificateMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload public certificate @@ -154,19 +148,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadLdapPublicCertificateMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload public certificate diff --git a/mattermost_api_reference_client/api/o_auth/create_o_auth_app.py b/mattermost_api_reference_client/api/o_auth/create_o_auth_app.py index d26e8e1..b3ee1a0 100644 --- a/mattermost_api_reference_client/api/o_auth/create_o_auth_app.py +++ b/mattermost_api_reference_client/api/o_auth/create_o_auth_app.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.create_o_auth_app_json_body import CreateOAuthAppJsonBody from ...models.o_auth_app import OAuthApp from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreateOAuthAppJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, OAuthApp]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, OAuthApp]]: if response.status_code == HTTPStatus.CREATED: response_201 = OAuthApp.from_dict(response.json()) @@ -56,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, OAuthApp]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, OAuthApp]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateOAuthAppJsonBody, ) -> Response[Union[Any, OAuthApp]]: """Register OAuth app @@ -88,12 +84,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -102,7 +96,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateOAuthAppJsonBody, ) -> Optional[Union[Any, OAuthApp]]: """Register OAuth app @@ -130,7 +124,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateOAuthAppJsonBody, ) -> Response[Union[Any, OAuthApp]]: """Register OAuth app @@ -151,19 +145,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreateOAuthAppJsonBody, ) -> Optional[Union[Any, OAuthApp]]: """Register OAuth app diff --git a/mattermost_api_reference_client/api/o_auth/delete_o_auth_app.py b/mattermost_api_reference_client/api/o_auth/delete_o_auth_app.py index bd54b87..842ff47 100644 --- a/mattermost_api_reference_client/api/o_auth/delete_o_auth_app.py +++ b/mattermost_api_reference_client/api/o_auth/delete_o_auth_app.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( app_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps/{app_id}".format(client.base_url, app_id=app_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps/{app_id}".format( + app_id=app_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete an OAuth app @@ -89,11 +86,9 @@ def sync_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +98,7 @@ def sync_detailed( def sync( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete an OAuth app @@ -132,7 +127,7 @@ def sync( async def asyncio_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete an OAuth app @@ -154,11 +149,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -166,7 +159,7 @@ async def asyncio_detailed( async def asyncio( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete an OAuth app diff --git a/mattermost_api_reference_client/api/o_auth/get_authorized_o_auth_apps_for_user.py b/mattermost_api_reference_client/api/o_auth/get_authorized_o_auth_apps_for_user.py index 0c7cb26..0e2ad35 100644 --- a/mattermost_api_reference_client/api/o_auth/get_authorized_o_auth_apps_for_user.py +++ b/mattermost_api_reference_client/api/o_auth/get_authorized_o_auth_apps_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.o_auth_app import OAuthApp from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( user_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/oauth/apps/authorized".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -30,16 +26,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/oauth/apps/authorized".format( + user_id=user_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["OAuthApp"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["OAuthApp"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -67,7 +63,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["OAuthApp"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["OAuthApp"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +77,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["OAuthApp"]]]: @@ -104,13 +102,11 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -120,7 +116,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["OAuthApp"]]]: @@ -154,7 +150,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["OAuthApp"]]]: @@ -179,13 +175,11 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -193,7 +187,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["OAuthApp"]]]: diff --git a/mattermost_api_reference_client/api/o_auth/get_o_auth_app.py b/mattermost_api_reference_client/api/o_auth/get_o_auth_app.py index 8218dac..abdae61 100644 --- a/mattermost_api_reference_client/api/o_auth/get_o_auth_app.py +++ b/mattermost_api_reference_client/api/o_auth/get_o_auth_app.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.o_auth_app import OAuthApp from ...types import Response def _get_kwargs( app_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps/{app_id}".format(client.base_url, app_id=app_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps/{app_id}".format( + app_id=app_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, OAuthApp]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, OAuthApp]]: if response.status_code == HTTPStatus.OK: response_200 = OAuthApp.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, OAuthApp]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, OAuthApp]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, OAuthApp]]: """Get an OAuth app @@ -89,11 +86,9 @@ def sync_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +98,7 @@ def sync_detailed( def sync( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, OAuthApp]]: """Get an OAuth app @@ -132,7 +127,7 @@ def sync( async def asyncio_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, OAuthApp]]: """Get an OAuth app @@ -154,11 +149,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -166,7 +159,7 @@ async def asyncio_detailed( async def asyncio( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, OAuthApp]]: """Get an OAuth app diff --git a/mattermost_api_reference_client/api/o_auth/get_o_auth_app_info.py b/mattermost_api_reference_client/api/o_auth/get_o_auth_app_info.py index e8a7790..caaa4d8 100644 --- a/mattermost_api_reference_client/api/o_auth/get_o_auth_app_info.py +++ b/mattermost_api_reference_client/api/o_auth/get_o_auth_app_info.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.o_auth_app import OAuthApp from ...types import Response def _get_kwargs( app_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps/{app_id}/info".format(client.base_url, app_id=app_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps/{app_id}/info".format( + app_id=app_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, OAuthApp]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, OAuthApp]]: if response.status_code == HTTPStatus.OK: response_200 = OAuthApp.from_dict(response.json()) @@ -52,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, OAuthApp]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, OAuthApp]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, OAuthApp]]: """Get info on an OAuth app @@ -86,11 +83,9 @@ def sync_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +95,7 @@ def sync_detailed( def sync( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, OAuthApp]]: """Get info on an OAuth app @@ -129,7 +124,7 @@ def sync( async def asyncio_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, OAuthApp]]: """Get info on an OAuth app @@ -151,11 +146,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -163,7 +156,7 @@ async def asyncio_detailed( async def asyncio( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, OAuthApp]]: """Get info on an OAuth app diff --git a/mattermost_api_reference_client/api/o_auth/get_o_auth_apps.py b/mattermost_api_reference_client/api/o_auth/get_o_auth_apps.py index 14db0bd..03b51da 100644 --- a/mattermost_api_reference_client/api/o_auth/get_o_auth_apps.py +++ b/mattermost_api_reference_client/api/o_auth/get_o_auth_apps.py @@ -4,21 +4,17 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.o_auth_app import OAuthApp from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -29,16 +25,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["OAuthApp"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["OAuthApp"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -66,7 +60,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["OAuthApp"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["OAuthApp"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +73,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["OAuthApp"]]]: @@ -101,13 +97,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -116,7 +110,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["OAuthApp"]]]: @@ -148,7 +142,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Response[Union[Any, List["OAuthApp"]]]: @@ -172,20 +166,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Optional[Union[Any, List["OAuthApp"]]]: diff --git a/mattermost_api_reference_client/api/o_auth/regenerate_o_auth_app_secret.py b/mattermost_api_reference_client/api/o_auth/regenerate_o_auth_app_secret.py index 891b450..26824d0 100644 --- a/mattermost_api_reference_client/api/o_auth/regenerate_o_auth_app_secret.py +++ b/mattermost_api_reference_client/api/o_auth/regenerate_o_auth_app_secret.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.o_auth_app import OAuthApp from ...types import Response def _get_kwargs( app_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps/{app_id}/regen_secret".format(client.base_url, app_id=app_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps/{app_id}/regen_secret".format( + app_id=app_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, OAuthApp]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, OAuthApp]]: if response.status_code == HTTPStatus.OK: response_200 = OAuthApp.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, OAuthApp]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, OAuthApp]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, OAuthApp]]: """Regenerate OAuth app secret @@ -89,11 +86,9 @@ def sync_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -103,7 +98,7 @@ def sync_detailed( def sync( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, OAuthApp]]: """Regenerate OAuth app secret @@ -132,7 +127,7 @@ def sync( async def asyncio_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, OAuthApp]]: """Regenerate OAuth app secret @@ -154,11 +149,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -166,7 +159,7 @@ async def asyncio_detailed( async def asyncio( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, OAuthApp]]: """Regenerate OAuth app secret diff --git a/mattermost_api_reference_client/api/o_auth/update_o_auth_app.py b/mattermost_api_reference_client/api/o_auth/update_o_auth_app.py index 498da5d..7e88838 100644 --- a/mattermost_api_reference_client/api/o_auth/update_o_auth_app.py +++ b/mattermost_api_reference_client/api/o_auth/update_o_auth_app.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.o_auth_app import OAuthApp from ...models.update_o_auth_app_json_body import UpdateOAuthAppJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( app_id: str, *, - client: Client, json_body: UpdateOAuthAppJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/oauth/apps/{app_id}".format(client.base_url, app_id=app_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/oauth/apps/{app_id}".format( + app_id=app_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, OAuthApp]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, OAuthApp]]: if response.status_code == HTTPStatus.OK: response_200 = OAuthApp.from_dict(response.json()) @@ -60,7 +56,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, OAuthApp]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, OAuthApp]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +70,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateOAuthAppJsonBody, ) -> Response[Union[Any, OAuthApp]]: """Update an OAuth app @@ -96,12 +94,10 @@ def sync_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +107,7 @@ def sync_detailed( def sync( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateOAuthAppJsonBody, ) -> Optional[Union[Any, OAuthApp]]: """Update an OAuth app @@ -143,7 +139,7 @@ def sync( async def asyncio_detailed( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateOAuthAppJsonBody, ) -> Response[Union[Any, OAuthApp]]: """Update an OAuth app @@ -167,12 +163,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( app_id=app_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -180,7 +174,7 @@ async def asyncio_detailed( async def asyncio( app_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdateOAuthAppJsonBody, ) -> Optional[Union[Any, OAuthApp]]: """Update an OAuth app diff --git a/mattermost_api_reference_client/api/open_graph/open_graph.py b/mattermost_api_reference_client/api/open_graph/open_graph.py index 8b6af64..329718e 100644 --- a/mattermost_api_reference_client/api/open_graph/open_graph.py +++ b/mattermost_api_reference_client/api/open_graph/open_graph.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.open_graph import OpenGraph from ...models.open_graph_json_body import OpenGraphJsonBody from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: OpenGraphJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/opengraph".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/opengraph", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, OpenGraph]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, OpenGraph]]: if response.status_code == HTTPStatus.OK: response_200 = OpenGraph.from_dict(response.json()) @@ -47,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, OpenGraph]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, OpenGraph]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -58,7 +54,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenGraphJsonBody, ) -> Response[Union[Any, OpenGraph]]: """Get open graph metadata for url @@ -83,12 +79,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +91,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenGraphJsonBody, ) -> Optional[Union[Any, OpenGraph]]: """Get open graph metadata for url @@ -129,7 +123,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenGraphJsonBody, ) -> Response[Union[Any, OpenGraph]]: """Get open graph metadata for url @@ -154,19 +148,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: OpenGraphJsonBody, ) -> Optional[Union[Any, OpenGraph]]: """Get open graph metadata for url diff --git a/mattermost_api_reference_client/api/permissions/get_ancillary_permissions.py b/mattermost_api_reference_client/api/permissions/get_ancillary_permissions.py index fdb2e1d..8cd2f42 100644 --- a/mattermost_api_reference_client/api/permissions/get_ancillary_permissions.py +++ b/mattermost_api_reference_client/api/permissions/get_ancillary_permissions.py @@ -4,19 +4,15 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, subsection_permissions: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/permissions/ancillary".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["subsection_permissions"] = subsection_permissions @@ -25,16 +21,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/permissions/ancillary", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List[str]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List[str]]]: if response.status_code == HTTPStatus.OK: response_200 = cast(List[str], response.json()) @@ -48,7 +42,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List[str]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List[str]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +55,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], subsection_permissions: Union[Unset, None, str] = UNSET, ) -> Response[Union[Any, List[str]]]: """Return all system console subsection ancillary permissions @@ -81,12 +77,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, subsection_permissions=subsection_permissions, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -95,7 +89,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], subsection_permissions: Union[Unset, None, str] = UNSET, ) -> Optional[Union[Any, List[str]]]: """Return all system console subsection ancillary permissions @@ -124,7 +118,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], subsection_permissions: Union[Unset, None, str] = UNSET, ) -> Response[Union[Any, List[str]]]: """Return all system console subsection ancillary permissions @@ -146,19 +140,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, subsection_permissions=subsection_permissions, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], subsection_permissions: Union[Unset, None, str] = UNSET, ) -> Optional[Union[Any, List[str]]]: """Return all system console subsection ancillary permissions diff --git a/mattermost_api_reference_client/api/playbook_autofollows/get_auto_follows.py b/mattermost_api_reference_client/api/playbook_autofollows/get_auto_follows.py index a048185..5cd7430 100644 --- a/mattermost_api_reference_client/api/playbook_autofollows/get_auto_follows.py +++ b/mattermost_api_reference_client/api/playbook_autofollows/get_auto_follows.py @@ -11,25 +11,20 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/playbooks/{id}/autofollows".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/playbooks/{id}/autofollows".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookAutofollows]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookAutofollows]]: if response.status_code == HTTPStatus.OK: response_200 = PlaybookAutofollows.from_dict(response.json()) @@ -46,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookAutofollows]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookAutofollows]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,11 +72,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -130,11 +125,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/add_checklist_item.py b/mattermost_api_reference_client/api/playbook_runs/add_checklist_item.py index 034e645..4f09728 100644 --- a/mattermost_api_reference_client/api/playbook_runs/add_checklist_item.py +++ b/mattermost_api_reference_client/api/playbook_runs/add_checklist_item.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -13,30 +13,23 @@ def _get_kwargs( id: str, checklist: int, *, - client: AuthenticatedClient, json_body: AddChecklistItemJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/add".format( - client.base_url, id=id, checklist=checklist - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { - "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "method": "post", + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/add".format( + id=id, + checklist=checklist, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if client.raise_on_unexpected_status: @@ -45,7 +38,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,12 +75,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, checklist=checklist, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -122,11 +113,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, checklist=checklist, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/change_owner.py b/mattermost_api_reference_client/api/playbook_runs/change_owner.py index bc1a836..bb55792 100644 --- a/mattermost_api_reference_client/api/playbook_runs/change_owner.py +++ b/mattermost_api_reference_client/api/playbook_runs/change_owner.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( id: str, *, - client: AuthenticatedClient, json_body: ChangeOwnerJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/owner".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/owner".format( + id=id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -48,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,12 +73,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,11 +105,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/create_playbook_run_from_post.py b/mattermost_api_reference_client/api/playbook_runs/create_playbook_run_from_post.py index 63d7c1d..edbba13 100644 --- a/mattermost_api_reference_client/api/playbook_runs/create_playbook_run_from_post.py +++ b/mattermost_api_reference_client/api/playbook_runs/create_playbook_run_from_post.py @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: AuthenticatedClient, json_body: CreatePlaybookRunFromPostJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookRun]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookRun]]: if response.status_code == HTTPStatus.CREATED: response_201 = PlaybookRun.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookRun]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookRun]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -84,12 +80,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -145,12 +139,10 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/end_playbook_run.py b/mattermost_api_reference_client/api/playbook_runs/end_playbook_run.py index 77919af..cb9402c 100644 --- a/mattermost_api_reference_client/api/playbook_runs/end_playbook_run.py +++ b/mattermost_api_reference_client/api/playbook_runs/end_playbook_run.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -10,25 +10,18 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/end".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/end".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR: @@ -39,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,11 +61,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,10 +90,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/finish.py b/mattermost_api_reference_client/api/playbook_runs/finish.py index 220c74d..ddff9d1 100644 --- a/mattermost_api_reference_client/api/playbook_runs/finish.py +++ b/mattermost_api_reference_client/api/playbook_runs/finish.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -10,25 +10,18 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/finish".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/finish".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR: @@ -39,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,11 +61,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,10 +90,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/get_channels.py b/mattermost_api_reference_client/api/playbook_runs/get_channels.py index c7aba39..e194058 100644 --- a/mattermost_api_reference_client/api/playbook_runs/get_channels.py +++ b/mattermost_api_reference_client/api/playbook_runs/get_channels.py @@ -13,7 +13,6 @@ from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: AuthenticatedClient, team_id: str, sort: Union[Unset, None, GetChannelsSort] = GetChannelsSort.CREATE_AT, direction: Union[Unset, None, GetChannelsDirection] = GetChannelsDirection.DESC, @@ -22,10 +21,7 @@ def _get_kwargs( search_term: Union[Unset, None, str] = UNSET, participant_id: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/channels".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["team_id"] = team_id @@ -58,16 +54,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/channels", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List[str]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List[str]]]: if response.status_code == HTTPStatus.OK: response_200 = cast(List[str], response.json()) @@ -87,7 +81,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List[str]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List[str]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -130,7 +126,6 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, sort=sort, direction=direction, @@ -140,8 +135,7 @@ def sync_detailed( participant_id=participant_id, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -227,7 +221,6 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, sort=sort, direction=direction, @@ -237,8 +230,7 @@ async def asyncio_detailed( participant_id=participant_id, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/get_owners.py b/mattermost_api_reference_client/api/playbook_runs/get_owners.py index 949720b..09b8445 100644 --- a/mattermost_api_reference_client/api/playbook_runs/get_owners.py +++ b/mattermost_api_reference_client/api/playbook_runs/get_owners.py @@ -11,13 +11,9 @@ from ...types import UNSET, Response def _get_kwargs( *, - client: AuthenticatedClient, team_id: str, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/owners".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["team_id"] = team_id @@ -26,16 +22,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/owners", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["OwnerInfo"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["OwnerInfo"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -60,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["OwnerInfo"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["OwnerInfo"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -90,12 +86,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -149,12 +143,10 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/get_playbook_run.py b/mattermost_api_reference_client/api/playbook_runs/get_playbook_run.py index 199d3d5..ad56ec3 100644 --- a/mattermost_api_reference_client/api/playbook_runs/get_playbook_run.py +++ b/mattermost_api_reference_client/api/playbook_runs/get_playbook_run.py @@ -11,25 +11,20 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookRun]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookRun]]: if response.status_code == HTTPStatus.OK: response_200 = PlaybookRun.from_dict(response.json()) @@ -46,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookRun]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookRun]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,11 +72,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -130,11 +125,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_by_channel_id.py b/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_by_channel_id.py index 233ca1f..bc29eb0 100644 --- a/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_by_channel_id.py +++ b/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_by_channel_id.py @@ -11,25 +11,20 @@ from ...types import Response def _get_kwargs( channel_id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/channel/{channel_id}".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/channel/{channel_id}".format( + channel_id=channel_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookRun]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookRun]]: if response.status_code == HTTPStatus.OK: response_200 = PlaybookRun.from_dict(response.json()) @@ -46,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookRun]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookRun]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,11 +72,9 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -130,11 +125,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_metadata.py b/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_metadata.py index acff1c0..be245c0 100644 --- a/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_metadata.py +++ b/mattermost_api_reference_client/api/playbook_runs/get_playbook_run_metadata.py @@ -11,25 +11,20 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/metadata".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/metadata".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookRunMetadata]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookRunMetadata]]: if response.status_code == HTTPStatus.OK: response_200 = PlaybookRunMetadata.from_dict(response.json()) @@ -46,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookRunMetadata]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookRunMetadata]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,11 +72,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -130,11 +125,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/item_delete.py b/mattermost_api_reference_client/api/playbook_runs/item_delete.py index 598b52f..bfcd70d 100644 --- a/mattermost_api_reference_client/api/playbook_runs/item_delete.py +++ b/mattermost_api_reference_client/api/playbook_runs/item_delete.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -12,27 +12,20 @@ def _get_kwargs( id: str, checklist: int, item: int, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}".format( - client.base_url, id=id, checklist=checklist, item=item - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}".format( + id=id, + checklist=checklist, + item=item, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.NO_CONTENT: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -45,7 +38,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -80,11 +73,9 @@ def sync_detailed( id=id, checklist=checklist, item=item, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -117,10 +108,8 @@ async def asyncio_detailed( id=id, checklist=checklist, item=item, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/item_rename.py b/mattermost_api_reference_client/api/playbook_runs/item_rename.py index a1e845d..56137e3 100644 --- a/mattermost_api_reference_client/api/playbook_runs/item_rename.py +++ b/mattermost_api_reference_client/api/playbook_runs/item_rename.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -14,30 +14,24 @@ def _get_kwargs( checklist: int, item: int, *, - client: AuthenticatedClient, json_body: ItemRenameJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}".format( - client.base_url, id=id, checklist=checklist, item=item - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}".format( + id=id, + checklist=checklist, + item=item, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -50,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -89,12 +83,10 @@ def sync_detailed( id=id, checklist=checklist, item=item, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -131,11 +123,9 @@ async def asyncio_detailed( id=id, checklist=checklist, item=item, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/item_run.py b/mattermost_api_reference_client/api/playbook_runs/item_run.py index 0179668..0016d0c 100644 --- a/mattermost_api_reference_client/api/playbook_runs/item_run.py +++ b/mattermost_api_reference_client/api/playbook_runs/item_run.py @@ -13,27 +13,22 @@ def _get_kwargs( id: str, checklist: int, item: int, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/run".format( - client.base_url, id=id, checklist=checklist, item=item - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/run".format( + id=id, + checklist=checklist, + item=item, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, TriggerIdReturn]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, TriggerIdReturn]]: if response.status_code == HTTPStatus.OK: response_200 = TriggerIdReturn.from_dict(response.json()) @@ -50,7 +45,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, TriggerIdReturn]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, TriggerIdReturn]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -85,11 +82,9 @@ def sync_detailed( id=id, checklist=checklist, item=item, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -152,11 +147,9 @@ async def asyncio_detailed( id=id, checklist=checklist, item=item, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/item_set_assignee.py b/mattermost_api_reference_client/api/playbook_runs/item_set_assignee.py index e0c2002..6072b2d 100644 --- a/mattermost_api_reference_client/api/playbook_runs/item_set_assignee.py +++ b/mattermost_api_reference_client/api/playbook_runs/item_set_assignee.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -14,30 +14,24 @@ def _get_kwargs( checklist: int, item: int, *, - client: AuthenticatedClient, json_body: ItemSetAssigneeJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/assignee".format( - client.base_url, id=id, checklist=checklist, item=item - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/assignee".format( + id=id, + checklist=checklist, + item=item, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -50,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -87,12 +81,10 @@ def sync_detailed( id=id, checklist=checklist, item=item, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -127,11 +119,9 @@ async def asyncio_detailed( id=id, checklist=checklist, item=item, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/item_set_state.py b/mattermost_api_reference_client/api/playbook_runs/item_set_state.py index 06d2c62..78daced 100644 --- a/mattermost_api_reference_client/api/playbook_runs/item_set_state.py +++ b/mattermost_api_reference_client/api/playbook_runs/item_set_state.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -14,30 +14,24 @@ def _get_kwargs( checklist: int, item: int, *, - client: AuthenticatedClient, json_body: ItemSetStateJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/state".format( - client.base_url, id=id, checklist=checklist, item=item - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/item/{item}/state".format( + id=id, + checklist=checklist, + item=item, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -50,7 +44,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -87,12 +81,10 @@ def sync_detailed( id=id, checklist=checklist, item=item, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -127,11 +119,9 @@ async def asyncio_detailed( id=id, checklist=checklist, item=item, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/list_playbook_runs.py b/mattermost_api_reference_client/api/playbook_runs/list_playbook_runs.py index 39ef78b..62800ba 100644 --- a/mattermost_api_reference_client/api/playbook_runs/list_playbook_runs.py +++ b/mattermost_api_reference_client/api/playbook_runs/list_playbook_runs.py @@ -14,7 +14,6 @@ from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: AuthenticatedClient, team_id: str, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 1000, @@ -25,10 +24,7 @@ def _get_kwargs( participant_id: Union[Unset, None, str] = UNSET, search_term: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["team_id"] = team_id @@ -72,16 +68,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookRunList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookRunList]]: if response.status_code == HTTPStatus.OK: response_200 = PlaybookRunList.from_dict(response.json()) @@ -101,7 +95,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookRunList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookRunList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -149,7 +145,6 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, page=page, per_page=per_page, @@ -161,8 +156,7 @@ def sync_detailed( search_term=search_term, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -260,7 +254,6 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, page=page, per_page=per_page, @@ -272,8 +265,7 @@ async def asyncio_detailed( search_term=search_term, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/reoder_checklist_item.py b/mattermost_api_reference_client/api/playbook_runs/reoder_checklist_item.py index 4252c9d..a875261 100644 --- a/mattermost_api_reference_client/api/playbook_runs/reoder_checklist_item.py +++ b/mattermost_api_reference_client/api/playbook_runs/reoder_checklist_item.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -13,30 +13,23 @@ def _get_kwargs( id: str, checklist: int, *, - client: AuthenticatedClient, json_body: ReoderChecklistItemJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/reorder".format( - client.base_url, id=id, checklist=checklist - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/checklists/{checklist}/reorder".format( + id=id, + checklist=checklist, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -49,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -83,12 +76,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, checklist=checklist, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -120,11 +111,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, checklist=checklist, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/restart_playbook_run.py b/mattermost_api_reference_client/api/playbook_runs/restart_playbook_run.py index 4781844..8a7bd7d 100644 --- a/mattermost_api_reference_client/api/playbook_runs/restart_playbook_run.py +++ b/mattermost_api_reference_client/api/playbook_runs/restart_playbook_run.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -10,25 +10,18 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/restart".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/restart".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR: @@ -39,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,11 +61,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,10 +90,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/status.py b/mattermost_api_reference_client/api/playbook_runs/status.py index 8f0201e..e757a66 100644 --- a/mattermost_api_reference_client/api/playbook_runs/status.py +++ b/mattermost_api_reference_client/api/playbook_runs/status.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( id: str, *, - client: AuthenticatedClient, json_body: StatusJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}/status".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}/status".format( + id=id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -48,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,12 +73,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,11 +105,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbook_runs/update_playbook_run.py b/mattermost_api_reference_client/api/playbook_runs/update_playbook_run.py index a1d25c5..b4eca44 100644 --- a/mattermost_api_reference_client/api/playbook_runs/update_playbook_run.py +++ b/mattermost_api_reference_client/api/playbook_runs/update_playbook_run.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( id: str, *, - client: AuthenticatedClient, json_body: UpdatePlaybookRunJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/runs/{id}".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "patch", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/runs/{id}".format( + id=id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -46,7 +40,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,12 +71,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,11 +103,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbooks/create_playbook.py b/mattermost_api_reference_client/api/playbooks/create_playbook.py index af99025..05a064b 100644 --- a/mattermost_api_reference_client/api/playbooks/create_playbook.py +++ b/mattermost_api_reference_client/api/playbooks/create_playbook.py @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: AuthenticatedClient, json_body: CreatePlaybookJsonBody, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/playbooks".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/playbooks", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, CreatePlaybookResponse201]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, CreatePlaybookResponse201]]: if response.status_code == HTTPStatus.CREATED: response_201 = CreatePlaybookResponse201.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, CreatePlaybookResponse201]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, CreatePlaybookResponse201]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,12 +77,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -136,12 +130,10 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbooks/delete_playbook.py b/mattermost_api_reference_client/api/playbooks/delete_playbook.py index 9ad35b0..6510b65 100644 --- a/mattermost_api_reference_client/api/playbooks/delete_playbook.py +++ b/mattermost_api_reference_client/api/playbooks/delete_playbook.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -10,25 +10,18 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/playbooks/{id}".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/playbooks/{id}".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.NO_CONTENT: return None if response.status_code == HTTPStatus.FORBIDDEN: @@ -41,7 +34,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,11 +63,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -101,10 +92,8 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbooks/get_playbook.py b/mattermost_api_reference_client/api/playbooks/get_playbook.py index 57ddf60..8ab3332 100644 --- a/mattermost_api_reference_client/api/playbooks/get_playbook.py +++ b/mattermost_api_reference_client/api/playbooks/get_playbook.py @@ -11,25 +11,20 @@ from ...types import Response def _get_kwargs( id: str, - *, - client: AuthenticatedClient, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/playbooks/{id}".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/playbooks/{id}".format( + id=id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Playbook]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Playbook]]: if response.status_code == HTTPStatus.OK: response_200 = Playbook.from_dict(response.json()) @@ -46,7 +41,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Playbook]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Playbook]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,11 +72,9 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -130,11 +125,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbooks/get_playbooks.py b/mattermost_api_reference_client/api/playbooks/get_playbooks.py index c13a7a3..ee4cf43 100644 --- a/mattermost_api_reference_client/api/playbooks/get_playbooks.py +++ b/mattermost_api_reference_client/api/playbooks/get_playbooks.py @@ -13,7 +13,6 @@ from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: AuthenticatedClient, team_id: str, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 1000, @@ -21,10 +20,7 @@ def _get_kwargs( direction: Union[Unset, None, GetPlaybooksDirection] = GetPlaybooksDirection.ASC, with_archived: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/playbooks".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["team_id"] = team_id @@ -51,16 +47,14 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/playbooks", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PlaybookList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PlaybookList]]: if response.status_code == HTTPStatus.OK: response_200 = PlaybookList.from_dict(response.json()) @@ -80,7 +74,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PlaybookList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PlaybookList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -122,7 +118,6 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, page=page, per_page=per_page, @@ -131,8 +126,7 @@ def sync_detailed( with_archived=with_archived, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -215,7 +209,6 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, team_id=team_id, page=page, per_page=per_page, @@ -224,8 +217,7 @@ async def asyncio_detailed( with_archived=with_archived, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/playbooks/update_playbook.py b/mattermost_api_reference_client/api/playbooks/update_playbook.py index 8ffb244..8acd337 100644 --- a/mattermost_api_reference_client/api/playbooks/update_playbook.py +++ b/mattermost_api_reference_client/api/playbooks/update_playbook.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( id: str, *, - client: AuthenticatedClient, json_body: Playbook, ) -> Dict[str, Any]: - url = "{}/plugins/playbooks/api/v0/playbooks/{id}".format(client.base_url, id=id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/plugins/playbooks/api/v0/playbooks/{id}".format( + id=id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.OK: return None if response.status_code == HTTPStatus.BAD_REQUEST: @@ -48,7 +42,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,12 +73,10 @@ def sync_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -113,11 +105,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( id=id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/plugins/disable_plugin.py b/mattermost_api_reference_client/api/plugins/disable_plugin.py index 4ded4bf..530fbd7 100644 --- a/mattermost_api_reference_client/api/plugins/disable_plugin.py +++ b/mattermost_api_reference_client/api/plugins/disable_plugin.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( plugin_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins/{plugin_id}/disable".format(client.base_url, plugin_id=plugin_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/{plugin_id}/disable".format( + plugin_id=plugin_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Disable plugin @@ -91,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( plugin_id=plugin_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,7 +100,7 @@ def sync_detailed( def sync( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Disable plugin @@ -136,7 +131,7 @@ def sync( async def asyncio_detailed( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Disable plugin @@ -160,11 +155,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( plugin_id=plugin_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -172,7 +165,7 @@ async def asyncio_detailed( async def asyncio( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Disable plugin diff --git a/mattermost_api_reference_client/api/plugins/enable_plugin.py b/mattermost_api_reference_client/api/plugins/enable_plugin.py index ac6af0a..a176eb0 100644 --- a/mattermost_api_reference_client/api/plugins/enable_plugin.py +++ b/mattermost_api_reference_client/api/plugins/enable_plugin.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( plugin_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins/{plugin_id}/enable".format(client.base_url, plugin_id=plugin_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/{plugin_id}/enable".format( + plugin_id=plugin_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Enable plugin @@ -91,11 +88,9 @@ def sync_detailed( kwargs = _get_kwargs( plugin_id=plugin_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -105,7 +100,7 @@ def sync_detailed( def sync( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Enable plugin @@ -136,7 +131,7 @@ def sync( async def asyncio_detailed( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Enable plugin @@ -160,11 +155,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( plugin_id=plugin_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -172,7 +165,7 @@ async def asyncio_detailed( async def asyncio( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Enable plugin diff --git a/mattermost_api_reference_client/api/plugins/get_marketplace_plugins.py b/mattermost_api_reference_client/api/plugins/get_marketplace_plugins.py index 08f3bdc..389b899 100644 --- a/mattermost_api_reference_client/api/plugins/get_marketplace_plugins.py +++ b/mattermost_api_reference_client/api/plugins/get_marketplace_plugins.py @@ -4,23 +4,19 @@ from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, page: Union[Unset, None, int] = UNSET, per_page: Union[Unset, None, int] = UNSET, filter_: Union[Unset, None, str] = UNSET, server_version: Union[Unset, None, str] = UNSET, local_only: Union[Unset, None, bool] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins/marketplace".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -37,16 +33,12 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/marketplace", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -61,7 +53,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = UNSET, per_page: Union[Unset, None, int] = UNSET, filter_: Union[Unset, None, str] = UNSET, @@ -105,7 +97,6 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, filter_=filter_, @@ -113,8 +104,7 @@ def sync_detailed( local_only=local_only, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -123,7 +113,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = UNSET, per_page: Union[Unset, None, int] = UNSET, filter_: Union[Unset, None, str] = UNSET, @@ -156,7 +146,6 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, page=page, per_page=per_page, filter_=filter_, @@ -164,7 +153,6 @@ async def asyncio_detailed( local_only=local_only, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/plugins/get_marketplace_visited_by_admin.py b/mattermost_api_reference_client/api/plugins/get_marketplace_visited_by_admin.py index 9c760fb..824ac33 100644 --- a/mattermost_api_reference_client/api/plugins/get_marketplace_visited_by_admin.py +++ b/mattermost_api_reference_client/api/plugins/get_marketplace_visited_by_admin.py @@ -4,31 +4,23 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.system import System from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/plugins/marketplace/first_admin_visit".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/marketplace/first_admin_visit", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, System]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, System]]: if response.status_code == HTTPStatus.OK: response_200 = System.from_dict(response.json()) @@ -45,7 +37,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, System]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, System]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -56,7 +50,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, System]]: """Get if the Plugin Marketplace has been visited by at least an admin. @@ -74,12 +68,9 @@ def sync_detailed( Response[Union[Any, System]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -88,7 +79,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, System]]: """Get if the Plugin Marketplace has been visited by at least an admin. @@ -113,7 +104,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, System]]: """Get if the Plugin Marketplace has been visited by at least an admin. @@ -131,19 +122,16 @@ async def asyncio_detailed( Response[Union[Any, System]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, System]]: """Get if the Plugin Marketplace has been visited by at least an admin. diff --git a/mattermost_api_reference_client/api/plugins/get_plugin_statuses.py b/mattermost_api_reference_client/api/plugins/get_plugin_statuses.py index 6896903..8ba875c 100644 --- a/mattermost_api_reference_client/api/plugins/get_plugin_statuses.py +++ b/mattermost_api_reference_client/api/plugins/get_plugin_statuses.py @@ -4,31 +4,23 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.plugin_status import PluginStatus from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/plugins/statuses".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/statuses", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["PluginStatus"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["PluginStatus"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -56,7 +48,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["PluginStatus"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["PluginStatus"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["PluginStatus"]]]: """Get plugins status @@ -86,12 +80,9 @@ def sync_detailed( Response[Union[Any, List['PluginStatus']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +91,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["PluginStatus"]]]: """Get plugins status @@ -126,7 +117,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["PluginStatus"]]]: """Get plugins status @@ -145,19 +136,16 @@ async def asyncio_detailed( Response[Union[Any, List['PluginStatus']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["PluginStatus"]]]: """Get plugins status diff --git a/mattermost_api_reference_client/api/plugins/get_plugins.py b/mattermost_api_reference_client/api/plugins/get_plugins.py index b5d1a8e..e7a6e3a 100644 --- a/mattermost_api_reference_client/api/plugins/get_plugins.py +++ b/mattermost_api_reference_client/api/plugins/get_plugins.py @@ -1,33 +1,23 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/plugins".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -42,7 +32,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -53,7 +43,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get plugins @@ -73,12 +63,9 @@ def sync_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -87,7 +74,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Any]: """Get plugins @@ -107,11 +94,8 @@ async def asyncio_detailed( Response[Any] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/plugins/get_webapp_plugins.py b/mattermost_api_reference_client/api/plugins/get_webapp_plugins.py index aef2649..b19fa55 100644 --- a/mattermost_api_reference_client/api/plugins/get_webapp_plugins.py +++ b/mattermost_api_reference_client/api/plugins/get_webapp_plugins.py @@ -4,31 +4,23 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.plugin_manifest_webapp import PluginManifestWebapp from ...types import Response -def _get_kwargs( - *, - client: Client, -) -> Dict[str, Any]: - url = "{}/api/v4/plugins/webapp".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() +def _get_kwargs() -> Dict[str, Any]: + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/webapp", } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["PluginManifestWebapp"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["PluginManifestWebapp"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -56,7 +48,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["PluginManifestWebapp"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["PluginManifestWebapp"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +61,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["PluginManifestWebapp"]]]: """Get webapp plugins @@ -86,12 +80,9 @@ def sync_detailed( Response[Union[Any, List['PluginManifestWebapp']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -100,7 +91,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["PluginManifestWebapp"]]]: """Get webapp plugins @@ -126,7 +117,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["PluginManifestWebapp"]]]: """Get webapp plugins @@ -145,19 +136,16 @@ async def asyncio_detailed( Response[Union[Any, List['PluginManifestWebapp']]] """ - kwargs = _get_kwargs( - client=client, - ) + kwargs = _get_kwargs() - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["PluginManifestWebapp"]]]: """Get webapp plugins diff --git a/mattermost_api_reference_client/api/plugins/install_marketplace_plugin.py b/mattermost_api_reference_client/api/plugins/install_marketplace_plugin.py index fcc31ef..3222d14 100644 --- a/mattermost_api_reference_client/api/plugins/install_marketplace_plugin.py +++ b/mattermost_api_reference_client/api/plugins/install_marketplace_plugin.py @@ -1,38 +1,30 @@ from http import HTTPStatus -from typing import Any, Dict, Optional +from typing import Any, Dict, Optional, Union import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.install_marketplace_plugin_json_body import InstallMarketplacePluginJsonBody from ...types import Response def _get_kwargs( *, - client: Client, json_body: InstallMarketplacePluginJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins/marketplace".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/marketplace", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any]: +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: if response.status_code == HTTPStatus.BAD_REQUEST: return None if response.status_code == HTTPStatus.UNAUTHORIZED: @@ -49,7 +41,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Any return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]: +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -60,7 +52,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Any def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: InstallMarketplacePluginJsonBody, ) -> Response[Any]: """Installs a marketplace plugin @@ -84,12 +76,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -98,7 +88,7 @@ def sync_detailed( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: InstallMarketplacePluginJsonBody, ) -> Response[Any]: """Installs a marketplace plugin @@ -122,11 +112,9 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) diff --git a/mattermost_api_reference_client/api/plugins/install_plugin_from_url.py b/mattermost_api_reference_client/api/plugins/install_plugin_from_url.py index 7b8a606..669d87e 100644 --- a/mattermost_api_reference_client/api/plugins/install_plugin_from_url.py +++ b/mattermost_api_reference_client/api/plugins/install_plugin_from_url.py @@ -4,21 +4,17 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, plugin_download_url: str, force: Union[Unset, None, str] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins/install_from_url".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["plugin_download_url"] = plugin_download_url @@ -29,16 +25,14 @@ def _get_kwargs( return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/install_from_url", "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.CREATED: response_201 = StatusOK.from_dict(response.json()) @@ -58,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +65,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], plugin_download_url: str, force: Union[Unset, None, str] = UNSET, ) -> Response[Union[Any, StatusOK]]: @@ -96,13 +92,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, plugin_download_url=plugin_download_url, force=force, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +105,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], plugin_download_url: str, force: Union[Unset, None, str] = UNSET, ) -> Optional[Union[Any, StatusOK]]: @@ -146,7 +140,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], plugin_download_url: str, force: Union[Unset, None, str] = UNSET, ) -> Response[Union[Any, StatusOK]]: @@ -173,20 +167,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, plugin_download_url=plugin_download_url, force=force, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], plugin_download_url: str, force: Union[Unset, None, str] = UNSET, ) -> Optional[Union[Any, StatusOK]]: diff --git a/mattermost_api_reference_client/api/plugins/remove_plugin.py b/mattermost_api_reference_client/api/plugins/remove_plugin.py index 2805fe6..a5ccd6f 100644 --- a/mattermost_api_reference_client/api/plugins/remove_plugin.py +++ b/mattermost_api_reference_client/api/plugins/remove_plugin.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( plugin_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins/{plugin_id}".format(client.base_url, plugin_id=plugin_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins/{plugin_id}".format( + plugin_id=plugin_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -55,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove plugin @@ -92,11 +89,9 @@ def sync_detailed( kwargs = _get_kwargs( plugin_id=plugin_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +101,7 @@ def sync_detailed( def sync( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove plugin @@ -138,7 +133,7 @@ def sync( async def asyncio_detailed( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Remove plugin @@ -163,11 +158,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( plugin_id=plugin_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -175,7 +168,7 @@ async def asyncio_detailed( async def asyncio( plugin_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Remove plugin diff --git a/mattermost_api_reference_client/api/plugins/upload_plugin.py b/mattermost_api_reference_client/api/plugins/upload_plugin.py index c0f9c25..3112702 100644 --- a/mattermost_api_reference_client/api/plugins/upload_plugin.py +++ b/mattermost_api_reference_client/api/plugins/upload_plugin.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...models.upload_plugin_multipart_data import UploadPluginMultipartData from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, multipart_data: UploadPluginMultipartData, ) -> Dict[str, Any]: - url = "{}/api/v4/plugins".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass multipart_multipart_data = multipart_data.to_multipart() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/plugins", "files": multipart_multipart_data, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.CREATED: response_201 = StatusOK.from_dict(response.json()) @@ -59,7 +53,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadPluginMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload plugin @@ -95,12 +91,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +103,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadPluginMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload plugin @@ -141,7 +135,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadPluginMultipartData, ) -> Response[Union[Any, StatusOK]]: """Upload plugin @@ -166,19 +160,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, multipart_data=multipart_data, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], multipart_data: UploadPluginMultipartData, ) -> Optional[Union[Any, StatusOK]]: """Upload plugin diff --git a/mattermost_api_reference_client/api/posts/create_post.py b/mattermost_api_reference_client/api/posts/create_post.py index 4bb076a..e63baf2 100644 --- a/mattermost_api_reference_client/api/posts/create_post.py +++ b/mattermost_api_reference_client/api/posts/create_post.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.create_post_json_body import CreatePostJsonBody from ...models.post import Post from ...types import UNSET, Response, Unset @@ -12,14 +12,10 @@ from ...types import UNSET, Response, Unset def _get_kwargs( *, - client: Client, json_body: CreatePostJsonBody, set_online: Union[Unset, None, bool] = UNSET, ) -> Dict[str, Any]: - url = "{}/api/v4/posts".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["set_online"] = set_online @@ -30,17 +26,15 @@ def _get_kwargs( return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts", "json": json_json_body, "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Post]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Post]]: if response.status_code == HTTPStatus.CREATED: response_201 = Post.from_dict(response.json()) @@ -60,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Post]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Post]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +67,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostJsonBody, set_online: Union[Unset, None, bool] = UNSET, ) -> Response[Union[Any, Post]]: @@ -94,13 +90,11 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, set_online=set_online, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -109,7 +103,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostJsonBody, set_online: Union[Unset, None, bool] = UNSET, ) -> Optional[Union[Any, Post]]: @@ -140,7 +134,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostJsonBody, set_online: Union[Unset, None, bool] = UNSET, ) -> Response[Union[Any, Post]]: @@ -163,20 +157,18 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, set_online=set_online, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostJsonBody, set_online: Union[Unset, None, bool] = UNSET, ) -> Optional[Union[Any, Post]]: diff --git a/mattermost_api_reference_client/api/posts/create_post_ephemeral.py b/mattermost_api_reference_client/api/posts/create_post_ephemeral.py index 159cbb5..3c555b8 100644 --- a/mattermost_api_reference_client/api/posts/create_post_ephemeral.py +++ b/mattermost_api_reference_client/api/posts/create_post_ephemeral.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.create_post_ephemeral_json_body import CreatePostEphemeralJsonBody from ...models.post import Post from ...types import Response @@ -12,28 +12,22 @@ from ...types import Response def _get_kwargs( *, - client: Client, json_body: CreatePostEphemeralJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/ephemeral".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/ephemeral", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Post]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Post]]: if response.status_code == HTTPStatus.CREATED: response_201 = Post.from_dict(response.json()) @@ -53,7 +47,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Post]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Post]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -64,7 +60,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostEphemeralJsonBody, ) -> Response[Union[Any, Post]]: """Create a ephemeral post @@ -85,12 +81,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -99,7 +93,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostEphemeralJsonBody, ) -> Optional[Union[Any, Post]]: """Create a ephemeral post @@ -127,7 +121,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostEphemeralJsonBody, ) -> Response[Union[Any, Post]]: """Create a ephemeral post @@ -148,19 +142,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: CreatePostEphemeralJsonBody, ) -> Optional[Union[Any, Post]]: """Create a ephemeral post diff --git a/mattermost_api_reference_client/api/posts/delete_post.py b/mattermost_api_reference_client/api/posts/delete_post.py index 876acb2..2bbbc54 100644 --- a/mattermost_api_reference_client/api/posts/delete_post.py +++ b/mattermost_api_reference_client/api/posts/delete_post.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( post_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}".format( + post_id=post_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a post @@ -83,11 +80,9 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -97,7 +92,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a post @@ -126,7 +121,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a post @@ -148,11 +143,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -160,7 +153,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a post diff --git a/mattermost_api_reference_client/api/posts/do_post_action.py b/mattermost_api_reference_client/api/posts/do_post_action.py index 4a92789..ad29f0a 100644 --- a/mattermost_api_reference_client/api/posts/do_post_action.py +++ b/mattermost_api_reference_client/api/posts/do_post_action.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,25 +12,21 @@ from ...types import Response def _get_kwargs( post_id: str, action_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}/actions/{action_id}".format(client.base_url, post_id=post_id, action_id=action_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}/actions/{action_id}".format( + post_id=post_id, + action_id=action_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -50,7 +46,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +61,7 @@ def sync_detailed( post_id: str, action_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Perform a post action @@ -86,11 +84,9 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, action_id=action_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -101,7 +97,7 @@ def sync( post_id: str, action_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Perform a post action @@ -132,7 +128,7 @@ async def asyncio_detailed( post_id: str, action_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Perform a post action @@ -155,11 +151,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, action_id=action_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -168,7 +162,7 @@ async def asyncio( post_id: str, action_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Perform a post action diff --git a/mattermost_api_reference_client/api/posts/get_file_infos_for_post.py b/mattermost_api_reference_client/api/posts/get_file_infos_for_post.py index a426dd9..4f299e8 100644 --- a/mattermost_api_reference_client/api/posts/get_file_infos_for_post.py +++ b/mattermost_api_reference_client/api/posts/get_file_infos_for_post.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.file_info import FileInfo from ...types import UNSET, Response, Unset @@ -12,13 +12,9 @@ from ...types import UNSET, Response, Unset def _get_kwargs( post_id: str, *, - client: Client, include_deleted: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}/files/info".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_deleted"] = include_deleted @@ -27,16 +23,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}/files/info".format( + post_id=post_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["FileInfo"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["FileInfo"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -61,7 +57,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["FileInfo"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["FileInfo"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,7 +71,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, List["FileInfo"]]]: """Get file info for post @@ -96,12 +94,10 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -111,7 +107,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, List["FileInfo"]]]: """Get file info for post @@ -142,7 +138,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, List["FileInfo"]]]: """Get file info for post @@ -165,12 +161,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -178,7 +172,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, List["FileInfo"]]]: """Get file info for post diff --git a/mattermost_api_reference_client/api/posts/get_flagged_posts_for_user.py b/mattermost_api_reference_client/api/posts/get_flagged_posts_for_user.py index e287f92..ba44da0 100644 --- a/mattermost_api_reference_client/api/posts/get_flagged_posts_for_user.py +++ b/mattermost_api_reference_client/api/posts/get_flagged_posts_for_user.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post_list import PostList from ...types import UNSET, Response, Unset @@ -12,16 +12,12 @@ from ...types import UNSET, Response, Unset def _get_kwargs( user_id: str, *, - client: Client, team_id: Union[Unset, None, str] = UNSET, channel_id: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/posts/flagged".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["team_id"] = team_id @@ -36,16 +32,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/posts/flagged".format( + user_id=user_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["PostList"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["PostList"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -70,7 +66,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["PostList"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["PostList"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,7 +80,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, channel_id: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, @@ -112,15 +110,13 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, team_id=team_id, channel_id=channel_id, page=page, per_page=per_page, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -130,7 +126,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, channel_id: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, @@ -171,7 +167,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, channel_id: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, @@ -201,15 +197,13 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, team_id=team_id, channel_id=channel_id, page=page, per_page=per_page, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -217,7 +211,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], team_id: Union[Unset, None, str] = UNSET, channel_id: Union[Unset, None, str] = UNSET, page: Union[Unset, None, int] = 0, diff --git a/mattermost_api_reference_client/api/posts/get_post.py b/mattermost_api_reference_client/api/posts/get_post.py index fe96b54..f4b10a7 100644 --- a/mattermost_api_reference_client/api/posts/get_post.py +++ b/mattermost_api_reference_client/api/posts/get_post.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post import Post from ...types import UNSET, Response, Unset @@ -12,13 +12,9 @@ from ...types import UNSET, Response, Unset def _get_kwargs( post_id: str, *, - client: Client, include_deleted: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["include_deleted"] = include_deleted @@ -27,16 +23,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}".format( + post_id=post_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Post]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Post]]: if response.status_code == HTTPStatus.OK: response_200 = Post.from_dict(response.json()) @@ -56,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Post]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Post]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, Post]]: """Get a post @@ -92,12 +90,10 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -107,7 +103,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, Post]]: """Get a post @@ -139,7 +135,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Response[Union[Any, Post]]: """Get a post @@ -163,12 +159,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -176,7 +170,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], include_deleted: Union[Unset, None, bool] = False, ) -> Optional[Union[Any, Post]]: """Get a post diff --git a/mattermost_api_reference_client/api/posts/get_post_thread.py b/mattermost_api_reference_client/api/posts/get_post_thread.py index 01b2026..3726027 100644 --- a/mattermost_api_reference_client/api/posts/get_post_thread.py +++ b/mattermost_api_reference_client/api/posts/get_post_thread.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post_list import PostList from ...types import UNSET, Response, Unset @@ -12,7 +12,6 @@ from ...types import UNSET, Response, Unset def _get_kwargs( post_id: str, *, - client: Client, per_page: Union[Unset, None, int] = 0, from_post: Union[Unset, None, str] = "", from_create_at: Union[Unset, None, int] = 0, @@ -21,10 +20,7 @@ def _get_kwargs( collapsed_threads: Union[Unset, None, bool] = False, collapsed_threads_extended: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}/thread".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["perPage"] = per_page @@ -45,16 +41,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}/thread".format( + post_id=post_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PostList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PostList]]: if response.status_code == HTTPStatus.OK: response_200 = PostList.from_dict(response.json()) @@ -74,7 +70,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PostList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PostList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -86,7 +84,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], per_page: Union[Unset, None, int] = 0, from_post: Union[Unset, None, str] = "", from_create_at: Union[Unset, None, int] = 0, @@ -122,7 +120,6 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, per_page=per_page, from_post=from_post, from_create_at=from_create_at, @@ -132,8 +129,7 @@ def sync_detailed( collapsed_threads_extended=collapsed_threads_extended, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -143,7 +139,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], per_page: Union[Unset, None, int] = 0, from_post: Union[Unset, None, str] = "", from_create_at: Union[Unset, None, int] = 0, @@ -193,7 +189,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], per_page: Union[Unset, None, int] = 0, from_post: Union[Unset, None, str] = "", from_create_at: Union[Unset, None, int] = 0, @@ -229,7 +225,6 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, per_page=per_page, from_post=from_post, from_create_at=from_create_at, @@ -239,8 +234,7 @@ async def asyncio_detailed( collapsed_threads_extended=collapsed_threads_extended, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -248,7 +242,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], per_page: Union[Unset, None, int] = 0, from_post: Union[Unset, None, str] = "", from_create_at: Union[Unset, None, int] = 0, diff --git a/mattermost_api_reference_client/api/posts/get_posts_around_last_unread.py b/mattermost_api_reference_client/api/posts/get_posts_around_last_unread.py index 71eb494..bbd6750 100644 --- a/mattermost_api_reference_client/api/posts/get_posts_around_last_unread.py +++ b/mattermost_api_reference_client/api/posts/get_posts_around_last_unread.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post_list import PostList from ...types import UNSET, Response, Unset @@ -13,19 +13,13 @@ def _get_kwargs( user_id: str, channel_id: str, *, - client: Client, limit_before: Union[Unset, None, int] = 60, limit_after: Union[Unset, None, int] = 60, skip_fetch_threads: Union[Unset, None, bool] = False, collapsed_threads: Union[Unset, None, bool] = False, collapsed_threads_extended: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/channels/{channel_id}/posts/unread".format( - client.base_url, user_id=user_id, channel_id=channel_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["limit_before"] = limit_before @@ -42,16 +36,17 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/channels/{channel_id}/posts/unread".format( + user_id=user_id, + channel_id=channel_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PostList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PostList]]: if response.status_code == HTTPStatus.OK: response_200 = PostList.from_dict(response.json()) @@ -71,7 +66,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PostList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PostList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -84,7 +81,7 @@ def sync_detailed( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], limit_before: Union[Unset, None, int] = 60, limit_after: Union[Unset, None, int] = 60, skip_fetch_threads: Union[Unset, None, bool] = False, @@ -120,7 +117,6 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, channel_id=channel_id, - client=client, limit_before=limit_before, limit_after=limit_after, skip_fetch_threads=skip_fetch_threads, @@ -128,8 +124,7 @@ def sync_detailed( collapsed_threads_extended=collapsed_threads_extended, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -140,7 +135,7 @@ def sync( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], limit_before: Union[Unset, None, int] = 60, limit_after: Union[Unset, None, int] = 60, skip_fetch_threads: Union[Unset, None, bool] = False, @@ -189,7 +184,7 @@ async def asyncio_detailed( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], limit_before: Union[Unset, None, int] = 60, limit_after: Union[Unset, None, int] = 60, skip_fetch_threads: Union[Unset, None, bool] = False, @@ -225,7 +220,6 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, channel_id=channel_id, - client=client, limit_before=limit_before, limit_after=limit_after, skip_fetch_threads=skip_fetch_threads, @@ -233,8 +227,7 @@ async def asyncio_detailed( collapsed_threads_extended=collapsed_threads_extended, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -243,7 +236,7 @@ async def asyncio( user_id: str, channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], limit_before: Union[Unset, None, int] = 60, limit_after: Union[Unset, None, int] = 60, skip_fetch_threads: Union[Unset, None, bool] = False, diff --git a/mattermost_api_reference_client/api/posts/get_posts_by_ids.py b/mattermost_api_reference_client/api/posts/get_posts_by_ids.py index 31bfe28..52082d2 100644 --- a/mattermost_api_reference_client/api/posts/get_posts_by_ids.py +++ b/mattermost_api_reference_client/api/posts/get_posts_by_ids.py @@ -4,35 +4,29 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post import Post from ...types import Response def _get_kwargs( *, - client: Client, json_body: List[str], ) -> Dict[str, Any]: - url = "{}/api/v4/posts/ids".format(client.base_url) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/ids", "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Post"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Post"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -57,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Post"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Post"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List["Post"]]]: """Get posts by a list of ids @@ -90,12 +86,10 @@ def sync_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +98,7 @@ def sync_detailed( def sync( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List["Post"]]]: """Get posts by a list of ids @@ -133,7 +127,7 @@ def sync( async def asyncio_detailed( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Response[Union[Any, List["Post"]]]: """Get posts by a list of ids @@ -155,19 +149,17 @@ async def asyncio_detailed( """ kwargs = _get_kwargs( - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) async def asyncio( *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List[str], ) -> Optional[Union[Any, List["Post"]]]: """Get posts by a list of ids diff --git a/mattermost_api_reference_client/api/posts/get_posts_for_channel.py b/mattermost_api_reference_client/api/posts/get_posts_for_channel.py index 7c92b9e..3ae8778 100644 --- a/mattermost_api_reference_client/api/posts/get_posts_for_channel.py +++ b/mattermost_api_reference_client/api/posts/get_posts_for_channel.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post_list import PostList from ...types import UNSET, Response, Unset @@ -12,7 +12,6 @@ from ...types import UNSET, Response, Unset def _get_kwargs( channel_id: str, *, - client: Client, page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, since: Union[Unset, None, int] = UNSET, @@ -20,10 +19,7 @@ def _get_kwargs( after: Union[Unset, None, str] = UNSET, include_deleted: Union[Unset, None, bool] = False, ) -> Dict[str, Any]: - url = "{}/api/v4/channels/{channel_id}/posts".format(client.base_url, channel_id=channel_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass params: Dict[str, Any] = {} params["page"] = page @@ -42,16 +38,16 @@ def _get_kwargs( return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/channels/{channel_id}/posts".format( + channel_id=channel_id, + ), "params": params, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PostList]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PostList]]: if response.status_code == HTTPStatus.OK: response_200 = PostList.from_dict(response.json()) @@ -71,7 +67,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PostList]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PostList]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -83,7 +81,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, since: Union[Unset, None, int] = UNSET, @@ -122,7 +120,6 @@ def sync_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, page=page, per_page=per_page, since=since, @@ -131,8 +128,7 @@ def sync_detailed( include_deleted=include_deleted, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -142,7 +138,7 @@ def sync_detailed( def sync( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, since: Union[Unset, None, int] = UNSET, @@ -194,7 +190,7 @@ def sync( async def asyncio_detailed( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, since: Union[Unset, None, int] = UNSET, @@ -233,7 +229,6 @@ async def asyncio_detailed( kwargs = _get_kwargs( channel_id=channel_id, - client=client, page=page, per_page=per_page, since=since, @@ -242,8 +237,7 @@ async def asyncio_detailed( include_deleted=include_deleted, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -251,7 +245,7 @@ async def asyncio_detailed( async def asyncio( channel_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], page: Union[Unset, None, int] = 0, per_page: Union[Unset, None, int] = 60, since: Union[Unset, None, int] = UNSET, diff --git a/mattermost_api_reference_client/api/posts/patch_post.py b/mattermost_api_reference_client/api/posts/patch_post.py index 5824606..e04c24c 100644 --- a/mattermost_api_reference_client/api/posts/patch_post.py +++ b/mattermost_api_reference_client/api/posts/patch_post.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.patch_post_json_body import PatchPostJsonBody from ...models.post import Post from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( post_id: str, *, - client: Client, json_body: PatchPostJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}/patch".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}/patch".format( + post_id=post_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Post]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Post]]: if response.status_code == HTTPStatus.OK: response_200 = Post.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Post]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Post]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchPostJsonBody, ) -> Response[Union[Any, Post]]: """Patch a post @@ -91,12 +89,10 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +102,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchPostJsonBody, ) -> Optional[Union[Any, Post]]: """Patch a post @@ -139,7 +135,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchPostJsonBody, ) -> Response[Union[Any, Post]]: """Patch a post @@ -164,12 +160,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -177,7 +171,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: PatchPostJsonBody, ) -> Optional[Union[Any, Post]]: """Patch a post diff --git a/mattermost_api_reference_client/api/posts/pin_post.py b/mattermost_api_reference_client/api/posts/pin_post.py index ba631ad..2997d01 100644 --- a/mattermost_api_reference_client/api/posts/pin_post.py +++ b/mattermost_api_reference_client/api/posts/pin_post.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( post_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}/pin".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}/pin".format( + post_id=post_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Pin a post to the channel @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Pin a post to the channel @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Pin a post to the channel @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Pin a post to the channel diff --git a/mattermost_api_reference_client/api/posts/save_acknowledgement_for_post.py b/mattermost_api_reference_client/api/posts/save_acknowledgement_for_post.py index de3688f..939d701 100644 --- a/mattermost_api_reference_client/api/posts/save_acknowledgement_for_post.py +++ b/mattermost_api_reference_client/api/posts/save_acknowledgement_for_post.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response @@ -12,25 +12,21 @@ from ...types import Response def _get_kwargs( user_id: str, post_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/posts/{post_id}/ack".format(client.base_url, user_id=user_id, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "delete", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/posts/{post_id}/ack".format( + user_id=user_id, + post_id=post_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -53,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def sync_detailed( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a post acknowledgement @@ -93,11 +91,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, post_id=post_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a post acknowledgement @@ -143,7 +139,7 @@ async def asyncio_detailed( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Delete a post acknowledgement @@ -170,11 +166,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, post_id=post_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -183,7 +177,7 @@ async def asyncio( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Delete a post acknowledgement diff --git a/mattermost_api_reference_client/api/posts/search_posts.py b/mattermost_api_reference_client/api/posts/search_posts.py index 6d6ce8f..ddf9941 100644 --- a/mattermost_api_reference_client/api/posts/search_posts.py +++ b/mattermost_api_reference_client/api/posts/search_posts.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post_list_with_search_matches import PostListWithSearchMatches from ...models.search_posts_json_body import SearchPostsJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( team_id: str, *, - client: Client, json_body: SearchPostsJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/teams/{team_id}/posts/search".format(client.base_url, team_id=team_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/teams/{team_id}/posts/search".format( + team_id=team_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, PostListWithSearchMatches]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, PostListWithSearchMatches]]: if response.status_code == HTTPStatus.OK: response_200 = PostListWithSearchMatches.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, PostListWithSearchMatches]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, PostListWithSearchMatches]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchPostsJsonBody, ) -> Response[Union[Any, PostListWithSearchMatches]]: """Search for team posts @@ -89,12 +87,10 @@ def sync_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +100,7 @@ def sync_detailed( def sync( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchPostsJsonBody, ) -> Optional[Union[Any, PostListWithSearchMatches]]: """Search for team posts @@ -135,7 +131,7 @@ def sync( async def asyncio_detailed( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchPostsJsonBody, ) -> Response[Union[Any, PostListWithSearchMatches]]: """Search for team posts @@ -158,12 +154,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( team_id=team_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -171,7 +165,7 @@ async def asyncio_detailed( async def asyncio( team_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SearchPostsJsonBody, ) -> Optional[Union[Any, PostListWithSearchMatches]]: """Search for team posts diff --git a/mattermost_api_reference_client/api/posts/set_post_reminder.py b/mattermost_api_reference_client/api/posts/set_post_reminder.py index 4c7c5fe..10021ea 100644 --- a/mattermost_api_reference_client/api/posts/set_post_reminder.py +++ b/mattermost_api_reference_client/api/posts/set_post_reminder.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.set_post_reminder_json_body import SetPostReminderJsonBody from ...models.status_ok import StatusOK from ...types import Response @@ -14,28 +14,25 @@ def _get_kwargs( user_id: str, post_id: str, *, - client: Client, json_body: SetPostReminderJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/posts/{post_id}/reminder".format(client.base_url, user_id=user_id, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/posts/{post_id}/reminder".format( + user_id=user_id, + post_id=post_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -58,7 +55,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +70,7 @@ def sync_detailed( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SetPostReminderJsonBody, ) -> Response[Union[Any, StatusOK]]: """Set a post reminder @@ -98,12 +97,10 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, post_id=post_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -114,7 +111,7 @@ def sync( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SetPostReminderJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Set a post reminder @@ -150,7 +147,7 @@ async def asyncio_detailed( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SetPostReminderJsonBody, ) -> Response[Union[Any, StatusOK]]: """Set a post reminder @@ -177,12 +174,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, post_id=post_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -191,7 +186,7 @@ async def asyncio( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: SetPostReminderJsonBody, ) -> Optional[Union[Any, StatusOK]]: """Set a post reminder diff --git a/mattermost_api_reference_client/api/posts/set_post_unread.py b/mattermost_api_reference_client/api/posts/set_post_unread.py index d31cb51..164e3f6 100644 --- a/mattermost_api_reference_client/api/posts/set_post_unread.py +++ b/mattermost_api_reference_client/api/posts/set_post_unread.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.channel_unread_at import ChannelUnreadAt from ...types import Response @@ -12,27 +12,21 @@ from ...types import Response def _get_kwargs( user_id: str, post_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/posts/{post_id}/set_unread".format( - client.base_url, user_id=user_id, post_id=post_id - ) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/posts/{post_id}/set_unread".format( + user_id=user_id, + post_id=post_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, ChannelUnreadAt]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, ChannelUnreadAt]]: if response.status_code == HTTPStatus.OK: response_200 = ChannelUnreadAt.from_dict(response.json()) @@ -55,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, ChannelUnreadAt]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, ChannelUnreadAt]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +64,7 @@ def sync_detailed( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelUnreadAt]]: """Mark as unread from a post. @@ -95,11 +91,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, post_id=post_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -110,7 +104,7 @@ def sync( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelUnreadAt]]: """Mark as unread from a post. @@ -145,7 +139,7 @@ async def asyncio_detailed( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, ChannelUnreadAt]]: """Mark as unread from a post. @@ -172,11 +166,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, post_id=post_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -185,7 +177,7 @@ async def asyncio( user_id: str, post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, ChannelUnreadAt]]: """Mark as unread from a post. diff --git a/mattermost_api_reference_client/api/posts/unpin_post.py b/mattermost_api_reference_client/api/posts/unpin_post.py index c92554b..cd14d53 100644 --- a/mattermost_api_reference_client/api/posts/unpin_post.py +++ b/mattermost_api_reference_client/api/posts/unpin_post.py @@ -4,32 +4,27 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.status_ok import StatusOK from ...types import Response def _get_kwargs( post_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}/unpin".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}/unpin".format( + post_id=post_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -49,7 +44,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +58,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Unpin a post to the channel @@ -82,11 +79,9 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -96,7 +91,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Unpin a post to the channel @@ -124,7 +119,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, StatusOK]]: """Unpin a post to the channel @@ -145,11 +140,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -157,7 +150,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, StatusOK]]: """Unpin a post to the channel diff --git a/mattermost_api_reference_client/api/posts/update_post.py b/mattermost_api_reference_client/api/posts/update_post.py index 28a59b3..9a02ce2 100644 --- a/mattermost_api_reference_client/api/posts/update_post.py +++ b/mattermost_api_reference_client/api/posts/update_post.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.post import Post from ...models.update_post_json_body import UpdatePostJsonBody from ...types import Response @@ -13,28 +13,24 @@ from ...types import Response def _get_kwargs( post_id: str, *, - client: Client, json_body: UpdatePostJsonBody, ) -> Dict[str, Any]: - url = "{}/api/v4/posts/{post_id}".format(client.base_url, post_id=post_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = json_body.to_dict() return { "method": "put", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/posts/{post_id}".format( + post_id=post_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, Post]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Post]]: if response.status_code == HTTPStatus.OK: response_200 = Post.from_dict(response.json()) @@ -54,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, Post]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Post]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +64,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdatePostJsonBody, ) -> Response[Union[Any, Post]]: """Update a post @@ -89,12 +87,10 @@ def sync_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -104,7 +100,7 @@ def sync_detailed( def sync( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdatePostJsonBody, ) -> Optional[Union[Any, Post]]: """Update a post @@ -135,7 +131,7 @@ def sync( async def asyncio_detailed( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdatePostJsonBody, ) -> Response[Union[Any, Post]]: """Update a post @@ -158,12 +154,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( post_id=post_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -171,7 +165,7 @@ async def asyncio_detailed( async def asyncio( post_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: UpdatePostJsonBody, ) -> Optional[Union[Any, Post]]: """Update a post diff --git a/mattermost_api_reference_client/api/preferences/delete_preferences.py b/mattermost_api_reference_client/api/preferences/delete_preferences.py index 1a69dd2..0138eef 100644 --- a/mattermost_api_reference_client/api/preferences/delete_preferences.py +++ b/mattermost_api_reference_client/api/preferences/delete_preferences.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.preference import Preference from ...models.status_ok import StatusOK from ...types import Response @@ -13,13 +13,9 @@ from ...types import Response def _get_kwargs( user_id: str, *, - client: Client, json_body: List["Preference"], ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/preferences/delete".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass json_json_body = [] for json_body_item_data in json_body: @@ -29,16 +25,16 @@ def _get_kwargs( return { "method": "post", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/preferences/delete".format( + user_id=user_id, + ), "json": json_json_body, } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, StatusOK]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, StatusOK]]: if response.status_code == HTTPStatus.OK: response_200 = StatusOK.from_dict(response.json()) @@ -58,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, StatusOK]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, StatusOK]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +68,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["Preference"], ) -> Response[Union[Any, StatusOK]]: """Delete user's preferences @@ -93,12 +91,10 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, json_body=json_body, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -108,7 +104,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["Preference"], ) -> Optional[Union[Any, StatusOK]]: """Delete user's preferences @@ -139,7 +135,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["Preference"], ) -> Response[Union[Any, StatusOK]]: """Delete user's preferences @@ -162,12 +158,10 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, json_body=json_body, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -175,7 +169,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], json_body: List["Preference"], ) -> Optional[Union[Any, StatusOK]]: """Delete user's preferences diff --git a/mattermost_api_reference_client/api/preferences/get_preferences.py b/mattermost_api_reference_client/api/preferences/get_preferences.py index 641a8cf..a34b3fd 100644 --- a/mattermost_api_reference_client/api/preferences/get_preferences.py +++ b/mattermost_api_reference_client/api/preferences/get_preferences.py @@ -4,32 +4,27 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.preference import Preference from ...types import Response def _get_kwargs( user_id: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/preferences".format(client.base_url, user_id=user_id) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/preferences".format( + user_id=user_id, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Preference"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Preference"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -54,7 +49,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Preference"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Preference"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -66,7 +63,7 @@ def _build_response(*, client: Client, response: httpx.Response) -> Response[Uni def sync_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Preference"]]]: """Get the user's preferences @@ -87,11 +84,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -101,7 +96,7 @@ def sync_detailed( def sync( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Preference"]]]: """Get the user's preferences @@ -129,7 +124,7 @@ def sync( async def asyncio_detailed( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Preference"]]]: """Get the user's preferences @@ -150,11 +145,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -162,7 +155,7 @@ async def asyncio_detailed( async def asyncio( user_id: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Preference"]]]: """Get the user's preferences diff --git a/mattermost_api_reference_client/api/preferences/get_preferences_by_category.py b/mattermost_api_reference_client/api/preferences/get_preferences_by_category.py index 3d1ca60..9f703d5 100644 --- a/mattermost_api_reference_client/api/preferences/get_preferences_by_category.py +++ b/mattermost_api_reference_client/api/preferences/get_preferences_by_category.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.preference import Preference from ...types import Response @@ -12,25 +12,21 @@ from ...types import Response def _get_kwargs( user_id: str, category: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/preferences/{category}".format(client.base_url, user_id=user_id, category=category) - - headers: Dict[str, str] = client.get_headers() - cookies: Dict[str, Any] = client.get_cookies() + pass return { "method": "get", - "url": url, - "headers": headers, - "cookies": cookies, - "timeout": client.get_timeout(), - "follow_redirects": client.follow_redirects, + "url": "/api/v4/users/{user_id}/preferences/{category}".format( + user_id=user_id, + category=category, + ), } -def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, List["Preference"]]]: +def _parse_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, List["Preference"]]]: if response.status_code == HTTPStatus.OK: response_200 = [] _response_200 = response.json() @@ -55,7 +51,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni return None -def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, List["Preference"]]]: +def _build_response( + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, List["Preference"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +66,7 @@ def sync_detailed( user_id: str, category: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Preference"]]]: """List a user's preferences by category @@ -91,11 +89,9 @@ def sync_detailed( kwargs = _get_kwargs( user_id=user_id, category=category, - client=client, ) - response = httpx.request( - verify=client.verify_ssl, + response = client.get_httpx_client().request( **kwargs, ) @@ -106,7 +102,7 @@ def sync( user_id: str, category: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Preference"]]]: """List a user's preferences by category @@ -137,7 +133,7 @@ async def asyncio_detailed( user_id: str, category: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Response[Union[Any, List["Preference"]]]: """List a user's preferences by category @@ -160,11 +156,9 @@ async def asyncio_detailed( kwargs = _get_kwargs( user_id=user_id, category=category, - client=client, ) - async with httpx.AsyncClient(verify=client.verify_ssl) as _client: - response = await _client.request(**kwargs) + response = await client.get_async_httpx_client().request(**kwargs) return _build_response(client=client, response=response) @@ -173,7 +167,7 @@ async def asyncio( user_id: str, category: str, *, - client: Client, + client: Union[AuthenticatedClient, Client], ) -> Optional[Union[Any, List["Preference"]]]: """List a user's preferences by category diff --git a/mattermost_api_reference_client/api/preferences/get_preferences_by_category_by_name.py b/mattermost_api_reference_client/api/preferences/get_preferences_by_category_by_name.py index 1b8bcb3..b671f22 100644 --- a/mattermost_api_reference_client/api/preferences/get_preferences_by_category_by_name.py +++ b/mattermost_api_reference_client/api/preferences/get_preferences_by_category_by_name.py @@ -4,7 +4,7 @@ from typing import Any, Dict, Optional, Union, cast import httpx from ... import errors -from ...client import Client +from ...client import AuthenticatedClient, Client from ...models.preference import Preference from ...types import Response @@ -13,27 +13,22 @@ def _get_kwargs( user_id: str, category: str, preference_name: str, - *, - client: Client, ) -> Dict[str, Any]: - url = "{}/api/v4/users/{user_id}/preferences/{category}/name/{preference_name}".format( - client.base_url, user_id=user_id, category=category, preference_name=preference_name