From cdef1d5107b82ef3f7b1c0c202ddcff93e3558d9 Mon Sep 17 00:00:00 2001 From: micah <42517495+catgoat@users.noreply.github.com> Date: Fri, 25 Nov 2022 01:39:33 +0000 Subject: documentation --- mastodon/Mastodon.py | 60 ++++++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 40 deletions(-) (limited to 'mastodon') diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 5cd2c7b..77deef9 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py @@ -3263,24 +3263,14 @@ class Mastodon: id = self.__unpack_id(id) return self.__api_request('POST', '/api/v1/admin/reports/{0}/resolve'.format(id)) - @api_version("2.9.1", "2.9.1", __DICT_VERSION_ADMIN_ACCOUNT) + @api_version("4.0.0","4.0.0","4.0.0") def admin_domain_blocks(self, id=None): """ Fetches a list of blocked domains - * Set `remote` to True to get remote accounts, otherwise local accounts are returned (default: local accounts) - * Set `by_domain` to a domain to get only accounts from that domain. - * Set `status` to one of "active", "pending", "disabled", "silenced" or "suspended" to get only accounts with that moderation status (default: active) - * Set `username` to a string to get only accounts whose username contains this string. - * Set `display_name` to a string to get only accounts whose display name contains this string. - * Set `email` to an email to get only accounts with that email (this only works on local accounts). - * Set `ip` to an ip (as a string, standard v4/v6 notation) to get only accounts whose last active ip is that ip (this only works on local accounts). - * Set `staff_only` to True to only get staff accounts (this only works on local accounts). + Provide an `id` to fetch a specific domain block based on its database id. - Note that setting the boolean parameters to False does not mean "give me users to which this does not apply" but - instead means "I do not care if users have this attribute". - - Returns a list of `admin account dicts`_. + Returns a list of `domain dicts`_. """ id = self.__unpack_id(id) if id is not None: @@ -3288,42 +3278,32 @@ class Mastodon: else return self.__api_request('GET', '/api/v1/admin/domain_blocks/'.format(id)) - @api_version("2.9.1", "2.9.1", "2.9.1") + @api_version("4.0.0","4.0.0","4.0.0") def admin_domain_block(self, domain: str, severity=None, reject_media=None, reject_reports=None, private_comment=None, public_comment=None, obfuscate=None): """ - Perform a moderation action on an account. + Perform a moderation action on a domain. - Valid actions are: - * "disable" - for a local user, disable login. - * "silence" - hide the users posts from all public timelines. - * "suspend" - irreversibly delete all the user's posts, past and future. - * "sensitive" - forcce an accounts media visibility to always be sensitive. + Valid severities are: + * "silence" - hide all posts from federated timelines and do not show notifications to local users from the remote instance's users unless they are following the remote user. + * "suspend" - deny interactions with this instance going forward. This action is reversible. + * "limit" - generally used with reject_media=true to force reject media from an instance without silencing or suspending.. - If no action is specified, the user is only issued a warning. - - Specify the id of a report as `report_id` to close the report with this moderation action as the resolution. - Specify `warning_preset_id` to use a warning preset as the notification text to the user, or `text` to specify text directly. - If both are specified, they are concatenated (preset first). Note that there is currently no API to retrieve or create - warning presets. - - Set `send_email_notification` to False to not send the user an email notification informing them of the moderation action. + If no action is specified, the domain is only silenced. + `domain` is the domain to block. Note that using the top level domain will also imapct all subdomains. ie, example.com will also impact subdomain.example.com. + `reject_media` will not download remote media on to your local instance media storage. + `reject_reports` ignores all reports from the remote instance. + `private_comment` sets a private admin comment for the domain. + `public_comment` sets a publicly available comment for this domain, which will be available to local users and may be available to everyone depending on your settings. + `obfuscate` sensors some part of the domain name. Useful if the domain name contains unwanted words like slurs. """ - if action is None: - action = "none" - - if not send_email_notification: - send_email_notification = None - - id = self.__unpack_id(id) - if report_id is not None: - report_id = self.__unpack_id(report_id) + if domain is None: + raise AttributeError("Must provide a domain to block a domain") - params = self.__generate_params(locals(), ['id', 'action']) + params = self.__generate_params(locals()) - params["type"] = action self.__api_request( - 'POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) + 'POST', '/api/v1/admin/domain_block/, params) ### # Push subscription crypto utilities -- cgit v1.2.3