├── .gitignore ├── LICENSE.md ├── README.md ├── client ├── accounts │ ├── account_alias_parameters.go │ ├── account_alias_responses.go │ ├── account_avatar_delete_parameters.go │ ├── account_avatar_delete_responses.go │ ├── account_block_parameters.go │ ├── account_block_responses.go │ ├── account_create_parameters.go │ ├── account_create_responses.go │ ├── account_delete_parameters.go │ ├── account_delete_responses.go │ ├── account_follow_parameters.go │ ├── account_follow_responses.go │ ├── account_followers_parameters.go │ ├── account_followers_responses.go │ ├── account_following_parameters.go │ ├── account_following_responses.go │ ├── account_get_parameters.go │ ├── account_get_responses.go │ ├── account_header_delete_parameters.go │ ├── account_header_delete_responses.go │ ├── account_lists_parameters.go │ ├── account_lists_responses.go │ ├── account_lookup_get_parameters.go │ ├── account_lookup_get_responses.go │ ├── account_move_parameters.go │ ├── account_move_responses.go │ ├── account_mute_parameters.go │ ├── account_mute_responses.go │ ├── account_note_parameters.go │ ├── account_note_responses.go │ ├── account_relationships_parameters.go │ ├── account_relationships_responses.go │ ├── account_search_get_parameters.go │ ├── account_search_get_responses.go │ ├── account_statuses_parameters.go │ ├── account_statuses_responses.go │ ├── account_themes_parameters.go │ ├── account_themes_responses.go │ ├── account_unblock_parameters.go │ ├── account_unblock_responses.go │ ├── account_unfollow_parameters.go │ ├── account_unfollow_responses.go │ ├── account_unmute_parameters.go │ ├── account_unmute_responses.go │ ├── account_update_parameters.go │ ├── account_update_responses.go │ ├── account_verify_parameters.go │ ├── account_verify_responses.go │ ├── accounts_client.go │ ├── accounts_featured_tags_parameters.go │ └── accounts_featured_tags_responses.go ├── admin │ ├── admin_account_action_parameters.go │ ├── admin_account_action_responses.go │ ├── admin_account_approve_parameters.go │ ├── admin_account_approve_responses.go │ ├── admin_account_get_parameters.go │ ├── admin_account_get_responses.go │ ├── admin_account_reject_parameters.go │ ├── admin_account_reject_responses.go │ ├── admin_accounts_get_v1_parameters.go │ ├── admin_accounts_get_v1_responses.go │ ├── admin_accounts_get_v2_parameters.go │ ├── admin_accounts_get_v2_responses.go │ ├── admin_client.go │ ├── admin_report_get_parameters.go │ ├── admin_report_get_responses.go │ ├── admin_report_resolve_parameters.go │ ├── admin_report_resolve_responses.go │ ├── admin_reports_parameters.go │ ├── admin_reports_responses.go │ ├── admin_rule_get_parameters.go │ ├── admin_rule_get_responses.go │ ├── admins_rule_get_parameters.go │ ├── admins_rule_get_responses.go │ ├── domain_allow_create_parameters.go │ ├── domain_allow_create_responses.go │ ├── domain_allow_delete_parameters.go │ ├── domain_allow_delete_responses.go │ ├── domain_allow_get_parameters.go │ ├── domain_allow_get_responses.go │ ├── domain_allows_get_parameters.go │ ├── domain_allows_get_responses.go │ ├── domain_block_create_parameters.go │ ├── domain_block_create_responses.go │ ├── domain_block_delete_parameters.go │ ├── domain_block_delete_responses.go │ ├── domain_block_get_parameters.go │ ├── domain_block_get_responses.go │ ├── domain_blocks_get_parameters.go │ ├── domain_blocks_get_responses.go │ ├── domain_keys_expire_parameters.go │ ├── domain_keys_expire_responses.go │ ├── domain_permission_draft_accept_parameters.go │ ├── domain_permission_draft_accept_responses.go │ ├── domain_permission_draft_create_parameters.go │ ├── domain_permission_draft_create_responses.go │ ├── domain_permission_draft_get_parameters.go │ ├── domain_permission_draft_get_responses.go │ ├── domain_permission_draft_remove_parameters.go │ ├── domain_permission_draft_remove_responses.go │ ├── domain_permission_drafts_get_parameters.go │ ├── domain_permission_drafts_get_responses.go │ ├── domain_permission_exclude_create_parameters.go │ ├── domain_permission_exclude_create_responses.go │ ├── domain_permission_exclude_delete_parameters.go │ ├── domain_permission_exclude_delete_responses.go │ ├── domain_permission_exclude_get_parameters.go │ ├── domain_permission_exclude_get_responses.go │ ├── domain_permission_excludes_get_parameters.go │ ├── domain_permission_excludes_get_responses.go │ ├── domain_permission_subscription_create_parameters.go │ ├── domain_permission_subscription_create_responses.go │ ├── domain_permission_subscription_get_parameters.go │ ├── domain_permission_subscription_get_responses.go │ ├── domain_permission_subscription_remove_parameters.go │ ├── domain_permission_subscription_remove_responses.go │ ├── domain_permission_subscription_test_swagger_parameters.go │ ├── domain_permission_subscription_test_swagger_responses.go │ ├── domain_permission_subscription_update_parameters.go │ ├── domain_permission_subscription_update_responses.go │ ├── domain_permission_subscriptions_get_parameters.go │ ├── domain_permission_subscriptions_get_responses.go │ ├── domain_permission_subscriptions_preview_get_parameters.go │ ├── domain_permission_subscriptions_preview_get_responses.go │ ├── emoji_categories_get_parameters.go │ ├── emoji_categories_get_responses.go │ ├── emoji_create_parameters.go │ ├── emoji_create_responses.go │ ├── emoji_delete_parameters.go │ ├── emoji_delete_responses.go │ ├── emoji_get_parameters.go │ ├── emoji_get_responses.go │ ├── emoji_update_parameters.go │ ├── emoji_update_responses.go │ ├── emojis_get_parameters.go │ ├── emojis_get_responses.go │ ├── header_filter_allow_create_parameters.go │ ├── header_filter_allow_create_responses.go │ ├── header_filter_allow_delete_parameters.go │ ├── header_filter_allow_delete_responses.go │ ├── header_filter_allow_get_parameters.go │ ├── header_filter_allow_get_responses.go │ ├── header_filter_allows_get_parameters.go │ ├── header_filter_allows_get_responses.go │ ├── header_filter_block_create_parameters.go │ ├── header_filter_block_create_responses.go │ ├── header_filter_block_delete_parameters.go │ ├── header_filter_block_delete_responses.go │ ├── header_filter_block_get_parameters.go │ ├── header_filter_block_get_responses.go │ ├── header_filter_blocks_get_parameters.go │ ├── header_filter_blocks_get_responses.go │ ├── media_cleanup_parameters.go │ ├── media_cleanup_responses.go │ ├── media_refetch_parameters.go │ ├── media_refetch_responses.go │ ├── rule_create_parameters.go │ ├── rule_create_responses.go │ ├── rule_delete_parameters.go │ ├── rule_delete_responses.go │ ├── rule_update_parameters.go │ ├── rule_update_responses.go │ ├── test_email_send_parameters.go │ └── test_email_send_responses.go ├── announcements │ ├── announcements_client.go │ ├── announcements_get_parameters.go │ └── announcements_get_responses.go ├── apps │ ├── app_create_parameters.go │ ├── app_create_responses.go │ └── apps_client.go ├── blocks │ ├── blocks_client.go │ ├── blocks_get_parameters.go │ └── blocks_get_responses.go ├── bookmarks │ ├── bookmarks_client.go │ ├── bookmarks_get_parameters.go │ └── bookmarks_get_responses.go ├── conversations │ ├── conversation_delete_parameters.go │ ├── conversation_delete_responses.go │ ├── conversation_read_parameters.go │ ├── conversation_read_responses.go │ ├── conversations_client.go │ ├── conversations_get_parameters.go │ └── conversations_get_responses.go ├── custom_emojis │ ├── custom_emojis_client.go │ ├── custom_emojis_get_parameters.go │ └── custom_emojis_get_responses.go ├── debug │ ├── debug_a_p_url_parameters.go │ ├── debug_a_p_url_responses.go │ ├── debug_clear_caches_parameters.go │ ├── debug_clear_caches_responses.go │ └── debug_client.go ├── favourites │ ├── favourites_client.go │ ├── favourites_get_parameters.go │ └── favourites_get_responses.go ├── federation │ ├── federation_client.go │ ├── s2s_featured_collection_get_parameters.go │ ├── s2s_featured_collection_get_responses.go │ ├── s2s_outbox_get_parameters.go │ ├── s2s_outbox_get_responses.go │ ├── s2s_replies_get_parameters.go │ └── s2s_replies_get_responses.go ├── filters │ ├── filter_keyword_delete_parameters.go │ ├── filter_keyword_delete_responses.go │ ├── filter_keyword_get_parameters.go │ ├── filter_keyword_get_responses.go │ ├── filter_keyword_post_parameters.go │ ├── filter_keyword_post_responses.go │ ├── filter_keyword_put_parameters.go │ ├── filter_keyword_put_responses.go │ ├── filter_keywords_get_parameters.go │ ├── filter_keywords_get_responses.go │ ├── filter_status_delete_parameters.go │ ├── filter_status_delete_responses.go │ ├── filter_status_get_parameters.go │ ├── filter_status_get_responses.go │ ├── filter_status_post_parameters.go │ ├── filter_status_post_responses.go │ ├── filter_statuses_get_parameters.go │ ├── filter_statuses_get_responses.go │ ├── filter_v1_delete_parameters.go │ ├── filter_v1_delete_responses.go │ ├── filter_v1_get_parameters.go │ ├── filter_v1_get_responses.go │ ├── filter_v1_post_parameters.go │ ├── filter_v1_post_responses.go │ ├── filter_v1_put_parameters.go │ ├── filter_v1_put_responses.go │ ├── filter_v2_delete_parameters.go │ ├── filter_v2_delete_responses.go │ ├── filter_v2_get_parameters.go │ ├── filter_v2_get_responses.go │ ├── filter_v2_post_parameters.go │ ├── filter_v2_post_responses.go │ ├── filter_v2_put_parameters.go │ ├── filter_v2_put_responses.go │ ├── filters_client.go │ ├── filters_v1_get_parameters.go │ ├── filters_v1_get_responses.go │ ├── filters_v2_get_parameters.go │ └── filters_v2_get_responses.go ├── follow_requests │ ├── authorize_follow_request_parameters.go │ ├── authorize_follow_request_responses.go │ ├── follow_requests_client.go │ ├── get_follow_requests_parameters.go │ ├── get_follow_requests_responses.go │ ├── reject_follow_request_parameters.go │ └── reject_follow_request_responses.go ├── go_to_social_swagger_documentation_client.go ├── health │ ├── health_client.go │ ├── live_get_parameters.go │ ├── live_get_responses.go │ ├── live_head_parameters.go │ ├── live_head_responses.go │ ├── ready_get_parameters.go │ ├── ready_get_responses.go │ ├── ready_head_parameters.go │ └── ready_head_responses.go ├── import_export │ ├── export_blocks_parameters.go │ ├── export_blocks_responses.go │ ├── export_followers_parameters.go │ ├── export_followers_responses.go │ ├── export_following_parameters.go │ ├── export_following_responses.go │ ├── export_lists_parameters.go │ ├── export_lists_responses.go │ ├── export_mutes_parameters.go │ ├── export_mutes_responses.go │ ├── export_stats_parameters.go │ ├── export_stats_responses.go │ ├── import_data_parameters.go │ ├── import_data_responses.go │ └── import_export_client.go ├── instance │ ├── instance_client.go │ ├── instance_get_v1_parameters.go │ ├── instance_get_v1_responses.go │ ├── instance_get_v2_parameters.go │ ├── instance_get_v2_responses.go │ ├── instance_peers_get_parameters.go │ ├── instance_peers_get_responses.go │ ├── instance_update_parameters.go │ ├── instance_update_responses.go │ ├── rules_parameters.go │ └── rules_responses.go ├── interaction_policies │ ├── interaction_policies_client.go │ ├── policies_defaults_get_parameters.go │ ├── policies_defaults_get_responses.go │ ├── policies_defaults_update_parameters.go │ └── policies_defaults_update_responses.go ├── interaction_requests │ ├── authorize_interaction_request_parameters.go │ ├── authorize_interaction_request_responses.go │ ├── get_interaction_request_parameters.go │ ├── get_interaction_request_responses.go │ ├── get_interaction_requests_parameters.go │ ├── get_interaction_requests_responses.go │ ├── interaction_requests_client.go │ ├── reject_interaction_request_parameters.go │ └── reject_interaction_request_responses.go ├── lists │ ├── add_list_accounts_parameters.go │ ├── add_list_accounts_responses.go │ ├── list_accounts_parameters.go │ ├── list_accounts_responses.go │ ├── list_create_parameters.go │ ├── list_create_responses.go │ ├── list_delete_parameters.go │ ├── list_delete_responses.go │ ├── list_parameters.go │ ├── list_responses.go │ ├── list_update_parameters.go │ ├── list_update_responses.go │ ├── lists_client.go │ ├── lists_parameters.go │ ├── lists_responses.go │ ├── remove_list_accounts_parameters.go │ └── remove_list_accounts_responses.go ├── markers │ ├── markers_client.go │ ├── markers_get_parameters.go │ ├── markers_get_responses.go │ ├── markers_post_parameters.go │ └── markers_post_responses.go ├── media │ ├── media_client.go │ ├── media_create_parameters.go │ ├── media_create_responses.go │ ├── media_get_parameters.go │ ├── media_get_responses.go │ ├── media_update_parameters.go │ └── media_update_responses.go ├── mutes │ ├── mutes_client.go │ ├── mutes_get_parameters.go │ └── mutes_get_responses.go ├── nodeinfo │ ├── node_info_get_parameters.go │ ├── node_info_get_responses.go │ └── nodeinfo_client.go ├── notifications │ ├── clear_notifications_parameters.go │ ├── clear_notifications_responses.go │ ├── notification_parameters.go │ ├── notification_responses.go │ ├── notifications_client.go │ ├── notifications_parameters.go │ └── notifications_responses.go ├── nr_well_known │ ├── host_meta_get_parameters.go │ ├── host_meta_get_responses.go │ ├── node_info_well_known_get_parameters.go │ ├── node_info_well_known_get_responses.go │ ├── nr_well_known_client.go │ ├── webfinger_get_parameters.go │ └── webfinger_get_responses.go ├── polls │ ├── poll_parameters.go │ ├── poll_responses.go │ ├── poll_vote_parameters.go │ ├── poll_vote_responses.go │ └── polls_client.go ├── preferences │ ├── preferences_client.go │ ├── preferences_get_parameters.go │ └── preferences_get_responses.go ├── push │ ├── push_client.go │ ├── push_subscription_delete_parameters.go │ ├── push_subscription_delete_responses.go │ ├── push_subscription_get_parameters.go │ ├── push_subscription_get_responses.go │ ├── push_subscription_post_parameters.go │ ├── push_subscription_post_responses.go │ ├── push_subscription_put_parameters.go │ └── push_subscription_put_responses.go ├── reports │ ├── report_create_parameters.go │ ├── report_create_responses.go │ ├── report_get_parameters.go │ ├── report_get_responses.go │ ├── reports_client.go │ ├── reports_parameters.go │ └── reports_responses.go ├── search │ ├── search_client.go │ ├── search_get_parameters.go │ └── search_get_responses.go ├── statuses │ ├── status_bookmark_parameters.go │ ├── status_bookmark_responses.go │ ├── status_boosted_by_parameters.go │ ├── status_boosted_by_responses.go │ ├── status_create_parameters.go │ ├── status_create_responses.go │ ├── status_delete_parameters.go │ ├── status_delete_responses.go │ ├── status_edit_parameters.go │ ├── status_edit_responses.go │ ├── status_fave_parameters.go │ ├── status_fave_responses.go │ ├── status_faved_by_parameters.go │ ├── status_faved_by_responses.go │ ├── status_get_parameters.go │ ├── status_get_responses.go │ ├── status_history_get_parameters.go │ ├── status_history_get_responses.go │ ├── status_mute_parameters.go │ ├── status_mute_responses.go │ ├── status_pin_parameters.go │ ├── status_pin_responses.go │ ├── status_reblog_parameters.go │ ├── status_reblog_responses.go │ ├── status_source_get_parameters.go │ ├── status_source_get_responses.go │ ├── status_unbookmark_parameters.go │ ├── status_unbookmark_responses.go │ ├── status_unfave_parameters.go │ ├── status_unfave_responses.go │ ├── status_unmute_parameters.go │ ├── status_unmute_responses.go │ ├── status_unpin_parameters.go │ ├── status_unpin_responses.go │ ├── status_unreblog_parameters.go │ ├── status_unreblog_responses.go │ ├── statuses_client.go │ ├── thread_context_parameters.go │ └── thread_context_responses.go ├── streaming │ ├── stream_get_parameters.go │ ├── stream_get_responses.go │ └── streaming_client.go ├── tags │ ├── follow_tag_parameters.go │ ├── follow_tag_responses.go │ ├── get_featured_tags_parameters.go │ ├── get_featured_tags_responses.go │ ├── get_followed_tags_parameters.go │ ├── get_followed_tags_responses.go │ ├── get_tag_parameters.go │ ├── get_tag_responses.go │ ├── tags_client.go │ ├── unfollow_tag_parameters.go │ └── unfollow_tag_responses.go ├── timelines │ ├── home_timeline_parameters.go │ ├── home_timeline_responses.go │ ├── list_timeline_parameters.go │ ├── list_timeline_responses.go │ ├── public_timeline_parameters.go │ ├── public_timeline_responses.go │ ├── tag_timeline_parameters.go │ ├── tag_timeline_responses.go │ └── timelines_client.go └── user │ ├── get_user_parameters.go │ ├── get_user_responses.go │ ├── user_client.go │ ├── user_email_change_parameters.go │ ├── user_email_change_responses.go │ ├── user_password_change_parameters.go │ └── user_password_change_responses.go ├── cmd ├── archive.go ├── auth.go ├── auth_test.go ├── blocks.go ├── bookmarks.go ├── emojis.go ├── filters.go ├── followers.go ├── follows.go ├── lists.go ├── mutes.go ├── prefs.go └── root.go ├── filter-context.diff ├── generate.go ├── go.mod ├── go.sum ├── internal ├── api │ ├── api.go │ └── http.go ├── archive │ ├── actor.go │ ├── archive.go │ ├── download.go │ ├── export.go │ ├── mapfile.go │ ├── outbox.go │ └── pixelfed.go ├── auth │ └── auth.go ├── blocks │ └── blocks.go ├── bookmarks │ └── bookmarks.go ├── emojis │ └── emojis.go ├── filters │ └── filters.go ├── followers │ └── followers.go ├── follows │ └── follows.go ├── lists │ └── lists.go ├── mutes │ └── mutes.go ├── own │ └── own.go ├── resolve │ └── resolve.go └── util │ ├── csv.go │ ├── fs.go │ ├── http.go │ ├── keyring.go │ ├── prefs.go │ └── ptr.go ├── main.go ├── models ├── account.go ├── account_display_role.go ├── account_export_stats.go ├── account_role.go ├── admin_account_info.go ├── admin_action_response.go ├── admin_emoji.go ├── admin_report.go ├── application.go ├── attachment.go ├── card.go ├── conversation.go ├── debug_a_p_url_response.go ├── default_policies.go ├── domain.go ├── domain_permission.go ├── domain_permission_subscription.go ├── emoji.go ├── emoji_category.go ├── field.go ├── filter_action.go ├── filter_context.go ├── filter_keyword.go ├── filter_result.go ├── filter_status.go ├── filter_v1.go ├── filter_v2.go ├── header_filter.go ├── host_meta.go ├── instance_configuration_accounts.go ├── instance_configuration_emojis.go ├── instance_configuration_media_attachments.go ├── instance_configuration_polls.go ├── instance_configuration_statuses.go ├── instance_rule.go ├── instance_v1.go ├── instance_v1_configuration.go ├── instance_v1_u_r_ls.go ├── instance_v2.go ├── instance_v2_configuration.go ├── instance_v2_configuration_translation.go ├── instance_v2_configuration_v_api_d.go ├── instance_v2_contact.go ├── instance_v2_registrations.go ├── instance_v2_thumbnail.go ├── instance_v2_thumbnail_versions.go ├── instance_v2_u_r_ls.go ├── instance_v2_usage.go ├── instance_v2_users.go ├── interaction_policy.go ├── interaction_request.go ├── link.go ├── list.go ├── marker.go ├── media_dimensions.go ├── media_focus.go ├── media_meta.go ├── mention.go ├── muted_account.go ├── node_info_services.go ├── node_info_software.go ├── node_info_usage.go ├── node_info_users.go ├── nodeinfo.go ├── notification.go ├── policy_rules.go ├── policy_value.go ├── poll.go ├── poll_option.go ├── relationship.go ├── report.go ├── search_result.go ├── source.go ├── status.go ├── status_edit.go ├── status_reblogged.go ├── status_source.go ├── swagger_collection.go ├── swagger_collection_page.go ├── swagger_featured_collection.go ├── tag.go ├── theme.go ├── thread_context.go ├── timeline_marker.go ├── token.go ├── user.go ├── web_push_notification.go ├── web_push_notification_policy.go ├── web_push_subscription.go ├── web_push_subscription_alerts.go └── well_known_response.go └── tools └── tools.go /.gitignore: -------------------------------------------------------------------------------- 1 | # binary 2 | /slurp 3 | /slurp.exe 4 | -------------------------------------------------------------------------------- /client/health/live_get_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package health 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/strfmt" 17 | ) 18 | 19 | // NewLiveGetParams creates a new LiveGetParams object, 20 | // with the default timeout for this client. 21 | // 22 | // Default values are not hydrated, since defaults are normally applied by the API server side. 23 | // 24 | // To enforce default values in parameter, use SetDefaults or WithDefaults. 25 | func NewLiveGetParams() *LiveGetParams { 26 | return &LiveGetParams{ 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewLiveGetParamsWithTimeout creates a new LiveGetParams object 32 | // with the ability to set a timeout on a request. 33 | func NewLiveGetParamsWithTimeout(timeout time.Duration) *LiveGetParams { 34 | return &LiveGetParams{ 35 | timeout: timeout, 36 | } 37 | } 38 | 39 | // NewLiveGetParamsWithContext creates a new LiveGetParams object 40 | // with the ability to set a context for a request. 41 | func NewLiveGetParamsWithContext(ctx context.Context) *LiveGetParams { 42 | return &LiveGetParams{ 43 | Context: ctx, 44 | } 45 | } 46 | 47 | // NewLiveGetParamsWithHTTPClient creates a new LiveGetParams object 48 | // with the ability to set a custom HTTPClient for a request. 49 | func NewLiveGetParamsWithHTTPClient(client *http.Client) *LiveGetParams { 50 | return &LiveGetParams{ 51 | HTTPClient: client, 52 | } 53 | } 54 | 55 | /* 56 | LiveGetParams contains all the parameters to send to the API endpoint 57 | 58 | for the live get operation. 59 | 60 | Typically these are written to a http.Request. 61 | */ 62 | type LiveGetParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithDefaults hydrates default values in the live get params (not the query body). 69 | // 70 | // All values with no default are reset to their zero value. 71 | func (o *LiveGetParams) WithDefaults() *LiveGetParams { 72 | o.SetDefaults() 73 | return o 74 | } 75 | 76 | // SetDefaults hydrates default values in the live get params (not the query body). 77 | // 78 | // All values with no default are reset to their zero value. 79 | func (o *LiveGetParams) SetDefaults() { 80 | // no default values defined for this parameter 81 | } 82 | 83 | // WithTimeout adds the timeout to the live get params 84 | func (o *LiveGetParams) WithTimeout(timeout time.Duration) *LiveGetParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the live get params 90 | func (o *LiveGetParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the live get params 95 | func (o *LiveGetParams) WithContext(ctx context.Context) *LiveGetParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the live get params 101 | func (o *LiveGetParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the live get params 106 | func (o *LiveGetParams) WithHTTPClient(client *http.Client) *LiveGetParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the live get params 112 | func (o *LiveGetParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WriteToRequest writes these params to a swagger request 117 | func (o *LiveGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 118 | 119 | if err := r.SetTimeout(o.timeout); err != nil { 120 | return err 121 | } 122 | var res []error 123 | 124 | if len(res) > 0 { 125 | return errors.CompositeValidationError(res...) 126 | } 127 | return nil 128 | } 129 | -------------------------------------------------------------------------------- /client/health/live_get_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package health 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | 11 | "github.com/go-openapi/runtime" 12 | "github.com/go-openapi/strfmt" 13 | ) 14 | 15 | // LiveGetReader is a Reader for the LiveGet structure. 16 | type LiveGetReader struct { 17 | formats strfmt.Registry 18 | } 19 | 20 | // ReadResponse reads a server response into the received o. 21 | func (o *LiveGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 22 | switch response.Code() { 23 | case 200: 24 | result := NewLiveGetOK() 25 | if err := result.readResponse(response, consumer, o.formats); err != nil { 26 | return nil, err 27 | } 28 | return result, nil 29 | default: 30 | return nil, runtime.NewAPIError("[GET /livez] liveGet", response, response.Code()) 31 | } 32 | } 33 | 34 | // NewLiveGetOK creates a LiveGetOK with default headers values 35 | func NewLiveGetOK() *LiveGetOK { 36 | return &LiveGetOK{} 37 | } 38 | 39 | /* 40 | LiveGetOK describes a response with status code 200, with default header values. 41 | 42 | OK 43 | */ 44 | type LiveGetOK struct { 45 | } 46 | 47 | // IsSuccess returns true when this live get o k response has a 2xx status code 48 | func (o *LiveGetOK) IsSuccess() bool { 49 | return true 50 | } 51 | 52 | // IsRedirect returns true when this live get o k response has a 3xx status code 53 | func (o *LiveGetOK) IsRedirect() bool { 54 | return false 55 | } 56 | 57 | // IsClientError returns true when this live get o k response has a 4xx status code 58 | func (o *LiveGetOK) IsClientError() bool { 59 | return false 60 | } 61 | 62 | // IsServerError returns true when this live get o k response has a 5xx status code 63 | func (o *LiveGetOK) IsServerError() bool { 64 | return false 65 | } 66 | 67 | // IsCode returns true when this live get o k response a status code equal to that given 68 | func (o *LiveGetOK) IsCode(code int) bool { 69 | return code == 200 70 | } 71 | 72 | // Code gets the status code for the live get o k response 73 | func (o *LiveGetOK) Code() int { 74 | return 200 75 | } 76 | 77 | func (o *LiveGetOK) Error() string { 78 | return fmt.Sprintf("[GET /livez][%d] liveGetOK", 200) 79 | } 80 | 81 | func (o *LiveGetOK) String() string { 82 | return fmt.Sprintf("[GET /livez][%d] liveGetOK", 200) 83 | } 84 | 85 | func (o *LiveGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 86 | 87 | return nil 88 | } 89 | -------------------------------------------------------------------------------- /client/health/live_head_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package health 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | 11 | "github.com/go-openapi/runtime" 12 | "github.com/go-openapi/strfmt" 13 | ) 14 | 15 | // LiveHeadReader is a Reader for the LiveHead structure. 16 | type LiveHeadReader struct { 17 | formats strfmt.Registry 18 | } 19 | 20 | // ReadResponse reads a server response into the received o. 21 | func (o *LiveHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 22 | switch response.Code() { 23 | case 200: 24 | result := NewLiveHeadOK() 25 | if err := result.readResponse(response, consumer, o.formats); err != nil { 26 | return nil, err 27 | } 28 | return result, nil 29 | default: 30 | return nil, runtime.NewAPIError("[HEAD /livez] liveHead", response, response.Code()) 31 | } 32 | } 33 | 34 | // NewLiveHeadOK creates a LiveHeadOK with default headers values 35 | func NewLiveHeadOK() *LiveHeadOK { 36 | return &LiveHeadOK{} 37 | } 38 | 39 | /* 40 | LiveHeadOK describes a response with status code 200, with default header values. 41 | 42 | OK 43 | */ 44 | type LiveHeadOK struct { 45 | } 46 | 47 | // IsSuccess returns true when this live head o k response has a 2xx status code 48 | func (o *LiveHeadOK) IsSuccess() bool { 49 | return true 50 | } 51 | 52 | // IsRedirect returns true when this live head o k response has a 3xx status code 53 | func (o *LiveHeadOK) IsRedirect() bool { 54 | return false 55 | } 56 | 57 | // IsClientError returns true when this live head o k response has a 4xx status code 58 | func (o *LiveHeadOK) IsClientError() bool { 59 | return false 60 | } 61 | 62 | // IsServerError returns true when this live head o k response has a 5xx status code 63 | func (o *LiveHeadOK) IsServerError() bool { 64 | return false 65 | } 66 | 67 | // IsCode returns true when this live head o k response a status code equal to that given 68 | func (o *LiveHeadOK) IsCode(code int) bool { 69 | return code == 200 70 | } 71 | 72 | // Code gets the status code for the live head o k response 73 | func (o *LiveHeadOK) Code() int { 74 | return 200 75 | } 76 | 77 | func (o *LiveHeadOK) Error() string { 78 | return fmt.Sprintf("[HEAD /livez][%d] liveHeadOK", 200) 79 | } 80 | 81 | func (o *LiveHeadOK) String() string { 82 | return fmt.Sprintf("[HEAD /livez][%d] liveHeadOK", 200) 83 | } 84 | 85 | func (o *LiveHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 86 | 87 | return nil 88 | } 89 | -------------------------------------------------------------------------------- /client/health/ready_head_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package health 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | 11 | "github.com/go-openapi/runtime" 12 | "github.com/go-openapi/strfmt" 13 | ) 14 | 15 | // ReadyHeadReader is a Reader for the ReadyHead structure. 16 | type ReadyHeadReader struct { 17 | formats strfmt.Registry 18 | } 19 | 20 | // ReadResponse reads a server response into the received o. 21 | func (o *ReadyHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 22 | switch response.Code() { 23 | case 200: 24 | result := NewReadyHeadOK() 25 | if err := result.readResponse(response, consumer, o.formats); err != nil { 26 | return nil, err 27 | } 28 | return result, nil 29 | default: 30 | return nil, runtime.NewAPIError("[HEAD /readyz] readyHead", response, response.Code()) 31 | } 32 | } 33 | 34 | // NewReadyHeadOK creates a ReadyHeadOK with default headers values 35 | func NewReadyHeadOK() *ReadyHeadOK { 36 | return &ReadyHeadOK{} 37 | } 38 | 39 | /* 40 | ReadyHeadOK describes a response with status code 200, with default header values. 41 | 42 | OK 43 | */ 44 | type ReadyHeadOK struct { 45 | } 46 | 47 | // IsSuccess returns true when this ready head o k response has a 2xx status code 48 | func (o *ReadyHeadOK) IsSuccess() bool { 49 | return true 50 | } 51 | 52 | // IsRedirect returns true when this ready head o k response has a 3xx status code 53 | func (o *ReadyHeadOK) IsRedirect() bool { 54 | return false 55 | } 56 | 57 | // IsClientError returns true when this ready head o k response has a 4xx status code 58 | func (o *ReadyHeadOK) IsClientError() bool { 59 | return false 60 | } 61 | 62 | // IsServerError returns true when this ready head o k response has a 5xx status code 63 | func (o *ReadyHeadOK) IsServerError() bool { 64 | return false 65 | } 66 | 67 | // IsCode returns true when this ready head o k response a status code equal to that given 68 | func (o *ReadyHeadOK) IsCode(code int) bool { 69 | return code == 200 70 | } 71 | 72 | // Code gets the status code for the ready head o k response 73 | func (o *ReadyHeadOK) Code() int { 74 | return 200 75 | } 76 | 77 | func (o *ReadyHeadOK) Error() string { 78 | return fmt.Sprintf("[HEAD /readyz][%d] readyHeadOK", 200) 79 | } 80 | 81 | func (o *ReadyHeadOK) String() string { 82 | return fmt.Sprintf("[HEAD /readyz][%d] readyHeadOK", 200) 83 | } 84 | 85 | func (o *ReadyHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 86 | 87 | return nil 88 | } 89 | -------------------------------------------------------------------------------- /client/instance/rules_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package instance 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/strfmt" 17 | ) 18 | 19 | // NewRulesParams creates a new RulesParams object, 20 | // with the default timeout for this client. 21 | // 22 | // Default values are not hydrated, since defaults are normally applied by the API server side. 23 | // 24 | // To enforce default values in parameter, use SetDefaults or WithDefaults. 25 | func NewRulesParams() *RulesParams { 26 | return &RulesParams{ 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewRulesParamsWithTimeout creates a new RulesParams object 32 | // with the ability to set a timeout on a request. 33 | func NewRulesParamsWithTimeout(timeout time.Duration) *RulesParams { 34 | return &RulesParams{ 35 | timeout: timeout, 36 | } 37 | } 38 | 39 | // NewRulesParamsWithContext creates a new RulesParams object 40 | // with the ability to set a context for a request. 41 | func NewRulesParamsWithContext(ctx context.Context) *RulesParams { 42 | return &RulesParams{ 43 | Context: ctx, 44 | } 45 | } 46 | 47 | // NewRulesParamsWithHTTPClient creates a new RulesParams object 48 | // with the ability to set a custom HTTPClient for a request. 49 | func NewRulesParamsWithHTTPClient(client *http.Client) *RulesParams { 50 | return &RulesParams{ 51 | HTTPClient: client, 52 | } 53 | } 54 | 55 | /* 56 | RulesParams contains all the parameters to send to the API endpoint 57 | 58 | for the rules operation. 59 | 60 | Typically these are written to a http.Request. 61 | */ 62 | type RulesParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithDefaults hydrates default values in the rules params (not the query body). 69 | // 70 | // All values with no default are reset to their zero value. 71 | func (o *RulesParams) WithDefaults() *RulesParams { 72 | o.SetDefaults() 73 | return o 74 | } 75 | 76 | // SetDefaults hydrates default values in the rules params (not the query body). 77 | // 78 | // All values with no default are reset to their zero value. 79 | func (o *RulesParams) SetDefaults() { 80 | // no default values defined for this parameter 81 | } 82 | 83 | // WithTimeout adds the timeout to the rules params 84 | func (o *RulesParams) WithTimeout(timeout time.Duration) *RulesParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the rules params 90 | func (o *RulesParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the rules params 95 | func (o *RulesParams) WithContext(ctx context.Context) *RulesParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the rules params 101 | func (o *RulesParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the rules params 106 | func (o *RulesParams) WithHTTPClient(client *http.Client) *RulesParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the rules params 112 | func (o *RulesParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WriteToRequest writes these params to a swagger request 117 | func (o *RulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 118 | 119 | if err := r.SetTimeout(o.timeout); err != nil { 120 | return err 121 | } 122 | var res []error 123 | 124 | if len(res) > 0 { 125 | return errors.CompositeValidationError(res...) 126 | } 127 | return nil 128 | } 129 | -------------------------------------------------------------------------------- /client/lists/lists_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package lists 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/strfmt" 17 | ) 18 | 19 | // NewListsParams creates a new ListsParams object, 20 | // with the default timeout for this client. 21 | // 22 | // Default values are not hydrated, since defaults are normally applied by the API server side. 23 | // 24 | // To enforce default values in parameter, use SetDefaults or WithDefaults. 25 | func NewListsParams() *ListsParams { 26 | return &ListsParams{ 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewListsParamsWithTimeout creates a new ListsParams object 32 | // with the ability to set a timeout on a request. 33 | func NewListsParamsWithTimeout(timeout time.Duration) *ListsParams { 34 | return &ListsParams{ 35 | timeout: timeout, 36 | } 37 | } 38 | 39 | // NewListsParamsWithContext creates a new ListsParams object 40 | // with the ability to set a context for a request. 41 | func NewListsParamsWithContext(ctx context.Context) *ListsParams { 42 | return &ListsParams{ 43 | Context: ctx, 44 | } 45 | } 46 | 47 | // NewListsParamsWithHTTPClient creates a new ListsParams object 48 | // with the ability to set a custom HTTPClient for a request. 49 | func NewListsParamsWithHTTPClient(client *http.Client) *ListsParams { 50 | return &ListsParams{ 51 | HTTPClient: client, 52 | } 53 | } 54 | 55 | /* 56 | ListsParams contains all the parameters to send to the API endpoint 57 | 58 | for the lists operation. 59 | 60 | Typically these are written to a http.Request. 61 | */ 62 | type ListsParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithDefaults hydrates default values in the lists params (not the query body). 69 | // 70 | // All values with no default are reset to their zero value. 71 | func (o *ListsParams) WithDefaults() *ListsParams { 72 | o.SetDefaults() 73 | return o 74 | } 75 | 76 | // SetDefaults hydrates default values in the lists params (not the query body). 77 | // 78 | // All values with no default are reset to their zero value. 79 | func (o *ListsParams) SetDefaults() { 80 | // no default values defined for this parameter 81 | } 82 | 83 | // WithTimeout adds the timeout to the lists params 84 | func (o *ListsParams) WithTimeout(timeout time.Duration) *ListsParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the lists params 90 | func (o *ListsParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the lists params 95 | func (o *ListsParams) WithContext(ctx context.Context) *ListsParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the lists params 101 | func (o *ListsParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the lists params 106 | func (o *ListsParams) WithHTTPClient(client *http.Client) *ListsParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the lists params 112 | func (o *ListsParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WriteToRequest writes these params to a swagger request 117 | func (o *ListsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 118 | 119 | if err := r.SetTimeout(o.timeout); err != nil { 120 | return err 121 | } 122 | var res []error 123 | 124 | if len(res) > 0 { 125 | return errors.CompositeValidationError(res...) 126 | } 127 | return nil 128 | } 129 | -------------------------------------------------------------------------------- /client/nodeinfo/node_info_get_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package nodeinfo 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "encoding/json" 10 | "fmt" 11 | "io" 12 | 13 | "github.com/go-openapi/runtime" 14 | "github.com/go-openapi/strfmt" 15 | 16 | "github.com/VyrCossont/slurp/models" 17 | ) 18 | 19 | // NodeInfoGetReader is a Reader for the NodeInfoGet structure. 20 | type NodeInfoGetReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *NodeInfoGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | case 200: 28 | result := NewNodeInfoGetOK() 29 | if err := result.readResponse(response, consumer, o.formats); err != nil { 30 | return nil, err 31 | } 32 | return result, nil 33 | default: 34 | return nil, runtime.NewAPIError("[GET /nodeinfo/2.0] nodeInfoGet", response, response.Code()) 35 | } 36 | } 37 | 38 | // NewNodeInfoGetOK creates a NodeInfoGetOK with default headers values 39 | func NewNodeInfoGetOK() *NodeInfoGetOK { 40 | return &NodeInfoGetOK{} 41 | } 42 | 43 | /* 44 | NodeInfoGetOK describes a response with status code 200, with default header values. 45 | 46 | NodeInfoGetOK node info get o k 47 | */ 48 | type NodeInfoGetOK struct { 49 | Payload *models.Nodeinfo 50 | } 51 | 52 | // IsSuccess returns true when this node info get o k response has a 2xx status code 53 | func (o *NodeInfoGetOK) IsSuccess() bool { 54 | return true 55 | } 56 | 57 | // IsRedirect returns true when this node info get o k response has a 3xx status code 58 | func (o *NodeInfoGetOK) IsRedirect() bool { 59 | return false 60 | } 61 | 62 | // IsClientError returns true when this node info get o k response has a 4xx status code 63 | func (o *NodeInfoGetOK) IsClientError() bool { 64 | return false 65 | } 66 | 67 | // IsServerError returns true when this node info get o k response has a 5xx status code 68 | func (o *NodeInfoGetOK) IsServerError() bool { 69 | return false 70 | } 71 | 72 | // IsCode returns true when this node info get o k response a status code equal to that given 73 | func (o *NodeInfoGetOK) IsCode(code int) bool { 74 | return code == 200 75 | } 76 | 77 | // Code gets the status code for the node info get o k response 78 | func (o *NodeInfoGetOK) Code() int { 79 | return 200 80 | } 81 | 82 | func (o *NodeInfoGetOK) Error() string { 83 | payload, _ := json.Marshal(o.Payload) 84 | return fmt.Sprintf("[GET /nodeinfo/2.0][%d] nodeInfoGetOK %s", 200, payload) 85 | } 86 | 87 | func (o *NodeInfoGetOK) String() string { 88 | payload, _ := json.Marshal(o.Payload) 89 | return fmt.Sprintf("[GET /nodeinfo/2.0][%d] nodeInfoGetOK %s", 200, payload) 90 | } 91 | 92 | func (o *NodeInfoGetOK) GetPayload() *models.Nodeinfo { 93 | return o.Payload 94 | } 95 | 96 | func (o *NodeInfoGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 97 | 98 | o.Payload = new(models.Nodeinfo) 99 | 100 | // response payload 101 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 102 | return err 103 | } 104 | 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /client/nr_well_known/host_meta_get_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package nr_well_known 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "encoding/json" 10 | "fmt" 11 | "io" 12 | 13 | "github.com/go-openapi/runtime" 14 | "github.com/go-openapi/strfmt" 15 | 16 | "github.com/VyrCossont/slurp/models" 17 | ) 18 | 19 | // HostMetaGetReader is a Reader for the HostMetaGet structure. 20 | type HostMetaGetReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *HostMetaGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | case 200: 28 | result := NewHostMetaGetOK() 29 | if err := result.readResponse(response, consumer, o.formats); err != nil { 30 | return nil, err 31 | } 32 | return result, nil 33 | default: 34 | return nil, runtime.NewAPIError("[GET /.well-known/host-meta] hostMetaGet", response, response.Code()) 35 | } 36 | } 37 | 38 | // NewHostMetaGetOK creates a HostMetaGetOK with default headers values 39 | func NewHostMetaGetOK() *HostMetaGetOK { 40 | return &HostMetaGetOK{} 41 | } 42 | 43 | /* 44 | HostMetaGetOK describes a response with status code 200, with default header values. 45 | 46 | HostMetaGetOK host meta get o k 47 | */ 48 | type HostMetaGetOK struct { 49 | Payload *models.HostMeta 50 | } 51 | 52 | // IsSuccess returns true when this host meta get o k response has a 2xx status code 53 | func (o *HostMetaGetOK) IsSuccess() bool { 54 | return true 55 | } 56 | 57 | // IsRedirect returns true when this host meta get o k response has a 3xx status code 58 | func (o *HostMetaGetOK) IsRedirect() bool { 59 | return false 60 | } 61 | 62 | // IsClientError returns true when this host meta get o k response has a 4xx status code 63 | func (o *HostMetaGetOK) IsClientError() bool { 64 | return false 65 | } 66 | 67 | // IsServerError returns true when this host meta get o k response has a 5xx status code 68 | func (o *HostMetaGetOK) IsServerError() bool { 69 | return false 70 | } 71 | 72 | // IsCode returns true when this host meta get o k response a status code equal to that given 73 | func (o *HostMetaGetOK) IsCode(code int) bool { 74 | return code == 200 75 | } 76 | 77 | // Code gets the status code for the host meta get o k response 78 | func (o *HostMetaGetOK) Code() int { 79 | return 200 80 | } 81 | 82 | func (o *HostMetaGetOK) Error() string { 83 | payload, _ := json.Marshal(o.Payload) 84 | return fmt.Sprintf("[GET /.well-known/host-meta][%d] hostMetaGetOK %s", 200, payload) 85 | } 86 | 87 | func (o *HostMetaGetOK) String() string { 88 | payload, _ := json.Marshal(o.Payload) 89 | return fmt.Sprintf("[GET /.well-known/host-meta][%d] hostMetaGetOK %s", 200, payload) 90 | } 91 | 92 | func (o *HostMetaGetOK) GetPayload() *models.HostMeta { 93 | return o.Payload 94 | } 95 | 96 | func (o *HostMetaGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 97 | 98 | o.Payload = new(models.HostMeta) 99 | 100 | // response payload 101 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 102 | return err 103 | } 104 | 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /client/nr_well_known/node_info_well_known_get_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package nr_well_known 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "encoding/json" 10 | "fmt" 11 | "io" 12 | 13 | "github.com/go-openapi/runtime" 14 | "github.com/go-openapi/strfmt" 15 | 16 | "github.com/VyrCossont/slurp/models" 17 | ) 18 | 19 | // NodeInfoWellKnownGetReader is a Reader for the NodeInfoWellKnownGet structure. 20 | type NodeInfoWellKnownGetReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *NodeInfoWellKnownGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | case 200: 28 | result := NewNodeInfoWellKnownGetOK() 29 | if err := result.readResponse(response, consumer, o.formats); err != nil { 30 | return nil, err 31 | } 32 | return result, nil 33 | default: 34 | return nil, runtime.NewAPIError("[GET /.well-known/nodeinfo] nodeInfoWellKnownGet", response, response.Code()) 35 | } 36 | } 37 | 38 | // NewNodeInfoWellKnownGetOK creates a NodeInfoWellKnownGetOK with default headers values 39 | func NewNodeInfoWellKnownGetOK() *NodeInfoWellKnownGetOK { 40 | return &NodeInfoWellKnownGetOK{} 41 | } 42 | 43 | /* 44 | NodeInfoWellKnownGetOK describes a response with status code 200, with default header values. 45 | 46 | NodeInfoWellKnownGetOK node info well known get o k 47 | */ 48 | type NodeInfoWellKnownGetOK struct { 49 | Payload *models.WellKnownResponse 50 | } 51 | 52 | // IsSuccess returns true when this node info well known get o k response has a 2xx status code 53 | func (o *NodeInfoWellKnownGetOK) IsSuccess() bool { 54 | return true 55 | } 56 | 57 | // IsRedirect returns true when this node info well known get o k response has a 3xx status code 58 | func (o *NodeInfoWellKnownGetOK) IsRedirect() bool { 59 | return false 60 | } 61 | 62 | // IsClientError returns true when this node info well known get o k response has a 4xx status code 63 | func (o *NodeInfoWellKnownGetOK) IsClientError() bool { 64 | return false 65 | } 66 | 67 | // IsServerError returns true when this node info well known get o k response has a 5xx status code 68 | func (o *NodeInfoWellKnownGetOK) IsServerError() bool { 69 | return false 70 | } 71 | 72 | // IsCode returns true when this node info well known get o k response a status code equal to that given 73 | func (o *NodeInfoWellKnownGetOK) IsCode(code int) bool { 74 | return code == 200 75 | } 76 | 77 | // Code gets the status code for the node info well known get o k response 78 | func (o *NodeInfoWellKnownGetOK) Code() int { 79 | return 200 80 | } 81 | 82 | func (o *NodeInfoWellKnownGetOK) Error() string { 83 | payload, _ := json.Marshal(o.Payload) 84 | return fmt.Sprintf("[GET /.well-known/nodeinfo][%d] nodeInfoWellKnownGetOK %s", 200, payload) 85 | } 86 | 87 | func (o *NodeInfoWellKnownGetOK) String() string { 88 | payload, _ := json.Marshal(o.Payload) 89 | return fmt.Sprintf("[GET /.well-known/nodeinfo][%d] nodeInfoWellKnownGetOK %s", 200, payload) 90 | } 91 | 92 | func (o *NodeInfoWellKnownGetOK) GetPayload() *models.WellKnownResponse { 93 | return o.Payload 94 | } 95 | 96 | func (o *NodeInfoWellKnownGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 97 | 98 | o.Payload = new(models.WellKnownResponse) 99 | 100 | // response payload 101 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 102 | return err 103 | } 104 | 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /client/nr_well_known/webfinger_get_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package nr_well_known 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "encoding/json" 10 | "fmt" 11 | "io" 12 | 13 | "github.com/go-openapi/runtime" 14 | "github.com/go-openapi/strfmt" 15 | 16 | "github.com/VyrCossont/slurp/models" 17 | ) 18 | 19 | // WebfingerGetReader is a Reader for the WebfingerGet structure. 20 | type WebfingerGetReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *WebfingerGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | case 200: 28 | result := NewWebfingerGetOK() 29 | if err := result.readResponse(response, consumer, o.formats); err != nil { 30 | return nil, err 31 | } 32 | return result, nil 33 | default: 34 | return nil, runtime.NewAPIError("[GET /.well-known/webfinger] webfingerGet", response, response.Code()) 35 | } 36 | } 37 | 38 | // NewWebfingerGetOK creates a WebfingerGetOK with default headers values 39 | func NewWebfingerGetOK() *WebfingerGetOK { 40 | return &WebfingerGetOK{} 41 | } 42 | 43 | /* 44 | WebfingerGetOK describes a response with status code 200, with default header values. 45 | 46 | WebfingerGetOK webfinger get o k 47 | */ 48 | type WebfingerGetOK struct { 49 | Payload *models.WellKnownResponse 50 | } 51 | 52 | // IsSuccess returns true when this webfinger get o k response has a 2xx status code 53 | func (o *WebfingerGetOK) IsSuccess() bool { 54 | return true 55 | } 56 | 57 | // IsRedirect returns true when this webfinger get o k response has a 3xx status code 58 | func (o *WebfingerGetOK) IsRedirect() bool { 59 | return false 60 | } 61 | 62 | // IsClientError returns true when this webfinger get o k response has a 4xx status code 63 | func (o *WebfingerGetOK) IsClientError() bool { 64 | return false 65 | } 66 | 67 | // IsServerError returns true when this webfinger get o k response has a 5xx status code 68 | func (o *WebfingerGetOK) IsServerError() bool { 69 | return false 70 | } 71 | 72 | // IsCode returns true when this webfinger get o k response a status code equal to that given 73 | func (o *WebfingerGetOK) IsCode(code int) bool { 74 | return code == 200 75 | } 76 | 77 | // Code gets the status code for the webfinger get o k response 78 | func (o *WebfingerGetOK) Code() int { 79 | return 200 80 | } 81 | 82 | func (o *WebfingerGetOK) Error() string { 83 | payload, _ := json.Marshal(o.Payload) 84 | return fmt.Sprintf("[GET /.well-known/webfinger][%d] webfingerGetOK %s", 200, payload) 85 | } 86 | 87 | func (o *WebfingerGetOK) String() string { 88 | payload, _ := json.Marshal(o.Payload) 89 | return fmt.Sprintf("[GET /.well-known/webfinger][%d] webfingerGetOK %s", 200, payload) 90 | } 91 | 92 | func (o *WebfingerGetOK) GetPayload() *models.WellKnownResponse { 93 | return o.Payload 94 | } 95 | 96 | func (o *WebfingerGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 97 | 98 | o.Payload = new(models.WellKnownResponse) 99 | 100 | // response payload 101 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 102 | return err 103 | } 104 | 105 | return nil 106 | } 107 | -------------------------------------------------------------------------------- /client/user/get_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/strfmt" 17 | ) 18 | 19 | // NewGetUserParams creates a new GetUserParams object, 20 | // with the default timeout for this client. 21 | // 22 | // Default values are not hydrated, since defaults are normally applied by the API server side. 23 | // 24 | // To enforce default values in parameter, use SetDefaults or WithDefaults. 25 | func NewGetUserParams() *GetUserParams { 26 | return &GetUserParams{ 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewGetUserParamsWithTimeout creates a new GetUserParams object 32 | // with the ability to set a timeout on a request. 33 | func NewGetUserParamsWithTimeout(timeout time.Duration) *GetUserParams { 34 | return &GetUserParams{ 35 | timeout: timeout, 36 | } 37 | } 38 | 39 | // NewGetUserParamsWithContext creates a new GetUserParams object 40 | // with the ability to set a context for a request. 41 | func NewGetUserParamsWithContext(ctx context.Context) *GetUserParams { 42 | return &GetUserParams{ 43 | Context: ctx, 44 | } 45 | } 46 | 47 | // NewGetUserParamsWithHTTPClient creates a new GetUserParams object 48 | // with the ability to set a custom HTTPClient for a request. 49 | func NewGetUserParamsWithHTTPClient(client *http.Client) *GetUserParams { 50 | return &GetUserParams{ 51 | HTTPClient: client, 52 | } 53 | } 54 | 55 | /* 56 | GetUserParams contains all the parameters to send to the API endpoint 57 | 58 | for the get user operation. 59 | 60 | Typically these are written to a http.Request. 61 | */ 62 | type GetUserParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithDefaults hydrates default values in the get user params (not the query body). 69 | // 70 | // All values with no default are reset to their zero value. 71 | func (o *GetUserParams) WithDefaults() *GetUserParams { 72 | o.SetDefaults() 73 | return o 74 | } 75 | 76 | // SetDefaults hydrates default values in the get user params (not the query body). 77 | // 78 | // All values with no default are reset to their zero value. 79 | func (o *GetUserParams) SetDefaults() { 80 | // no default values defined for this parameter 81 | } 82 | 83 | // WithTimeout adds the timeout to the get user params 84 | func (o *GetUserParams) WithTimeout(timeout time.Duration) *GetUserParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the get user params 90 | func (o *GetUserParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the get user params 95 | func (o *GetUserParams) WithContext(ctx context.Context) *GetUserParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the get user params 101 | func (o *GetUserParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the get user params 106 | func (o *GetUserParams) WithHTTPClient(client *http.Client) *GetUserParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the get user params 112 | func (o *GetUserParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WriteToRequest writes these params to a swagger request 117 | func (o *GetUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 118 | 119 | if err := r.SetTimeout(o.timeout); err != nil { 120 | return err 121 | } 122 | var res []error 123 | 124 | if len(res) > 0 { 125 | return errors.CompositeValidationError(res...) 126 | } 127 | return nil 128 | } 129 | -------------------------------------------------------------------------------- /cmd/auth.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "fmt" 22 | 23 | "github.com/spf13/cobra" 24 | 25 | "github.com/VyrCossont/slurp/internal/auth" 26 | ) 27 | 28 | // authCmd represents the auth command 29 | var authCmd = &cobra.Command{ 30 | Use: "auth", 31 | Short: "Log in or out", 32 | } 33 | 34 | // authLoginCmd represents the auth login command 35 | var authLoginCmd = &cobra.Command{ 36 | Use: "login", 37 | Short: "Log in", 38 | RunE: func(cmd *cobra.Command, args []string) (err error) { 39 | keyring, err := auth.LoginKeyring(UseCleartextFileKeyring) 40 | if err != nil { 41 | return err 42 | } 43 | 44 | return auth.Login(User, AllowHTTP, keyring, auth.InteractiveAuthorizer) 45 | }, 46 | } 47 | 48 | // authLogoutCmd represents the auth logout command 49 | var authLogoutCmd = &cobra.Command{ 50 | Use: "logout", 51 | Short: "Log out", 52 | RunE: func(cmd *cobra.Command, args []string) error { 53 | return auth.Logout(User) 54 | }, 55 | } 56 | 57 | // authWhoamiCmd represents the auth whoami command 58 | var authWhoamiCmd = &cobra.Command{ 59 | Use: "whoami", 60 | Short: "Display the default currently authenticated user, if there is one", 61 | RunE: func(cmd *cobra.Command, args []string) error { 62 | user, err := auth.Whoami() 63 | if err != nil { 64 | return err 65 | } 66 | 67 | _, err = cmd.OutOrStderr().Write([]byte(fmt.Sprintf("%s\n", user))) 68 | return err 69 | }, 70 | } 71 | 72 | // authSwitchCmd represents the auth switch command 73 | var authSwitchCmd = &cobra.Command{ 74 | Use: "switch", 75 | Short: "Change the default user", 76 | RunE: func(cmd *cobra.Command, args []string) error { 77 | return auth.Switch(User) 78 | }, 79 | } 80 | 81 | // AllowHTTP allows cleartext HTTP instead of HTTPS. 82 | // Should be used for local testing only. 83 | var AllowHTTP bool 84 | 85 | // UseCleartextFileKeyring uses a cleartext file-backed keyring instead of a system keyring. 86 | // Should be used only if you're on a system that doesn't support encrypted keyrings. 87 | var UseCleartextFileKeyring bool 88 | 89 | func init() { 90 | rootCmd.AddCommand(authCmd) 91 | 92 | authLoginCmd.PersistentFlags().BoolVarP(&AllowHTTP, "allow-http", "x", false, "allow cleartext HTTP for user's instance (should be used for local testing only)") 93 | authLoginCmd.PersistentFlags().BoolVarP(&UseCleartextFileKeyring, "use-cleartext-file-keyring", "k", false, "use cleartext file keyring instead of system keyring (should be used only if your system doesn't provide a keyring)") 94 | authCmd.AddCommand(authLoginCmd) 95 | 96 | authCmd.AddCommand(authLogoutCmd) 97 | 98 | authCmd.AddCommand(authWhoamiCmd) 99 | 100 | authCmd.AddCommand(authSwitchCmd) 101 | } 102 | -------------------------------------------------------------------------------- /cmd/auth_test.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd_test 19 | 20 | import ( 21 | "errors" 22 | "io" 23 | "net/http" 24 | "net/http/cookiejar" 25 | neturl "net/url" 26 | "regexp" 27 | "strings" 28 | "testing" 29 | 30 | "github.com/VyrCossont/slurp/internal/auth" 31 | "github.com/VyrCossont/slurp/internal/util" 32 | gokeyring "github.com/zalando/go-keyring" 33 | "golang.org/x/net/publicsuffix" 34 | ) 35 | 36 | // gtsTestrigAuthorizer logs into a GTS testrig and returns an OOB auth code. 37 | func gtsTestrigAuthorizer(oauthAuthorizeURL string) (code string, err error) { 38 | // Create a client with a cookie jar. 39 | var client = &http.Client{} 40 | *client = *util.HttpClient 41 | client.Jar, err = cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List}) 42 | if err != nil { 43 | return 44 | } 45 | 46 | // Load the authorization URL. 47 | resp, err := client.Get(oauthAuthorizeURL) 48 | if err != nil { 49 | return 50 | } 51 | defer func() { 52 | _ = resp.Body.Close() 53 | }() 54 | 55 | // Log in. 56 | resp, err = client.PostForm("http://localhost:8080/auth/sign_in", neturl.Values{ 57 | "username": []string{"zork@example.org"}, 58 | "password": []string{"password"}, 59 | }) 60 | if err != nil { 61 | return 62 | } 63 | defer func() { 64 | _ = resp.Body.Close() 65 | }() 66 | 67 | // Agree to the authorization prompt. 68 | resp, err = client.PostForm("http://localhost:8080/oauth/authorize", neturl.Values{}) 69 | if err != nil { 70 | return 71 | } 72 | defer func() { 73 | _ = resp.Body.Close() 74 | }() 75 | 76 | // Get the authorization code. 77 | body, err := io.ReadAll(resp.Body) 78 | if err != nil { 79 | return 80 | } 81 | authCodePattern, err := regexp.Compile(`(\w+)`) 82 | if err != nil { 83 | return 84 | } 85 | match := authCodePattern.FindStringSubmatch(string(body)) 86 | if len(match) < 2 { 87 | err = errors.New("couldn't find OOB auth code") 88 | return 89 | } 90 | 91 | code = match[1] 92 | return 93 | } 94 | 95 | // Checks that you have a GTS testrig running. 96 | func TestGtsTestrigPresence(t *testing.T) { 97 | resp, err := util.HttpClient.Get("http://localhost:8080/") 98 | if err != nil { 99 | t.Error("failed to get landing page") 100 | t.FailNow() 101 | } 102 | defer func() { 103 | _ = resp.Body.Close() 104 | }() 105 | 106 | body, err := io.ReadAll(resp.Body) 107 | if !strings.Contains(string(body), "GoToSocial Testrig Instance") { 108 | t.Error("whatever's running on localhost:8080 isn't a GTS testrig") 109 | } 110 | } 111 | 112 | // Test that we can log into it. 113 | func TestGtsTestrigLogin(t *testing.T) { 114 | gokeyring.MockInit() 115 | if err := auth.Login( 116 | "the_mighty_zork@localhost:8080", 117 | true, 118 | util.SystemKeyring, 119 | gtsTestrigAuthorizer, 120 | ); err != nil { 121 | t.Errorf("error logging GTS testrig: %+v", err) 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /cmd/blocks.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/blocks" 25 | ) 26 | 27 | // blocksCmd represents the blocks command 28 | var blocksCmd = &cobra.Command{ 29 | Use: "blocks", 30 | Short: "Import and export blocks", 31 | } 32 | 33 | // blocksExportCmd represents the blocks export command 34 | var blocksExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of blocks", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return blocks.Export(authClient, File) 49 | }, 50 | } 51 | 52 | // blocksImportCmd represents the blocks import command 53 | var blocksImportCmd = &cobra.Command{ 54 | Use: "import", 55 | Short: "Import a list of blocks", 56 | RunE: func(cmd *cobra.Command, args []string) error { 57 | keyring, err := auth.ClientKeyring() 58 | if err != nil { 59 | return err 60 | } 61 | 62 | authClient, err := auth.NewAuthClient(User, keyring) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | return blocks.Import(authClient, File) 68 | }, 69 | } 70 | 71 | func init() { 72 | rootCmd.AddCommand(blocksCmd) 73 | 74 | blocksExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export blocks to (optional: stdout will be used if omitted)") 75 | blocksCmd.AddCommand(blocksExportCmd) 76 | 77 | blocksImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import blocks from (optional: stdin will be used if omitted)") 78 | blocksCmd.AddCommand(blocksImportCmd) 79 | } 80 | -------------------------------------------------------------------------------- /cmd/bookmarks.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/bookmarks" 25 | ) 26 | 27 | // bookmarksCmd represents the bookmarks command 28 | var bookmarksCmd = &cobra.Command{ 29 | Use: "bookmarks", 30 | Short: "Import and export bookmarks", 31 | } 32 | 33 | // bookmarksExportCmd represents the bookmarks export command 34 | var bookmarksExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of bookmarks", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return bookmarks.Export(authClient, File) 49 | }, 50 | } 51 | 52 | // bookmarksImportCmd represents the bookmarks import command 53 | var bookmarksImportCmd = &cobra.Command{ 54 | Use: "import", 55 | Short: "Import a list of bookmarks", 56 | RunE: func(cmd *cobra.Command, args []string) error { 57 | keyring, err := auth.ClientKeyring() 58 | if err != nil { 59 | return err 60 | } 61 | 62 | authClient, err := auth.NewAuthClient(User, keyring) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | return bookmarks.Import(authClient, File) 68 | }, 69 | } 70 | 71 | func init() { 72 | rootCmd.AddCommand(bookmarksCmd) 73 | 74 | bookmarksExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export bookmarks to (optional: stdout will be used if omitted)") 75 | bookmarksCmd.AddCommand(bookmarksExportCmd) 76 | 77 | bookmarksImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import bookmarks from (optional: stdin will be used if omitted)") 78 | bookmarksCmd.AddCommand(bookmarksImportCmd) 79 | } 80 | -------------------------------------------------------------------------------- /cmd/emojis.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/VyrCossont/slurp/internal/auth" 22 | "github.com/VyrCossont/slurp/internal/emojis" 23 | "github.com/spf13/cobra" 24 | ) 25 | 26 | // emojisCmd represents the emojis command 27 | var emojisCmd = &cobra.Command{ 28 | Use: "emojis", 29 | Short: "Import and export emojis", 30 | } 31 | 32 | // emojisExportCmd represents the emojis export command 33 | var emojisExportCmd = &cobra.Command{ 34 | Use: "export", 35 | Short: "Export a list of emojis", 36 | RunE: func(cmd *cobra.Command, args []string) error { 37 | keyring, err := auth.ClientKeyring() 38 | if err != nil { 39 | return err 40 | } 41 | 42 | authClient, err := auth.NewAuthClient(User, keyring) 43 | if err != nil { 44 | return err 45 | } 46 | 47 | return emojis.Export(authClient, File, Inline) 48 | }, 49 | } 50 | 51 | // emojisImportCmd represents the emojis import command 52 | var emojisImportCmd = &cobra.Command{ 53 | Use: "import", 54 | Short: "Import a list of emojis", 55 | RunE: func(cmd *cobra.Command, args []string) error { 56 | keyring, err := auth.ClientKeyring() 57 | if err != nil { 58 | return err 59 | } 60 | 61 | authClient, err := auth.NewAuthClient(User, keyring) 62 | if err != nil { 63 | return err 64 | } 65 | 66 | return emojis.Import(authClient, File) 67 | }, 68 | } 69 | 70 | // Inline includes emojis in the exported emoji JSON as data: URLs. 71 | var Inline bool 72 | 73 | func init() { 74 | rootCmd.AddCommand(emojisCmd) 75 | 76 | emojisExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export emojis to (optional: stdout will be used if omitted)") 77 | emojisExportCmd.PersistentFlags().BoolVarP(&Inline, "inline", "i", false, "inline emojis as data: URLs") 78 | emojisCmd.AddCommand(emojisExportCmd) 79 | 80 | emojisImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import emojis from (optional: stdin will be used if omitted)") 81 | emojisCmd.AddCommand(emojisImportCmd) 82 | } 83 | -------------------------------------------------------------------------------- /cmd/filters.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/filters" 25 | ) 26 | 27 | // filtersCmd represents the filters command 28 | var filtersCmd = &cobra.Command{ 29 | Use: "filters", 30 | Short: "Import and export filters", 31 | } 32 | 33 | // filtersExportCmd represents the filters export command 34 | var filtersExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of filters", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return filters.Export(authClient, File) 49 | }, 50 | } 51 | 52 | // filtersImportCmd represents the filters import command 53 | var filtersImportCmd = &cobra.Command{ 54 | Use: "import", 55 | Short: "Import a list of filters", 56 | RunE: func(cmd *cobra.Command, args []string) error { 57 | keyring, err := auth.ClientKeyring() 58 | if err != nil { 59 | return err 60 | } 61 | 62 | authClient, err := auth.NewAuthClient(User, keyring) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | return filters.Import(authClient, File) 68 | }, 69 | } 70 | 71 | func init() { 72 | rootCmd.AddCommand(filtersCmd) 73 | 74 | filtersExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export filters to (optional: stdout will be used if omitted)") 75 | filtersCmd.AddCommand(filtersExportCmd) 76 | 77 | filtersImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import filters from (optional: stdin will be used if omitted)") 78 | filtersCmd.AddCommand(filtersImportCmd) 79 | } 80 | -------------------------------------------------------------------------------- /cmd/followers.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/followers" 25 | ) 26 | 27 | // followersCmd represents the followers command 28 | var followersCmd = &cobra.Command{ 29 | Use: "followers", 30 | Short: "Export followers", 31 | } 32 | 33 | // followersExportCmd represents the followers export command 34 | var followersExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of followers", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return followers.Export(authClient, File) 49 | }, 50 | } 51 | 52 | func init() { 53 | rootCmd.AddCommand(followersCmd) 54 | 55 | followersExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export followers to (optional: stdout will be used if omitted)") 56 | followersCmd.AddCommand(followersExportCmd) 57 | } 58 | -------------------------------------------------------------------------------- /cmd/follows.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/follows" 25 | ) 26 | 27 | // followsCmd represents the follows command 28 | var followsCmd = &cobra.Command{ 29 | Use: "follows", 30 | Short: "Import and export follows", 31 | } 32 | 33 | // followsExportCmd represents the follows export command 34 | var followsExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of follows", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return follows.Export(authClient, File) 49 | }, 50 | } 51 | 52 | // followsImportCmd represents the follows import command 53 | var followsImportCmd = &cobra.Command{ 54 | Use: "import", 55 | Short: "Import a list of follows", 56 | RunE: func(cmd *cobra.Command, args []string) error { 57 | keyring, err := auth.ClientKeyring() 58 | if err != nil { 59 | return err 60 | } 61 | 62 | authClient, err := auth.NewAuthClient(User, keyring) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | return follows.Import(authClient, File) 68 | }, 69 | } 70 | 71 | func init() { 72 | rootCmd.AddCommand(followsCmd) 73 | 74 | followsExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export follows to (optional: stdout will be used if omitted)") 75 | followsCmd.AddCommand(followsExportCmd) 76 | 77 | followsImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import follows from (optional: stdin will be used if omitted)") 78 | followsCmd.AddCommand(followsImportCmd) 79 | } 80 | -------------------------------------------------------------------------------- /cmd/lists.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/lists" 25 | ) 26 | 27 | // listsCmd represents the lists command 28 | var listsCmd = &cobra.Command{ 29 | Use: "lists", 30 | Short: "Import and export lists", 31 | } 32 | 33 | // listsExportCmd represents the lists export command 34 | var listsExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of lists", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return lists.Export(authClient, File) 49 | }, 50 | } 51 | 52 | // listsImportCmd represents the lists import command 53 | var listsImportCmd = &cobra.Command{ 54 | Use: "import", 55 | Short: "Import a list of lists", 56 | RunE: func(cmd *cobra.Command, args []string) error { 57 | keyring, err := auth.ClientKeyring() 58 | if err != nil { 59 | return err 60 | } 61 | 62 | authClient, err := auth.NewAuthClient(User, keyring) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | return lists.Import(authClient, File) 68 | }, 69 | } 70 | 71 | func init() { 72 | rootCmd.AddCommand(listsCmd) 73 | 74 | listsExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export lists to (optional: stdout will be used if omitted)") 75 | listsCmd.AddCommand(listsExportCmd) 76 | 77 | listsImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import lists from (optional: stdin will be used if omitted)") 78 | listsCmd.AddCommand(listsImportCmd) 79 | } 80 | -------------------------------------------------------------------------------- /cmd/mutes.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "github.com/spf13/cobra" 22 | 23 | "github.com/VyrCossont/slurp/internal/auth" 24 | "github.com/VyrCossont/slurp/internal/mutes" 25 | ) 26 | 27 | // mutesCmd represents the mutes command 28 | var mutesCmd = &cobra.Command{ 29 | Use: "mutes", 30 | Short: "Import and export mutes", 31 | } 32 | 33 | // mutesExportCmd represents the mutes export command 34 | var mutesExportCmd = &cobra.Command{ 35 | Use: "export", 36 | Short: "Export a list of mutes", 37 | RunE: func(cmd *cobra.Command, args []string) error { 38 | keyring, err := auth.ClientKeyring() 39 | if err != nil { 40 | return err 41 | } 42 | 43 | authClient, err := auth.NewAuthClient(User, keyring) 44 | if err != nil { 45 | return err 46 | } 47 | 48 | return mutes.Export(authClient, File) 49 | }, 50 | } 51 | 52 | // mutesImportCmd represents the mutes import command 53 | var mutesImportCmd = &cobra.Command{ 54 | Use: "import", 55 | Short: "Import a list of mutes", 56 | RunE: func(cmd *cobra.Command, args []string) error { 57 | keyring, err := auth.ClientKeyring() 58 | if err != nil { 59 | return err 60 | } 61 | 62 | authClient, err := auth.NewAuthClient(User, keyring) 63 | if err != nil { 64 | return err 65 | } 66 | 67 | return mutes.Import(authClient, File) 68 | }, 69 | } 70 | 71 | func init() { 72 | rootCmd.AddCommand(mutesCmd) 73 | 74 | mutesExportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to export mutes to (optional: stdout will be used if omitted)") 75 | mutesCmd.AddCommand(mutesExportCmd) 76 | 77 | mutesImportCmd.PersistentFlags().StringVarP(&File, "file", "f", "", "path to import mutes from (optional: stdin will be used if omitted)") 78 | mutesCmd.AddCommand(mutesImportCmd) 79 | } 80 | -------------------------------------------------------------------------------- /cmd/root.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package cmd 19 | 20 | import ( 21 | "os" 22 | 23 | "github.com/spf13/cobra" 24 | ) 25 | 26 | // rootCmd represents the base command when called without any subcommands 27 | var rootCmd = &cobra.Command{ 28 | Use: "slurp", 29 | Short: "Export data from or import data to a GotoSocial-compatible Fediverse instance", 30 | } 31 | 32 | // User is the username@domain of the account whose data we're working with. 33 | var User string 34 | 35 | // File is the file path of the data we're working with. 36 | // Applies to export/import commands only. 37 | var File string 38 | 39 | // Execute adds all child commands to the root command and sets flags appropriately. 40 | // This is called by main.main(). It only needs to happen once to the rootCmd. 41 | func Execute() { 42 | err := rootCmd.Execute() 43 | if err != nil { 44 | os.Exit(1) 45 | } 46 | } 47 | 48 | func init() { 49 | rootCmd.PersistentFlags().StringVarP(&User, "user", "u", "", "username@domain of the account whose data we're working with") 50 | } 51 | -------------------------------------------------------------------------------- /generate.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package main 19 | 20 | //go:generate go run github.com/go-swagger/go-swagger/cmd/swagger generate client --spec https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/api/swagger.yaml 21 | -------------------------------------------------------------------------------- /internal/api/api.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package api 19 | 20 | import ( 21 | "log/slog" 22 | "slices" 23 | 24 | "github.com/pkg/errors" 25 | 26 | "github.com/VyrCossont/slurp/client/accounts" 27 | "github.com/VyrCossont/slurp/internal/auth" 28 | "github.com/VyrCossont/slurp/models" 29 | ) 30 | 31 | type PagedRequester[Response PagedResponse[Element], Element any] interface { 32 | Request(authClient *auth.Client, maxID *string, minID *string) (Response, error) 33 | // ForwardPaging pagers go from lowest ID to highest. 34 | ForwardPaging() bool 35 | } 36 | 37 | type PagedResponse[Element any] interface { 38 | Link() string 39 | Elements() []Element 40 | } 41 | 42 | func ReadAllPaged[ 43 | Requester PagedRequester[Response, Element], 44 | Response PagedResponse[Element], 45 | Element any, 46 | ]( 47 | authClient *auth.Client, 48 | pagedRequester Requester, 49 | maxID *string, 50 | minID *string, 51 | ) ([]Element, error) { 52 | var all []Element 53 | 54 | for { 55 | err := authClient.Wait() 56 | if err != nil { 57 | return all, errors.WithStack(err) 58 | } 59 | 60 | pagedResponse, err := pagedRequester.Request(authClient, maxID, minID) 61 | if err != nil { 62 | slog.Error("error fetching page", "error", err) 63 | return all, errors.WithStack(err) 64 | } 65 | 66 | elements := pagedResponse.Elements() 67 | if pagedRequester.ForwardPaging() { 68 | minID, err = ParseLinkMinID(pagedResponse.Link()) 69 | if err != nil { 70 | slog.Error("error parsing Link header", "error", err) 71 | return all, errors.WithStack(err) 72 | } 73 | if minID == nil { 74 | // End of pages. 75 | break 76 | } 77 | slices.Reverse(elements) 78 | } else { 79 | maxID, err = ParseLinkMaxID(pagedResponse.Link()) 80 | if err != nil { 81 | slog.Error("error parsing Link header", "error", err) 82 | return all, errors.WithStack(err) 83 | } 84 | if maxID == nil { 85 | // End of pages. 86 | break 87 | } 88 | } 89 | 90 | all = append(all, elements...) 91 | } 92 | 93 | return all, nil 94 | } 95 | 96 | const relationshipBatchSize = 40 97 | 98 | // GetBatchedRelationships fetches account relationships in batches. 99 | // If some batches fail, it will keep going. 100 | func GetBatchedRelationships(authClient *auth.Client, accountIDs []string) (relationships map[string]*models.Relationship, err error) { 101 | relationships = make(map[string]*models.Relationship, len(accountIDs)) 102 | for i := 0; i < len(accountIDs); i += relationshipBatchSize { 103 | params := &accounts.AccountRelationshipsParams{ 104 | ID: accountIDs[i:min(i+relationshipBatchSize, len(accountIDs))], 105 | } 106 | 107 | err = authClient.Wait() 108 | if err != nil { 109 | return 110 | } 111 | 112 | resp, err := authClient.Client.Accounts.AccountRelationships(params, authClient.Auth) 113 | if err != nil { 114 | slog.Warn("couldn't fetch relationships", "account_ids", params.ID) 115 | continue 116 | } 117 | 118 | for _, relationship := range resp.GetPayload() { 119 | relationships[relationship.ID] = relationship 120 | } 121 | } 122 | 123 | return 124 | } 125 | -------------------------------------------------------------------------------- /internal/api/http.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package api 19 | 20 | import ( 21 | "net/url" 22 | 23 | "github.com/peterhellberg/link" 24 | "github.com/pkg/errors" 25 | ) 26 | 27 | // ParseLinkMaxID extracts the `max_id` from the `next` link for paging to older items. 28 | func ParseLinkMaxID(linkHeader string) (*string, error) { 29 | next := link.Parse(linkHeader)["next"] 30 | if next == nil { 31 | // No link header in that direction means end of results. 32 | return nil, nil 33 | } 34 | nextUrl, err := url.Parse(next.URI) 35 | if err != nil { 36 | return nil, errors.Wrap(err, "couldn't parse next page URL") 37 | } 38 | nextMaxID := nextUrl.Query().Get("max_id") 39 | if nextMaxID == "" { 40 | return nil, errors.New("couldn't find next page max ID") 41 | } 42 | return &nextMaxID, err 43 | } 44 | 45 | // ParseLinkMinID extracts the `min_id` from the `prev` link for paging to newer items. 46 | func ParseLinkMinID(linkHeader string) (*string, error) { 47 | prev := link.Parse(linkHeader)["prev"] 48 | if prev == nil { 49 | // No link header in that direction means end of results. 50 | return nil, nil 51 | } 52 | prevUrl, err := url.Parse(prev.URI) 53 | if err != nil { 54 | return nil, errors.Wrap(err, "couldn't parse prev page URL") 55 | } 56 | prevMinID := prevUrl.Query().Get("min_id") 57 | if prevMinID == "" { 58 | return nil, errors.New("couldn't find prev page min ID") 59 | } 60 | return &prevMinID, err 61 | } 62 | -------------------------------------------------------------------------------- /internal/archive/actor.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package archive 19 | 20 | type Actor struct { 21 | Id string `json:"id"` 22 | Followers string `json:"followers"` 23 | Outbox string `json:"outbox"` 24 | PreferredUsername string `json:"preferredUsername"` 25 | Url string `json:"url"` 26 | } 27 | -------------------------------------------------------------------------------- /internal/archive/download.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package archive 19 | 20 | import ( 21 | "context" 22 | "io" 23 | "log/slog" 24 | "net/http" 25 | "os" 26 | "path" 27 | 28 | "golang.org/x/time/rate" 29 | ) 30 | 31 | // DownloadAttachment downloads an attachment to a local directory, building the full path from the remote filename. 32 | // It returns the local path and the MIME type (or "application/octet-stream" if the remote server doesn't send one). 33 | // It uses slog and takes the status URI for log context. 34 | func DownloadAttachment( 35 | ctx context.Context, 36 | mediaDownloadLimiter *rate.Limiter, 37 | mediaDownloadClient *http.Client, 38 | statusURI string, 39 | localDir string, 40 | url string, 41 | ) (string, string, error) { 42 | localPath := path.Join(localDir, path.Base(url)) 43 | localFile, err := os.Create(localPath) 44 | if err != nil { 45 | slog.Error("Error creating local attachment file", "status", statusURI, "attachment", url, "localPath", localPath, "err", err) 46 | } 47 | defer func() { 48 | if err = localFile.Close(); err != nil { 49 | slog.Error("Error closing local attachment file", "status", statusURI, "attachment", url, "localPath", localPath, "err", err) 50 | } 51 | }() 52 | 53 | // TODO: (Vyr) add media download timeout 54 | if err = mediaDownloadLimiter.Wait(ctx); err != nil { 55 | return "", "", err 56 | } 57 | 58 | // Download the attachment from the original server. 59 | resp, err := mediaDownloadClient.Get(url) 60 | if err != nil { 61 | slog.Error("Error downloading attachment", "status", statusURI, "attachment", url, "err", err) 62 | return "", "", err 63 | } 64 | defer func() { 65 | if err := resp.Body.Close(); err != nil { 66 | slog.Error("Error closing attachment response body", "status", statusURI, "attachment", url, "err", err) 67 | } 68 | }() 69 | contentType := resp.Header.Get("Content-Type") 70 | if contentType == "" { 71 | contentType = "application/octet-stream" 72 | } 73 | 74 | if _, err = io.Copy(localFile, resp.Body); err != nil { 75 | slog.Error("Error copying response to local file", "status", statusURI, "attachment", url, "localPath", localPath, "err", err) 76 | return "", "", err 77 | } 78 | 79 | return localPath, contentType, nil 80 | } 81 | -------------------------------------------------------------------------------- /internal/archive/mapfile.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package archive 19 | 20 | import ( 21 | "encoding/json" 22 | "errors" 23 | "io/fs" 24 | "os" 25 | "strings" 26 | ) 27 | 28 | func readMapFile(mapFile string) (map[string]string, error) { 29 | jsonFile, err := os.Open(mapFile) 30 | if err != nil { 31 | return nil, err 32 | } 33 | defer func() { _ = jsonFile.Close() }() 34 | 35 | var doc map[string]string 36 | if err := json.NewDecoder(jsonFile).Decode(&doc); err != nil { 37 | return nil, err 38 | } 39 | return doc, nil 40 | } 41 | 42 | func writeMapFile(mapFile string, doc map[string]string) error { 43 | jsonFile, err := os.Create(mapFile) 44 | if err != nil { 45 | return err 46 | } 47 | defer func() { _ = jsonFile.Close() }() 48 | 49 | encoder := json.NewEncoder(jsonFile) 50 | encoder.SetIndent("", " ") 51 | encoder.SetEscapeHTML(false) 52 | return encoder.Encode(doc) 53 | } 54 | 55 | func requireMapFiles(statusMapFile string, attachmentMapFile string) (map[string]string, map[string]string, error) { 56 | // Require status map file. 57 | if !strings.HasSuffix(strings.ToLower(statusMapFile), ".json") { 58 | return nil, nil, errors.New("status map file is required and must have a .json extension") 59 | } 60 | archiveIdToImportedApiId, err := readMapFile(statusMapFile) 61 | if err != nil { 62 | if errors.Is(err, fs.ErrNotExist) { 63 | archiveIdToImportedApiId = map[string]string{} 64 | } else { 65 | return nil, nil, err 66 | } 67 | } 68 | if err = writeMapFile(statusMapFile, archiveIdToImportedApiId); err != nil { 69 | return nil, nil, err 70 | } 71 | 72 | // Require attachment map file. 73 | if !strings.HasSuffix(strings.ToLower(attachmentMapFile), ".json") { 74 | return nil, nil, errors.New("attachment map file is required and must have a .json extension") 75 | } 76 | mediaPathToImportedApiId, err := readMapFile(attachmentMapFile) 77 | if err != nil { 78 | if errors.Is(err, fs.ErrNotExist) { 79 | mediaPathToImportedApiId = map[string]string{} 80 | } else { 81 | return nil, nil, err 82 | } 83 | } 84 | if err = writeMapFile(attachmentMapFile, mediaPathToImportedApiId); err != nil { 85 | return nil, nil, err 86 | } 87 | 88 | return archiveIdToImportedApiId, mediaPathToImportedApiId, nil 89 | } 90 | -------------------------------------------------------------------------------- /internal/followers/followers.go: -------------------------------------------------------------------------------- 1 | package followers 2 | 3 | import ( 4 | "strings" 5 | 6 | "github.com/VyrCossont/slurp/client/accounts" 7 | "github.com/VyrCossont/slurp/internal/api" 8 | "github.com/VyrCossont/slurp/internal/auth" 9 | "github.com/VyrCossont/slurp/internal/own" 10 | "github.com/VyrCossont/slurp/internal/util" 11 | "github.com/VyrCossont/slurp/models" 12 | ) 13 | 14 | func Export(authClient *auth.Client, file string) error { 15 | ownAccount, err := own.Account(authClient) 16 | if err != nil { 17 | return err 18 | } 19 | pagedRequester := &accountFollowersPagedRequester{accountID: ownAccount.ID} 20 | 21 | ownDomain, err := own.Domain(authClient) 22 | if err != nil { 23 | return err 24 | } 25 | 26 | followedAccounts, err := api.ReadAllPaged(authClient, pagedRequester, nil, nil) 27 | if err != nil { 28 | return err 29 | } 30 | 31 | followers := make([]*followersListEntry, 0, len(followedAccounts)) 32 | for _, account := range followedAccounts { 33 | followers = append(followers, newFollowersListEntry(ownDomain, account)) 34 | } 35 | 36 | csvRows := make([][]string, 0, 1+len(followers)) 37 | csvRows = append(csvRows, csvHeader) 38 | for _, follower := range followers { 39 | csvRows = append(csvRows, follower.csvFields()) 40 | } 41 | 42 | return util.WriteCSV(file, csvRows) 43 | } 44 | 45 | type accountFollowersPagedRequester struct { 46 | accountID string 47 | forwardPaging bool 48 | } 49 | 50 | func (pagedRequester *accountFollowersPagedRequester) Request(authClient *auth.Client, maxID *string, minID *string) (*accountFollowersPagedResponse, error) { 51 | resp, err := authClient.Client.Accounts.AccountFollowers(&accounts.AccountFollowersParams{ 52 | ID: pagedRequester.accountID, 53 | MaxID: maxID, 54 | MinID: minID, 55 | }, authClient.Auth) 56 | if err != nil { 57 | return nil, err 58 | } 59 | return &accountFollowersPagedResponse{resp}, nil 60 | } 61 | 62 | func (pagedRequester *accountFollowersPagedRequester) ForwardPaging() bool { 63 | return pagedRequester.forwardPaging 64 | } 65 | 66 | type accountFollowersPagedResponse struct { 67 | resp *accounts.AccountFollowersOK 68 | } 69 | 70 | func (pagedResponse *accountFollowersPagedResponse) Link() string { 71 | return pagedResponse.resp.Link 72 | } 73 | 74 | func (pagedResponse *accountFollowersPagedResponse) Elements() []*models.Account { 75 | return pagedResponse.resp.GetPayload() 76 | } 77 | 78 | var csvHeader = []string{ 79 | "Account address", 80 | } 81 | 82 | type followersListEntry struct { 83 | accountAddress string 84 | } 85 | 86 | func newFollowersListEntry(ownDomain string, account *models.Account) *followersListEntry { 87 | e := &followersListEntry{ 88 | accountAddress: account.Acct, 89 | } 90 | if !strings.ContainsRune(e.accountAddress, '@') { 91 | e.accountAddress += "@" + ownDomain 92 | } 93 | return e 94 | } 95 | 96 | func (e *followersListEntry) csvFields() []string { 97 | return []string{ 98 | e.accountAddress, 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /internal/own/own.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package own 19 | 20 | import ( 21 | "log/slog" 22 | 23 | "github.com/pkg/errors" 24 | 25 | "github.com/VyrCossont/slurp/internal/auth" 26 | "github.com/VyrCossont/slurp/models" 27 | ) 28 | 29 | // Account returns the currently authenticated account. 30 | func Account(authClient *auth.Client) (*models.Account, error) { 31 | err := authClient.Wait() 32 | if err != nil { 33 | return nil, err 34 | } 35 | 36 | resp, err := authClient.Client.Accounts.AccountVerify(nil, authClient.Auth) 37 | if err != nil { 38 | return nil, errors.WithStack(err) 39 | } 40 | 41 | return resp.GetPayload(), nil 42 | } 43 | 44 | // Instance returns the instance of the currently authenticated account. 45 | func Instance(authClient *auth.Client) (*models.InstanceV2, error) { 46 | err := authClient.Wait() 47 | if err != nil { 48 | return nil, err 49 | } 50 | 51 | resp, err := authClient.Client.Instance.InstanceGetV2(nil) 52 | if err != nil { 53 | return nil, errors.WithStack(err) 54 | } 55 | 56 | return resp.GetPayload(), nil 57 | } 58 | 59 | func Domain(authClient *auth.Client) (string, error) { 60 | ownInstance, err := Instance(authClient) 61 | if err != nil { 62 | return "", err 63 | } 64 | 65 | ownDomain := ownInstance.AccountDomain 66 | if ownDomain == "" { 67 | ownDomain = ownInstance.Domain 68 | } 69 | if ownDomain == "" { 70 | return "", errors.WithStack(errors.New("couldn't find domain for accounts on this instance")) 71 | } 72 | 73 | return ownDomain, nil 74 | } 75 | 76 | // Emojis returns custom emojis available to the authenticated account. 77 | func Emojis(authClient *auth.Client) ([]*models.Emoji, error) { 78 | if err := authClient.Wait(); err != nil { 79 | return nil, errors.WithStack(err) 80 | } 81 | 82 | response, err := authClient.Client.CustomEmojis.CustomEmojisGet(nil, authClient.Auth) 83 | if err != nil { 84 | slog.Error("error getting emojis", "error", err) 85 | return nil, errors.WithStack(err) 86 | } 87 | 88 | return response.GetPayload(), nil 89 | } 90 | -------------------------------------------------------------------------------- /internal/resolve/resolve.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package resolve 19 | 20 | import ( 21 | "errors" 22 | 23 | "github.com/VyrCossont/slurp/client/search" 24 | "github.com/VyrCossont/slurp/internal/auth" 25 | "github.com/VyrCossont/slurp/internal/util" 26 | "github.com/VyrCossont/slurp/models" 27 | ) 28 | 29 | // NoResults indicated we didn't find anything. 30 | // This shouldn't stop a bulk operation. 31 | var NoResults = errors.New("no search results") 32 | 33 | // Account uses the search API to resolve an account. 34 | // The account can be a URL, or a @-prefixed username with optional domain. 35 | func Account(authClient *auth.Client, accountOrURL string) (*models.Account, error) { 36 | results, err := search1(authClient, accountOrURL, "accounts") 37 | if err != nil { 38 | return nil, err 39 | } 40 | if len(results.Accounts) == 0 { 41 | return nil, NoResults 42 | } 43 | return results.Accounts[0], nil 44 | } 45 | 46 | // Status uses the search API to resolve a status by URL. 47 | func Status(authClient *auth.Client, url string) (*models.Status, error) { 48 | results, err := search1(authClient, url, "statuses") 49 | if err != nil { 50 | return nil, err 51 | } 52 | if len(results.Statuses) == 0 { 53 | return nil, NoResults 54 | } 55 | return results.Statuses[0], nil 56 | } 57 | 58 | func search1(authClient *auth.Client, q string, searchType string) (*models.SearchResult, error) { 59 | resp, err := authClient.Client.Search.SearchGet(&search.SearchGetParams{ 60 | APIVersion: "v2", 61 | Limit: util.Ptr(int64(1)), 62 | Q: q, 63 | Resolve: util.Ptr(true), 64 | Type: util.Ptr(searchType), 65 | }, authClient.Auth) 66 | if err != nil { 67 | return nil, err 68 | } 69 | return resp.GetPayload(), nil 70 | } 71 | -------------------------------------------------------------------------------- /internal/util/csv.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "encoding/csv" 5 | "log/slog" 6 | "os" 7 | 8 | "github.com/pkg/errors" 9 | ) 10 | 11 | // ReadCSV reads CSV data from a file or stdout. 12 | func ReadCSV(file string) ([][]string, error) { 13 | var err error 14 | in := os.Stdin 15 | if file != "" { 16 | in, err = os.Open(file) 17 | if err != nil { 18 | slog.Error("couldn't open input file", "error", err) 19 | return nil, errors.WithStack(err) 20 | } 21 | defer func() { _ = in.Close() }() 22 | } 23 | 24 | r := csv.NewReader(in) 25 | rows, err := r.ReadAll() 26 | if err != nil { 27 | slog.Error("couldn't read from input file", "error", err) 28 | return nil, errors.WithStack(err) 29 | } 30 | 31 | return rows, nil 32 | } 33 | 34 | // RemoveExpectedCSVHeader checks that the CSV's header is a non-empty prefix of the expected header, 35 | // and removes it from the rows. 36 | func RemoveExpectedCSVHeader(expectedHeader []string, rows [][]string) ([][]string, error) { 37 | if len(rows) == 0 { 38 | return nil, errors.WithStack(errors.New("expected CSV header but file is empty")) 39 | } 40 | 41 | header := rows[0] 42 | rows = rows[1:] 43 | if len(header) == 0 { 44 | return nil, errors.WithStack(errors.New("expected CSV header but first row has no fields")) 45 | } 46 | 47 | for i, field := range header[:min(len(header), len(expectedHeader))] { 48 | if field != expectedHeader[i] { 49 | return nil, errors.WithStack(errors.Errorf("unexpected column in CSV header: %v", field)) 50 | } 51 | } 52 | 53 | return rows, nil 54 | } 55 | 56 | // WriteCSV writes CSV data to a file or stdout. 57 | func WriteCSV(file string, rows [][]string) error { 58 | var err error 59 | out := os.Stdout 60 | if file != "" { 61 | out, err = os.Create(file) 62 | if err != nil { 63 | slog.Error("couldn't create output file", "error", err) 64 | return errors.WithStack(err) 65 | } 66 | defer func() { _ = out.Close() }() 67 | } 68 | 69 | w := csv.NewWriter(out) 70 | err = w.WriteAll(rows) 71 | if err != nil { 72 | slog.Error("couldn't write to output file", "error", err) 73 | return errors.WithStack(err) 74 | } 75 | 76 | return nil 77 | } 78 | -------------------------------------------------------------------------------- /internal/util/fs.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package util 19 | 20 | import ( 21 | "encoding/json" 22 | "errors" 23 | "io" 24 | "log/slog" 25 | "os" 26 | ) 27 | 28 | // IsEmpty returns whether a folder is empty. 29 | func IsEmpty(folderPath string) (bool, error) { 30 | archiveFolder, err := os.Open(folderPath) 31 | if err != nil { 32 | slog.Error("couldn't open folder to list it", "path", folderPath, "err", err) 33 | return false, err 34 | } 35 | defer func() { 36 | err = archiveFolder.Close() 37 | if err != nil { 38 | slog.Error("couldn't close folder", "path", folderPath, "err", err) 39 | } 40 | }() 41 | _, err = archiveFolder.Readdirnames(1) 42 | if err != nil { 43 | if errors.Is(err, io.EOF) { 44 | return true, nil 45 | } 46 | slog.Error("couldn't list folder", "path", folderPath, "err", err) 47 | return false, err 48 | } 49 | return false, nil 50 | } 51 | 52 | func SaveJSON(path string, data any) error { 53 | f, err := os.Create(path) 54 | if err != nil { 55 | slog.Error("couldn't create output file", "path", path, "err", err) 56 | return err 57 | } 58 | defer func() { 59 | err = f.Close() 60 | if err != nil { 61 | slog.Error("couldn't close output file", "path", path, "err", err) 62 | } 63 | }() 64 | 65 | encoder := json.NewEncoder(f) 66 | encoder.SetEscapeHTML(false) 67 | encoder.SetIndent("", " ") 68 | if err = encoder.Encode(data); err != nil { 69 | slog.Error("couldn't write data as JSON to output file", "path", path, "data", data, "err", err) 70 | return err 71 | } 72 | return nil 73 | } 74 | -------------------------------------------------------------------------------- /internal/util/http.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package util 19 | 20 | import ( 21 | "fmt" 22 | "net/http" 23 | ) 24 | 25 | // userAgentRoundTripper adds a User-Agent header on top of the default transport. 26 | type userAgentRoundTripper struct{} 27 | 28 | func (u *userAgentRoundTripper) RoundTrip(request *http.Request) (*http.Response, error) { 29 | request.Header.Set("User-Agent", userAgent) 30 | return http.DefaultTransport.RoundTrip(request) 31 | } 32 | 33 | var Website = "https://catgirl.codes/slurp" 34 | 35 | var version = "0.0.0" 36 | 37 | var userAgent string 38 | 39 | var HttpClient *http.Client 40 | 41 | func init() { 42 | userAgent = fmt.Sprintf("slurp/%s (+%s)", version, Website) 43 | HttpClient = &http.Client{ 44 | Transport: &userAgentRoundTripper{}, 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /internal/util/ptr.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package util 19 | 20 | func Ptr[T any](v T) *T { return &v } 21 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Slurp 2 | // Copyright (C) Vyr Cossont 3 | // SPDX-License-Identifier: AGPL-3.0-or-later 4 | // 5 | // This program is free software: you can redistribute it and/or modify 6 | // it under the terms of the GNU Affero General Public License as published by 7 | // the Free Software Foundation, either version 3 of the License, or 8 | // (at your option) any later version. 9 | // 10 | // This program is distributed in the hope that it will be useful, 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | // GNU Affero General Public License for more details. 14 | // 15 | // You should have received a copy of the GNU Affero General Public License 16 | // along with this program. If not, see . 17 | 18 | package main 19 | 20 | import "github.com/VyrCossont/slurp/cmd" 21 | 22 | func main() { 23 | cmd.Execute() 24 | } 25 | -------------------------------------------------------------------------------- /models/account_display_role.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // AccountDisplayRole AccountDisplayRole models a public, displayable role of an account. 16 | // 17 | // This is a subset of AccountRole. 18 | // 19 | // swagger:model AccountDisplayRole 20 | type AccountDisplayRole struct { 21 | 22 | // Color is a 6-digit CSS-style hex color code with leading `#`, or an empty string if this role has no color. 23 | // Since GotoSocial doesn't use role colors, we leave this empty. 24 | Color string `json:"color,omitempty"` 25 | 26 | // ID of the role. 27 | // Not used by GotoSocial, but we set it to the role name, just in case a client expects a unique ID. 28 | ID string `json:"id,omitempty"` 29 | 30 | // Name of the role. 31 | Name string `json:"name,omitempty"` 32 | } 33 | 34 | // Validate validates this account display role 35 | func (m *AccountDisplayRole) Validate(formats strfmt.Registry) error { 36 | return nil 37 | } 38 | 39 | // ContextValidate validates this account display role based on context it is used 40 | func (m *AccountDisplayRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 41 | return nil 42 | } 43 | 44 | // MarshalBinary interface implementation 45 | func (m *AccountDisplayRole) MarshalBinary() ([]byte, error) { 46 | if m == nil { 47 | return nil, nil 48 | } 49 | return swag.WriteJSON(m) 50 | } 51 | 52 | // UnmarshalBinary interface implementation 53 | func (m *AccountDisplayRole) UnmarshalBinary(b []byte) error { 54 | var res AccountDisplayRole 55 | if err := swag.ReadJSON(b, &res); err != nil { 56 | return err 57 | } 58 | *m = res 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /models/account_export_stats.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // AccountExportStats AccountExportStats models an account's stats 16 | // specifically for the purpose of informing about 17 | // export sizes at the /api/v1/exports/stats endpoint. 18 | // 19 | // swagger:model AccountExportStats 20 | type AccountExportStats struct { 21 | 22 | // Number of accounts blocked by this account. 23 | // Example: 15 24 | BlocksCount int64 `json:"blocks_count,omitempty"` 25 | 26 | // Number of accounts following this account. 27 | // Example: 50 28 | FollowersCount int64 `json:"followers_count,omitempty"` 29 | 30 | // Number of accounts followed by this account. 31 | // Example: 50 32 | FollowingCount int64 `json:"following_count,omitempty"` 33 | 34 | // Number of lists created by this account. 35 | // Example: 10 36 | ListsCount int64 `json:"lists_count,omitempty"` 37 | 38 | // TODO: String representation of media storage size attributed to this account. 39 | // Example: 500MB 40 | MediaStorage string `json:"media_storage,omitempty"` 41 | 42 | // Number of accounts muted by this account. 43 | // Example: 11 44 | MutesCount int64 `json:"mutes_count,omitempty"` 45 | 46 | // Number of statuses created by this account. 47 | // Example: 81986 48 | StatusesCount int64 `json:"statuses_count,omitempty"` 49 | } 50 | 51 | // Validate validates this account export stats 52 | func (m *AccountExportStats) Validate(formats strfmt.Registry) error { 53 | return nil 54 | } 55 | 56 | // ContextValidate validates this account export stats based on context it is used 57 | func (m *AccountExportStats) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 58 | return nil 59 | } 60 | 61 | // MarshalBinary interface implementation 62 | func (m *AccountExportStats) MarshalBinary() ([]byte, error) { 63 | if m == nil { 64 | return nil, nil 65 | } 66 | return swag.WriteJSON(m) 67 | } 68 | 69 | // UnmarshalBinary interface implementation 70 | func (m *AccountExportStats) UnmarshalBinary(b []byte) error { 71 | var res AccountExportStats 72 | if err := swag.ReadJSON(b, &res); err != nil { 73 | return err 74 | } 75 | *m = res 76 | return nil 77 | } 78 | -------------------------------------------------------------------------------- /models/account_role.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // AccountRole AccountRole models the role of an account. 16 | // 17 | // swagger:model AccountRole 18 | type AccountRole struct { 19 | 20 | // Color is a 6-digit CSS-style hex color code with leading `#`, or an empty string if this role has no color. 21 | // Since GotoSocial doesn't use role colors, we leave this empty. 22 | Color string `json:"color,omitempty"` 23 | 24 | // Highlighted indicates whether the role is publicly visible on the user profile. 25 | // This is always true for GotoSocial's built-in admin and moderator roles, and false otherwise. 26 | Highlighted bool `json:"highlighted,omitempty"` 27 | 28 | // ID of the role. 29 | // Not used by GotoSocial, but we set it to the role name, just in case a client expects a unique ID. 30 | ID string `json:"id,omitempty"` 31 | 32 | // Name of the role. 33 | Name string `json:"name,omitempty"` 34 | 35 | // Permissions is a bitmap serialized as a numeric string, indicating which admin/moderation actions a user can perform. 36 | Permissions string `json:"permissions,omitempty"` 37 | } 38 | 39 | // Validate validates this account role 40 | func (m *AccountRole) Validate(formats strfmt.Registry) error { 41 | return nil 42 | } 43 | 44 | // ContextValidate validates this account role based on context it is used 45 | func (m *AccountRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 46 | return nil 47 | } 48 | 49 | // MarshalBinary interface implementation 50 | func (m *AccountRole) MarshalBinary() ([]byte, error) { 51 | if m == nil { 52 | return nil, nil 53 | } 54 | return swag.WriteJSON(m) 55 | } 56 | 57 | // UnmarshalBinary interface implementation 58 | func (m *AccountRole) UnmarshalBinary(b []byte) error { 59 | var res AccountRole 60 | if err := swag.ReadJSON(b, &res); err != nil { 61 | return err 62 | } 63 | *m = res 64 | return nil 65 | } 66 | -------------------------------------------------------------------------------- /models/admin_action_response.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // AdminActionResponse AdminActionResponse models the server 16 | // response to an admin action. 17 | // 18 | // swagger:model AdminActionResponse 19 | type AdminActionResponse struct { 20 | 21 | // Internal ID of the action. 22 | // Example: 01H9QG6TZ9W5P0402VFRVM17TH 23 | ActionID string `json:"action_id,omitempty"` 24 | } 25 | 26 | // Validate validates this admin action response 27 | func (m *AdminActionResponse) Validate(formats strfmt.Registry) error { 28 | return nil 29 | } 30 | 31 | // ContextValidate validates this admin action response based on context it is used 32 | func (m *AdminActionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 33 | return nil 34 | } 35 | 36 | // MarshalBinary interface implementation 37 | func (m *AdminActionResponse) MarshalBinary() ([]byte, error) { 38 | if m == nil { 39 | return nil, nil 40 | } 41 | return swag.WriteJSON(m) 42 | } 43 | 44 | // UnmarshalBinary interface implementation 45 | func (m *AdminActionResponse) UnmarshalBinary(b []byte) error { 46 | var res AdminActionResponse 47 | if err := swag.ReadJSON(b, &res); err != nil { 48 | return err 49 | } 50 | *m = res 51 | return nil 52 | } 53 | -------------------------------------------------------------------------------- /models/admin_emoji.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // AdminEmoji AdminEmoji models the admin view of a custom emoji. 16 | // 17 | // swagger:model AdminEmoji 18 | type AdminEmoji struct { 19 | 20 | // Used for sorting custom emoji in the picker. 21 | // Example: blobcats 22 | Category string `json:"category,omitempty"` 23 | 24 | // The MIME content type of the emoji. 25 | // Example: image/png 26 | ContentType string `json:"content_type,omitempty"` 27 | 28 | // True if this emoji has been disabled by an admin action. 29 | // Example: false 30 | Disabled bool `json:"disabled,omitempty"` 31 | 32 | // The domain from which the emoji originated. Only defined for remote domains, otherwise key will not be set. 33 | // Example: example.org 34 | Domain string `json:"domain,omitempty"` 35 | 36 | // The ID of the emoji. 37 | // Example: 01GEM7SFDZ7GZNRXFVZ3X4E4N1 38 | ID string `json:"id,omitempty"` 39 | 40 | // The name of the custom emoji. 41 | // Example: blobcat_uwu 42 | Shortcode string `json:"shortcode,omitempty"` 43 | 44 | // A link to a static copy of the custom emoji. 45 | // Example: https://example.org/fileserver/emojis/blogcat_uwu.png 46 | StaticURL string `json:"static_url,omitempty"` 47 | 48 | // The total file size taken up by the emoji in bytes, including static and animated versions. 49 | // Example: 69420 50 | TotalFileSize int64 `json:"total_file_size,omitempty"` 51 | 52 | // The ActivityPub URI of the emoji. 53 | // Example: https://example.org/emojis/016T5Q3SQKBT337DAKVSKNXXW1 54 | URI string `json:"uri,omitempty"` 55 | 56 | // Web URL of the custom emoji. 57 | // Example: https://example.org/fileserver/emojis/blogcat_uwu.gif 58 | URL string `json:"url,omitempty"` 59 | 60 | // Time when the emoji image was last updated. 61 | // Example: 2022-10-05T09:21:26.419Z 62 | UpdatedAt string `json:"updated_at,omitempty"` 63 | 64 | // Emoji is visible in the emoji picker of the instance. 65 | // Example: true 66 | VisibleInPicker bool `json:"visible_in_picker,omitempty"` 67 | } 68 | 69 | // Validate validates this admin emoji 70 | func (m *AdminEmoji) Validate(formats strfmt.Registry) error { 71 | return nil 72 | } 73 | 74 | // ContextValidate validates this admin emoji based on context it is used 75 | func (m *AdminEmoji) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 76 | return nil 77 | } 78 | 79 | // MarshalBinary interface implementation 80 | func (m *AdminEmoji) MarshalBinary() ([]byte, error) { 81 | if m == nil { 82 | return nil, nil 83 | } 84 | return swag.WriteJSON(m) 85 | } 86 | 87 | // UnmarshalBinary interface implementation 88 | func (m *AdminEmoji) UnmarshalBinary(b []byte) error { 89 | var res AdminEmoji 90 | if err := swag.ReadJSON(b, &res); err != nil { 91 | return err 92 | } 93 | *m = res 94 | return nil 95 | } 96 | -------------------------------------------------------------------------------- /models/application.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Application Application models an api application. 16 | // 17 | // swagger:model Application 18 | type Application struct { 19 | 20 | // Client ID associated with this application. 21 | ClientID string `json:"client_id,omitempty"` 22 | 23 | // Client secret associated with this application. 24 | ClientSecret string `json:"client_secret,omitempty"` 25 | 26 | // The ID of the application. 27 | // Example: 01FBVD42CQ3ZEEVMW180SBX03B 28 | ID string `json:"id,omitempty"` 29 | 30 | // The name of the application. 31 | // Example: Tusky 32 | Name string `json:"name,omitempty"` 33 | 34 | // Post-authorization redirect URI for the application (OAuth2). 35 | // Example: https://example.org/callback?some=query 36 | RedirectURI string `json:"redirect_uri,omitempty"` 37 | 38 | // Push API key for this application. 39 | VapidKey string `json:"vapid_key,omitempty"` 40 | 41 | // The website associated with the application (url) 42 | // Example: https://tusky.app 43 | Website string `json:"website,omitempty"` 44 | } 45 | 46 | // Validate validates this application 47 | func (m *Application) Validate(formats strfmt.Registry) error { 48 | return nil 49 | } 50 | 51 | // ContextValidate validates this application based on context it is used 52 | func (m *Application) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 53 | return nil 54 | } 55 | 56 | // MarshalBinary interface implementation 57 | func (m *Application) MarshalBinary() ([]byte, error) { 58 | if m == nil { 59 | return nil, nil 60 | } 61 | return swag.WriteJSON(m) 62 | } 63 | 64 | // UnmarshalBinary interface implementation 65 | func (m *Application) UnmarshalBinary(b []byte) error { 66 | var res Application 67 | if err := swag.ReadJSON(b, &res); err != nil { 68 | return err 69 | } 70 | *m = res 71 | return nil 72 | } 73 | -------------------------------------------------------------------------------- /models/card.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Card Card represents a rich preview card that is generated using OpenGraph tags from a URL. 16 | // 17 | // swagger:model Card 18 | type Card struct { 19 | 20 | // The author of the original resource. 21 | // Example: weewee@buzzfeed.com 22 | AuthorName string `json:"author_name,omitempty"` 23 | 24 | // A link to the author of the original resource. 25 | // Example: https://buzzfeed.com/authors/weewee 26 | AuthorURL string `json:"author_url,omitempty"` 27 | 28 | // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. 29 | Blurhash string `json:"blurhash,omitempty"` 30 | 31 | // Description of preview. 32 | // Example: Is water wet? We're not sure. In this article, we ask an expert... 33 | Description string `json:"description,omitempty"` 34 | 35 | // Used for photo embeds, instead of custom html. 36 | EmbedURL string `json:"embed_url,omitempty"` 37 | 38 | // HTML to be used for generating the preview card. 39 | HTML string `json:"html,omitempty"` 40 | 41 | // Height of preview, in pixels. 42 | Height int64 `json:"height,omitempty"` 43 | 44 | // Preview thumbnail. 45 | // Example: https://example.org/fileserver/preview/thumb.jpg 46 | Image string `json:"image,omitempty"` 47 | 48 | // The provider of the original resource. 49 | // Example: Buzzfeed 50 | ProviderName string `json:"provider_name,omitempty"` 51 | 52 | // A link to the provider of the original resource. 53 | // Example: https://buzzfeed.com 54 | ProviderURL string `json:"provider_url,omitempty"` 55 | 56 | // Title of linked resource. 57 | // Example: Buzzfeed - Is Water Wet? 58 | Title string `json:"title,omitempty"` 59 | 60 | // The type of the preview card. 61 | // Example: link 62 | Type string `json:"type,omitempty"` 63 | 64 | // Location of linked resource. 65 | // Example: https://buzzfeed.com/some/fuckin/buzzfeed/article 66 | URL string `json:"url,omitempty"` 67 | 68 | // Width of preview, in pixels. 69 | Width int64 `json:"width,omitempty"` 70 | } 71 | 72 | // Validate validates this card 73 | func (m *Card) Validate(formats strfmt.Registry) error { 74 | return nil 75 | } 76 | 77 | // ContextValidate validates this card based on context it is used 78 | func (m *Card) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 79 | return nil 80 | } 81 | 82 | // MarshalBinary interface implementation 83 | func (m *Card) MarshalBinary() ([]byte, error) { 84 | if m == nil { 85 | return nil, nil 86 | } 87 | return swag.WriteJSON(m) 88 | } 89 | 90 | // UnmarshalBinary interface implementation 91 | func (m *Card) UnmarshalBinary(b []byte) error { 92 | var res Card 93 | if err := swag.ReadJSON(b, &res); err != nil { 94 | return err 95 | } 96 | *m = res 97 | return nil 98 | } 99 | -------------------------------------------------------------------------------- /models/debug_a_p_url_response.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // DebugAPURLResponse DebugAPUrlResponse provides detailed debug 16 | // information for an AP URL dereference request. 17 | // 18 | // swagger:model DebugAPUrlResponse 19 | type DebugAPURLResponse struct { 20 | 21 | // HTTP headers used in the outgoing request. 22 | RequestHeaders map[string][]string `json:"request_headers,omitempty"` 23 | 24 | // Remote AP URL that was requested. 25 | RequestURL string `json:"request_url,omitempty"` 26 | 27 | // Body returned from the remote instance. 28 | // Will be stringified bytes; may be JSON, 29 | // may be an error, may be both! 30 | ResponseBody string `json:"response_body,omitempty"` 31 | 32 | // HTTP response code returned from the remote instance. 33 | ResponseCode int64 `json:"response_code,omitempty"` 34 | 35 | // HTTP headers returned from the remote instance. 36 | ResponseHeaders map[string][]string `json:"response_headers,omitempty"` 37 | } 38 | 39 | // Validate validates this debug a p Url response 40 | func (m *DebugAPURLResponse) Validate(formats strfmt.Registry) error { 41 | return nil 42 | } 43 | 44 | // ContextValidate validates this debug a p Url response based on context it is used 45 | func (m *DebugAPURLResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 46 | return nil 47 | } 48 | 49 | // MarshalBinary interface implementation 50 | func (m *DebugAPURLResponse) MarshalBinary() ([]byte, error) { 51 | if m == nil { 52 | return nil, nil 53 | } 54 | return swag.WriteJSON(m) 55 | } 56 | 57 | // UnmarshalBinary interface implementation 58 | func (m *DebugAPURLResponse) UnmarshalBinary(b []byte) error { 59 | var res DebugAPURLResponse 60 | if err := swag.ReadJSON(b, &res); err != nil { 61 | return err 62 | } 63 | *m = res 64 | return nil 65 | } 66 | -------------------------------------------------------------------------------- /models/domain.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Domain Domain represents a remote domain 16 | // 17 | // swagger:model Domain 18 | type Domain struct { 19 | 20 | // The hostname of the domain. 21 | // Example: example.org 22 | Domain string `json:"domain,omitempty"` 23 | 24 | // If the domain is blocked, what's the publicly-stated reason for the block. 25 | // Example: they smell 26 | PublicComment string `json:"public_comment,omitempty"` 27 | 28 | // Time at which this domain was silenced. Key will not be present on open domains. 29 | // Example: 2021-07-30T09:20:25+00:00 30 | SilencedAt string `json:"silenced_at,omitempty"` 31 | 32 | // Time at which this domain was suspended. Key will not be present on open domains. 33 | // Example: 2021-07-30T09:20:25+00:00 34 | SuspendedAt string `json:"suspended_at,omitempty"` 35 | } 36 | 37 | // Validate validates this domain 38 | func (m *Domain) Validate(formats strfmt.Registry) error { 39 | return nil 40 | } 41 | 42 | // ContextValidate validates this domain based on context it is used 43 | func (m *Domain) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 44 | return nil 45 | } 46 | 47 | // MarshalBinary interface implementation 48 | func (m *Domain) MarshalBinary() ([]byte, error) { 49 | if m == nil { 50 | return nil, nil 51 | } 52 | return swag.WriteJSON(m) 53 | } 54 | 55 | // UnmarshalBinary interface implementation 56 | func (m *Domain) UnmarshalBinary(b []byte) error { 57 | var res Domain 58 | if err := swag.ReadJSON(b, &res); err != nil { 59 | return err 60 | } 61 | *m = res 62 | return nil 63 | } 64 | -------------------------------------------------------------------------------- /models/domain_permission.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/strfmt" 13 | "github.com/go-openapi/swag" 14 | "github.com/go-openapi/validate" 15 | ) 16 | 17 | // DomainPermission DomainPermission represents a permission applied to one domain (explicit block/allow). 18 | // 19 | // swagger:model DomainPermission 20 | type DomainPermission struct { 21 | 22 | // Time at which the permission entry was created (ISO 8601 Datetime). 23 | // Example: 2021-07-30T09:20:25+00:00 24 | CreatedAt string `json:"created_at,omitempty"` 25 | 26 | // ID of the account that created this domain permission entry. 27 | // Example: 01FBW2758ZB6PBR200YPDDJK4C 28 | CreatedBy string `json:"created_by,omitempty"` 29 | 30 | // The hostname of the domain. 31 | // Example: example.org 32 | Domain string `json:"domain,omitempty"` 33 | 34 | // The ID of the domain permission entry. 35 | // Example: 01FBW21XJA09XYX51KV5JVBW0F 36 | // Read Only: true 37 | ID string `json:"id,omitempty"` 38 | 39 | // Obfuscate the domain name when serving this domain permission entry publicly. 40 | // Example: false 41 | Obfuscate bool `json:"obfuscate,omitempty"` 42 | 43 | // Permission type of this entry (block, allow). 44 | // Only set for domain permission drafts. 45 | PermissionType string `json:"permission_type,omitempty"` 46 | 47 | // Private comment for this permission entry, visible to this instance's admins only. 48 | // Example: they are poopoo 49 | PrivateComment string `json:"private_comment,omitempty"` 50 | 51 | // If the domain is blocked, what's the publicly-stated reason for the block. 52 | // Example: they smell 53 | PublicComment string `json:"public_comment,omitempty"` 54 | 55 | // Time at which this domain was silenced. Key will not be present on open domains. 56 | // Example: 2021-07-30T09:20:25+00:00 57 | SilencedAt string `json:"silenced_at,omitempty"` 58 | 59 | // If applicable, the ID of the subscription that caused this domain permission entry to be created. 60 | // Example: 01FBW25TF5J67JW3HFHZCSD23K 61 | SubscriptionID string `json:"subscription_id,omitempty"` 62 | 63 | // Time at which this domain was suspended. Key will not be present on open domains. 64 | // Example: 2021-07-30T09:20:25+00:00 65 | SuspendedAt string `json:"suspended_at,omitempty"` 66 | } 67 | 68 | // Validate validates this domain permission 69 | func (m *DomainPermission) Validate(formats strfmt.Registry) error { 70 | return nil 71 | } 72 | 73 | // ContextValidate validate this domain permission based on the context it is used 74 | func (m *DomainPermission) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 75 | var res []error 76 | 77 | if err := m.contextValidateID(ctx, formats); err != nil { 78 | res = append(res, err) 79 | } 80 | 81 | if len(res) > 0 { 82 | return errors.CompositeValidationError(res...) 83 | } 84 | return nil 85 | } 86 | 87 | func (m *DomainPermission) contextValidateID(ctx context.Context, formats strfmt.Registry) error { 88 | 89 | if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { 90 | return err 91 | } 92 | 93 | return nil 94 | } 95 | 96 | // MarshalBinary interface implementation 97 | func (m *DomainPermission) MarshalBinary() ([]byte, error) { 98 | if m == nil { 99 | return nil, nil 100 | } 101 | return swag.WriteJSON(m) 102 | } 103 | 104 | // UnmarshalBinary interface implementation 105 | func (m *DomainPermission) UnmarshalBinary(b []byte) error { 106 | var res DomainPermission 107 | if err := swag.ReadJSON(b, &res); err != nil { 108 | return err 109 | } 110 | *m = res 111 | return nil 112 | } 113 | -------------------------------------------------------------------------------- /models/emoji.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Emoji Emoji represents a custom emoji. 16 | // 17 | // swagger:model Emoji 18 | type Emoji struct { 19 | 20 | // Used for sorting custom emoji in the picker. 21 | // Example: blobcats 22 | Category string `json:"category,omitempty"` 23 | 24 | // The name of the custom emoji. 25 | // Example: blobcat_uwu 26 | Shortcode string `json:"shortcode,omitempty"` 27 | 28 | // A link to a static copy of the custom emoji. 29 | // Example: https://example.org/fileserver/emojis/blogcat_uwu.png 30 | StaticURL string `json:"static_url,omitempty"` 31 | 32 | // Web URL of the custom emoji. 33 | // Example: https://example.org/fileserver/emojis/blogcat_uwu.gif 34 | URL string `json:"url,omitempty"` 35 | 36 | // Emoji is visible in the emoji picker of the instance. 37 | // Example: true 38 | VisibleInPicker bool `json:"visible_in_picker,omitempty"` 39 | } 40 | 41 | // Validate validates this emoji 42 | func (m *Emoji) Validate(formats strfmt.Registry) error { 43 | return nil 44 | } 45 | 46 | // ContextValidate validates this emoji based on context it is used 47 | func (m *Emoji) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 48 | return nil 49 | } 50 | 51 | // MarshalBinary interface implementation 52 | func (m *Emoji) MarshalBinary() ([]byte, error) { 53 | if m == nil { 54 | return nil, nil 55 | } 56 | return swag.WriteJSON(m) 57 | } 58 | 59 | // UnmarshalBinary interface implementation 60 | func (m *Emoji) UnmarshalBinary(b []byte) error { 61 | var res Emoji 62 | if err := swag.ReadJSON(b, &res); err != nil { 63 | return err 64 | } 65 | *m = res 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /models/emoji_category.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // EmojiCategory EmojiCategory represents a custom emoji category. 16 | // 17 | // swagger:model EmojiCategory 18 | type EmojiCategory struct { 19 | 20 | // The ID of the custom emoji category. 21 | ID string `json:"id,omitempty"` 22 | 23 | // The name of the custom emoji category. 24 | Name string `json:"name,omitempty"` 25 | } 26 | 27 | // Validate validates this emoji category 28 | func (m *EmojiCategory) Validate(formats strfmt.Registry) error { 29 | return nil 30 | } 31 | 32 | // ContextValidate validates this emoji category based on context it is used 33 | func (m *EmojiCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // MarshalBinary interface implementation 38 | func (m *EmojiCategory) MarshalBinary() ([]byte, error) { 39 | if m == nil { 40 | return nil, nil 41 | } 42 | return swag.WriteJSON(m) 43 | } 44 | 45 | // UnmarshalBinary interface implementation 46 | func (m *EmojiCategory) UnmarshalBinary(b []byte) error { 47 | var res EmojiCategory 48 | if err := swag.ReadJSON(b, &res); err != nil { 49 | return err 50 | } 51 | *m = res 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /models/field.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Field Field represents a name/value pair to display on an account's profile. 16 | // 17 | // swagger:model Field 18 | type Field struct { 19 | 20 | // The key/name of this field. 21 | // Example: pronouns 22 | Name string `json:"name,omitempty"` 23 | 24 | // The value of this field. 25 | // Example: they/them 26 | Value string `json:"value,omitempty"` 27 | 28 | // If this field has been verified, when did this occur? (ISO 8601 Datetime). 29 | // Example: 2021-07-30T09:20:25+00:00 30 | VerifiedAt string `json:"verified_at,omitempty"` 31 | } 32 | 33 | // Validate validates this field 34 | func (m *Field) Validate(formats strfmt.Registry) error { 35 | return nil 36 | } 37 | 38 | // ContextValidate validates this field based on context it is used 39 | func (m *Field) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 40 | return nil 41 | } 42 | 43 | // MarshalBinary interface implementation 44 | func (m *Field) MarshalBinary() ([]byte, error) { 45 | if m == nil { 46 | return nil, nil 47 | } 48 | return swag.WriteJSON(m) 49 | } 50 | 51 | // UnmarshalBinary interface implementation 52 | func (m *Field) UnmarshalBinary(b []byte) error { 53 | var res Field 54 | if err := swag.ReadJSON(b, &res); err != nil { 55 | return err 56 | } 57 | *m = res 58 | return nil 59 | } 60 | -------------------------------------------------------------------------------- /models/filter_action.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // FilterAction FilterAction is the action to apply to statuses matching a filter. 15 | // 16 | // swagger:model FilterAction 17 | type FilterAction string 18 | 19 | // Validate validates this filter action 20 | func (m FilterAction) Validate(formats strfmt.Registry) error { 21 | return nil 22 | } 23 | 24 | // ContextValidate validates this filter action based on context it is used 25 | func (m FilterAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /models/filter_context.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // FilterContext FilterContext represents the context in which to apply a filter. 15 | // 16 | // v1 and v2 filter APIs use the same set of contexts. 17 | // 18 | // swagger:model FilterContext 19 | type FilterContext string 20 | 21 | // Validate validates this filter context 22 | func (m FilterContext) Validate(formats strfmt.Registry) error { 23 | return nil 24 | } 25 | 26 | // ContextValidate validates this filter context based on context it is used 27 | func (m FilterContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 28 | return nil 29 | } 30 | -------------------------------------------------------------------------------- /models/filter_keyword.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // FilterKeyword FilterKeyword represents text to filter within a v2 filter. 16 | // 17 | // swagger:model FilterKeyword 18 | type FilterKeyword struct { 19 | 20 | // The ID of the filter keyword entry in the database. 21 | ID string `json:"id,omitempty"` 22 | 23 | // The text to be filtered. 24 | // Example: fnord 25 | Keyword string `json:"keyword,omitempty"` 26 | 27 | // Should the filter keyword consider word boundaries? 28 | // Example: true 29 | WholeWord bool `json:"whole_word,omitempty"` 30 | } 31 | 32 | // Validate validates this filter keyword 33 | func (m *FilterKeyword) Validate(formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // ContextValidate validates this filter keyword based on context it is used 38 | func (m *FilterKeyword) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 39 | return nil 40 | } 41 | 42 | // MarshalBinary interface implementation 43 | func (m *FilterKeyword) MarshalBinary() ([]byte, error) { 44 | if m == nil { 45 | return nil, nil 46 | } 47 | return swag.WriteJSON(m) 48 | } 49 | 50 | // UnmarshalBinary interface implementation 51 | func (m *FilterKeyword) UnmarshalBinary(b []byte) error { 52 | var res FilterKeyword 53 | if err := swag.ReadJSON(b, &res); err != nil { 54 | return err 55 | } 56 | *m = res 57 | return nil 58 | } 59 | -------------------------------------------------------------------------------- /models/filter_result.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/strfmt" 13 | "github.com/go-openapi/swag" 14 | ) 15 | 16 | // FilterResult FilterResult is returned along with a filtered status to explain why it was filtered. 17 | // 18 | // swagger:model FilterResult 19 | type FilterResult struct { 20 | 21 | // The keywords within the filter that were matched. 22 | KeywordMatches []string `json:"keyword_matches"` 23 | 24 | // The status IDs within the filter that were matched. 25 | StatusMatches []string `json:"status_matches"` 26 | 27 | // filter 28 | Filter *FilterV2 `json:"filter,omitempty"` 29 | } 30 | 31 | // Validate validates this filter result 32 | func (m *FilterResult) Validate(formats strfmt.Registry) error { 33 | var res []error 34 | 35 | if err := m.validateFilter(formats); err != nil { 36 | res = append(res, err) 37 | } 38 | 39 | if len(res) > 0 { 40 | return errors.CompositeValidationError(res...) 41 | } 42 | return nil 43 | } 44 | 45 | func (m *FilterResult) validateFilter(formats strfmt.Registry) error { 46 | if swag.IsZero(m.Filter) { // not required 47 | return nil 48 | } 49 | 50 | if m.Filter != nil { 51 | if err := m.Filter.Validate(formats); err != nil { 52 | if ve, ok := err.(*errors.Validation); ok { 53 | return ve.ValidateName("filter") 54 | } else if ce, ok := err.(*errors.CompositeError); ok { 55 | return ce.ValidateName("filter") 56 | } 57 | return err 58 | } 59 | } 60 | 61 | return nil 62 | } 63 | 64 | // ContextValidate validate this filter result based on the context it is used 65 | func (m *FilterResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 66 | var res []error 67 | 68 | if err := m.contextValidateFilter(ctx, formats); err != nil { 69 | res = append(res, err) 70 | } 71 | 72 | if len(res) > 0 { 73 | return errors.CompositeValidationError(res...) 74 | } 75 | return nil 76 | } 77 | 78 | func (m *FilterResult) contextValidateFilter(ctx context.Context, formats strfmt.Registry) error { 79 | 80 | if m.Filter != nil { 81 | 82 | if swag.IsZero(m.Filter) { // not required 83 | return nil 84 | } 85 | 86 | if err := m.Filter.ContextValidate(ctx, formats); err != nil { 87 | if ve, ok := err.(*errors.Validation); ok { 88 | return ve.ValidateName("filter") 89 | } else if ce, ok := err.(*errors.CompositeError); ok { 90 | return ce.ValidateName("filter") 91 | } 92 | return err 93 | } 94 | } 95 | 96 | return nil 97 | } 98 | 99 | // MarshalBinary interface implementation 100 | func (m *FilterResult) MarshalBinary() ([]byte, error) { 101 | if m == nil { 102 | return nil, nil 103 | } 104 | return swag.WriteJSON(m) 105 | } 106 | 107 | // UnmarshalBinary interface implementation 108 | func (m *FilterResult) UnmarshalBinary(b []byte) error { 109 | var res FilterResult 110 | if err := swag.ReadJSON(b, &res); err != nil { 111 | return err 112 | } 113 | *m = res 114 | return nil 115 | } 116 | -------------------------------------------------------------------------------- /models/filter_status.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // FilterStatus FilterStatus represents a single status to filter within a v2 filter. 16 | // 17 | // swagger:model FilterStatus 18 | type FilterStatus struct { 19 | 20 | // The ID of the filter status entry in the database. 21 | ID string `json:"id,omitempty"` 22 | 23 | // The status ID to be filtered. 24 | StatusID string `json:"phrase,omitempty"` 25 | } 26 | 27 | // Validate validates this filter status 28 | func (m *FilterStatus) Validate(formats strfmt.Registry) error { 29 | return nil 30 | } 31 | 32 | // ContextValidate validates this filter status based on context it is used 33 | func (m *FilterStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // MarshalBinary interface implementation 38 | func (m *FilterStatus) MarshalBinary() ([]byte, error) { 39 | if m == nil { 40 | return nil, nil 41 | } 42 | return swag.WriteJSON(m) 43 | } 44 | 45 | // UnmarshalBinary interface implementation 46 | func (m *FilterStatus) UnmarshalBinary(b []byte) error { 47 | var res FilterStatus 48 | if err := swag.ReadJSON(b, &res); err != nil { 49 | return err 50 | } 51 | *m = res 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /models/header_filter.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/strfmt" 13 | "github.com/go-openapi/swag" 14 | "github.com/go-openapi/validate" 15 | ) 16 | 17 | // HeaderFilter HeaderFilter represents a regex value filter applied to one particular HTTP header (allow / block). 18 | // 19 | // swagger:model HeaderFilter 20 | type HeaderFilter struct { 21 | 22 | // Time at which the header filter was created (ISO 8601 Datetime). 23 | // Example: 2021-07-30T09:20:25+00:00 24 | // Read Only: true 25 | CreatedAt string `json:"created_at,omitempty"` 26 | 27 | // The ID of the admin account that created this header filter. 28 | // Example: 01FBW2758ZB6PBR200YPDDJK4C 29 | // Read Only: true 30 | CreatedBy string `json:"created_by,omitempty"` 31 | 32 | // The HTTP header to match against. 33 | // Example: User-Agent 34 | Header string `json:"header,omitempty"` 35 | 36 | // The ID of the header filter. 37 | // Example: 01FBW21XJA09XYX51KV5JVBW0F 38 | // Read Only: true 39 | ID string `json:"id,omitempty"` 40 | 41 | // The header value matching regular expression. 42 | // Example: .*Firefox.* 43 | Regex string `json:"regex,omitempty"` 44 | } 45 | 46 | // Validate validates this header filter 47 | func (m *HeaderFilter) Validate(formats strfmt.Registry) error { 48 | return nil 49 | } 50 | 51 | // ContextValidate validate this header filter based on the context it is used 52 | func (m *HeaderFilter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 53 | var res []error 54 | 55 | if err := m.contextValidateCreatedAt(ctx, formats); err != nil { 56 | res = append(res, err) 57 | } 58 | 59 | if err := m.contextValidateCreatedBy(ctx, formats); err != nil { 60 | res = append(res, err) 61 | } 62 | 63 | if err := m.contextValidateID(ctx, formats); err != nil { 64 | res = append(res, err) 65 | } 66 | 67 | if len(res) > 0 { 68 | return errors.CompositeValidationError(res...) 69 | } 70 | return nil 71 | } 72 | 73 | func (m *HeaderFilter) contextValidateCreatedAt(ctx context.Context, formats strfmt.Registry) error { 74 | 75 | if err := validate.ReadOnly(ctx, "created_at", "body", string(m.CreatedAt)); err != nil { 76 | return err 77 | } 78 | 79 | return nil 80 | } 81 | 82 | func (m *HeaderFilter) contextValidateCreatedBy(ctx context.Context, formats strfmt.Registry) error { 83 | 84 | if err := validate.ReadOnly(ctx, "created_by", "body", string(m.CreatedBy)); err != nil { 85 | return err 86 | } 87 | 88 | return nil 89 | } 90 | 91 | func (m *HeaderFilter) contextValidateID(ctx context.Context, formats strfmt.Registry) error { 92 | 93 | if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { 94 | return err 95 | } 96 | 97 | return nil 98 | } 99 | 100 | // MarshalBinary interface implementation 101 | func (m *HeaderFilter) MarshalBinary() ([]byte, error) { 102 | if m == nil { 103 | return nil, nil 104 | } 105 | return swag.WriteJSON(m) 106 | } 107 | 108 | // UnmarshalBinary interface implementation 109 | func (m *HeaderFilter) UnmarshalBinary(b []byte) error { 110 | var res HeaderFilter 111 | if err := swag.ReadJSON(b, &res); err != nil { 112 | return err 113 | } 114 | *m = res 115 | return nil 116 | } 117 | -------------------------------------------------------------------------------- /models/host_meta.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "strconv" 11 | 12 | "github.com/go-openapi/errors" 13 | "github.com/go-openapi/strfmt" 14 | "github.com/go-openapi/swag" 15 | ) 16 | 17 | // HostMeta HostMeta represents a hostmeta document. 18 | // 19 | // See: https://www.rfc-editor.org/rfc/rfc6415.html#section-3 20 | // 21 | // swagger:model HostMeta 22 | type HostMeta struct { 23 | 24 | // link 25 | Link []*Link `json:"Link"` 26 | 27 | // XML n s 28 | XMLNS string `json:"XMLNS,omitempty"` 29 | 30 | // XML name 31 | XMLName interface{} `json:"XMLName,omitempty"` 32 | } 33 | 34 | // Validate validates this host meta 35 | func (m *HostMeta) Validate(formats strfmt.Registry) error { 36 | var res []error 37 | 38 | if err := m.validateLink(formats); err != nil { 39 | res = append(res, err) 40 | } 41 | 42 | if len(res) > 0 { 43 | return errors.CompositeValidationError(res...) 44 | } 45 | return nil 46 | } 47 | 48 | func (m *HostMeta) validateLink(formats strfmt.Registry) error { 49 | if swag.IsZero(m.Link) { // not required 50 | return nil 51 | } 52 | 53 | for i := 0; i < len(m.Link); i++ { 54 | if swag.IsZero(m.Link[i]) { // not required 55 | continue 56 | } 57 | 58 | if m.Link[i] != nil { 59 | if err := m.Link[i].Validate(formats); err != nil { 60 | if ve, ok := err.(*errors.Validation); ok { 61 | return ve.ValidateName("Link" + "." + strconv.Itoa(i)) 62 | } else if ce, ok := err.(*errors.CompositeError); ok { 63 | return ce.ValidateName("Link" + "." + strconv.Itoa(i)) 64 | } 65 | return err 66 | } 67 | } 68 | 69 | } 70 | 71 | return nil 72 | } 73 | 74 | // ContextValidate validate this host meta based on the context it is used 75 | func (m *HostMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 76 | var res []error 77 | 78 | if err := m.contextValidateLink(ctx, formats); err != nil { 79 | res = append(res, err) 80 | } 81 | 82 | if len(res) > 0 { 83 | return errors.CompositeValidationError(res...) 84 | } 85 | return nil 86 | } 87 | 88 | func (m *HostMeta) contextValidateLink(ctx context.Context, formats strfmt.Registry) error { 89 | 90 | for i := 0; i < len(m.Link); i++ { 91 | 92 | if m.Link[i] != nil { 93 | 94 | if swag.IsZero(m.Link[i]) { // not required 95 | return nil 96 | } 97 | 98 | if err := m.Link[i].ContextValidate(ctx, formats); err != nil { 99 | if ve, ok := err.(*errors.Validation); ok { 100 | return ve.ValidateName("Link" + "." + strconv.Itoa(i)) 101 | } else if ce, ok := err.(*errors.CompositeError); ok { 102 | return ce.ValidateName("Link" + "." + strconv.Itoa(i)) 103 | } 104 | return err 105 | } 106 | } 107 | 108 | } 109 | 110 | return nil 111 | } 112 | 113 | // MarshalBinary interface implementation 114 | func (m *HostMeta) MarshalBinary() ([]byte, error) { 115 | if m == nil { 116 | return nil, nil 117 | } 118 | return swag.WriteJSON(m) 119 | } 120 | 121 | // UnmarshalBinary interface implementation 122 | func (m *HostMeta) UnmarshalBinary(b []byte) error { 123 | var res HostMeta 124 | if err := swag.ReadJSON(b, &res); err != nil { 125 | return err 126 | } 127 | *m = res 128 | return nil 129 | } 130 | -------------------------------------------------------------------------------- /models/instance_configuration_accounts.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceConfigurationAccounts InstanceConfigurationAccounts models instance account config parameters. 16 | // 17 | // swagger:model InstanceConfigurationAccounts 18 | type InstanceConfigurationAccounts struct { 19 | 20 | // Whether or not accounts on this instance are allowed to upload custom CSS for profiles and statuses. 21 | // Example: false 22 | AllowCustomCSS bool `json:"allow_custom_css,omitempty"` 23 | 24 | // The maximum number of featured tags allowed for each account. 25 | // Currently not implemented, so this is hardcoded to 10. 26 | MaxFeaturedTags int64 `json:"max_featured_tags,omitempty"` 27 | 28 | // The maximum number of profile fields allowed for each account. 29 | // Currently not configurable, so this is hardcoded to 6. (https://github.com/superseriousbusiness/gotosocial/issues/1876) 30 | MaxProfileFields int64 `json:"max_profile_fields,omitempty"` 31 | } 32 | 33 | // Validate validates this instance configuration accounts 34 | func (m *InstanceConfigurationAccounts) Validate(formats strfmt.Registry) error { 35 | return nil 36 | } 37 | 38 | // ContextValidate validates this instance configuration accounts based on context it is used 39 | func (m *InstanceConfigurationAccounts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 40 | return nil 41 | } 42 | 43 | // MarshalBinary interface implementation 44 | func (m *InstanceConfigurationAccounts) MarshalBinary() ([]byte, error) { 45 | if m == nil { 46 | return nil, nil 47 | } 48 | return swag.WriteJSON(m) 49 | } 50 | 51 | // UnmarshalBinary interface implementation 52 | func (m *InstanceConfigurationAccounts) UnmarshalBinary(b []byte) error { 53 | var res InstanceConfigurationAccounts 54 | if err := swag.ReadJSON(b, &res); err != nil { 55 | return err 56 | } 57 | *m = res 58 | return nil 59 | } 60 | -------------------------------------------------------------------------------- /models/instance_configuration_emojis.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceConfigurationEmojis InstanceConfigurationEmojis models instance emoji config parameters. 16 | // 17 | // swagger:model InstanceConfigurationEmojis 18 | type InstanceConfigurationEmojis struct { 19 | 20 | // Max allowed emoji image size in bytes. 21 | // Example: 51200 22 | EmojiSizeLimit int64 `json:"emoji_size_limit,omitempty"` 23 | } 24 | 25 | // Validate validates this instance configuration emojis 26 | func (m *InstanceConfigurationEmojis) Validate(formats strfmt.Registry) error { 27 | return nil 28 | } 29 | 30 | // ContextValidate validates this instance configuration emojis based on context it is used 31 | func (m *InstanceConfigurationEmojis) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 32 | return nil 33 | } 34 | 35 | // MarshalBinary interface implementation 36 | func (m *InstanceConfigurationEmojis) MarshalBinary() ([]byte, error) { 37 | if m == nil { 38 | return nil, nil 39 | } 40 | return swag.WriteJSON(m) 41 | } 42 | 43 | // UnmarshalBinary interface implementation 44 | func (m *InstanceConfigurationEmojis) UnmarshalBinary(b []byte) error { 45 | var res InstanceConfigurationEmojis 46 | if err := swag.ReadJSON(b, &res); err != nil { 47 | return err 48 | } 49 | *m = res 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /models/instance_configuration_media_attachments.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceConfigurationMediaAttachments InstanceConfigurationMediaAttachments models instance media attachment config parameters. 16 | // 17 | // swagger:model InstanceConfigurationMediaAttachments 18 | type InstanceConfigurationMediaAttachments struct { 19 | 20 | // Max allowed image size in pixels as height*width. 21 | // 22 | // GtS doesn't set a limit on this, but for compatibility 23 | // we give Mastodon's 4096x4096px value here. 24 | // Example: 16777216 25 | ImageMatrixLimit int64 `json:"image_matrix_limit,omitempty"` 26 | 27 | // Max allowed image size in bytes 28 | // Example: 2097152 29 | ImageSizeLimit int64 `json:"image_size_limit,omitempty"` 30 | 31 | // List of mime types that it's possible to upload to this instance. 32 | // Example: ["image/jpeg","image/gif"] 33 | SupportedMimeTypes []string `json:"supported_mime_types"` 34 | 35 | // Max allowed video frame rate. 36 | // Example: 60 37 | VideoFrameRateLimit int64 `json:"video_frame_rate_limit,omitempty"` 38 | 39 | // Max allowed video size in pixels as height*width. 40 | // 41 | // GtS doesn't set a limit on this, but for compatibility 42 | // we give Mastodon's 4096x4096px value here. 43 | // Example: 16777216 44 | VideoMatrixLimit int64 `json:"video_matrix_limit,omitempty"` 45 | 46 | // Max allowed video size in bytes 47 | // Example: 10485760 48 | VideoSizeLimit int64 `json:"video_size_limit,omitempty"` 49 | } 50 | 51 | // Validate validates this instance configuration media attachments 52 | func (m *InstanceConfigurationMediaAttachments) Validate(formats strfmt.Registry) error { 53 | return nil 54 | } 55 | 56 | // ContextValidate validates this instance configuration media attachments based on context it is used 57 | func (m *InstanceConfigurationMediaAttachments) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 58 | return nil 59 | } 60 | 61 | // MarshalBinary interface implementation 62 | func (m *InstanceConfigurationMediaAttachments) MarshalBinary() ([]byte, error) { 63 | if m == nil { 64 | return nil, nil 65 | } 66 | return swag.WriteJSON(m) 67 | } 68 | 69 | // UnmarshalBinary interface implementation 70 | func (m *InstanceConfigurationMediaAttachments) UnmarshalBinary(b []byte) error { 71 | var res InstanceConfigurationMediaAttachments 72 | if err := swag.ReadJSON(b, &res); err != nil { 73 | return err 74 | } 75 | *m = res 76 | return nil 77 | } 78 | -------------------------------------------------------------------------------- /models/instance_configuration_polls.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceConfigurationPolls InstanceConfigurationPolls models instance poll config parameters. 16 | // 17 | // swagger:model InstanceConfigurationPolls 18 | type InstanceConfigurationPolls struct { 19 | 20 | // Number of characters allowed per option in the poll. 21 | // Example: 50 22 | MaxCharactersPerOption int64 `json:"max_characters_per_option,omitempty"` 23 | 24 | // Maximum expiration time of the poll in seconds. 25 | // Example: 2629746 26 | MaxExpiration int64 `json:"max_expiration,omitempty"` 27 | 28 | // Number of options permitted in a poll on this instance. 29 | // Example: 4 30 | MaxOptions int64 `json:"max_options,omitempty"` 31 | 32 | // Minimum expiration time of the poll in seconds. 33 | // Example: 300 34 | MinExpiration int64 `json:"min_expiration,omitempty"` 35 | } 36 | 37 | // Validate validates this instance configuration polls 38 | func (m *InstanceConfigurationPolls) Validate(formats strfmt.Registry) error { 39 | return nil 40 | } 41 | 42 | // ContextValidate validates this instance configuration polls based on context it is used 43 | func (m *InstanceConfigurationPolls) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 44 | return nil 45 | } 46 | 47 | // MarshalBinary interface implementation 48 | func (m *InstanceConfigurationPolls) MarshalBinary() ([]byte, error) { 49 | if m == nil { 50 | return nil, nil 51 | } 52 | return swag.WriteJSON(m) 53 | } 54 | 55 | // UnmarshalBinary interface implementation 56 | func (m *InstanceConfigurationPolls) UnmarshalBinary(b []byte) error { 57 | var res InstanceConfigurationPolls 58 | if err := swag.ReadJSON(b, &res); err != nil { 59 | return err 60 | } 61 | *m = res 62 | return nil 63 | } 64 | -------------------------------------------------------------------------------- /models/instance_configuration_statuses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceConfigurationStatuses InstanceConfigurationStatuses models instance status config parameters. 16 | // 17 | // swagger:model InstanceConfigurationStatuses 18 | type InstanceConfigurationStatuses struct { 19 | 20 | // Amount of characters clients should assume a url takes up. 21 | // Example: 25 22 | CharactersReservedPerURL int64 `json:"characters_reserved_per_url,omitempty"` 23 | 24 | // Maximum allowed length of a post on this instance, in characters. 25 | // Example: 5000 26 | MaxCharacters int64 `json:"max_characters,omitempty"` 27 | 28 | // Max number of attachments allowed on a status. 29 | // Example: 4 30 | MaxMediaAttachments int64 `json:"max_media_attachments,omitempty"` 31 | 32 | // List of mime types that it's possible to use for statuses on this instance. 33 | // Example: ["text/plain","text/markdown"] 34 | SupportedMimeTypes []string `json:"supported_mime_types"` 35 | } 36 | 37 | // Validate validates this instance configuration statuses 38 | func (m *InstanceConfigurationStatuses) Validate(formats strfmt.Registry) error { 39 | return nil 40 | } 41 | 42 | // ContextValidate validates this instance configuration statuses based on context it is used 43 | func (m *InstanceConfigurationStatuses) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 44 | return nil 45 | } 46 | 47 | // MarshalBinary interface implementation 48 | func (m *InstanceConfigurationStatuses) MarshalBinary() ([]byte, error) { 49 | if m == nil { 50 | return nil, nil 51 | } 52 | return swag.WriteJSON(m) 53 | } 54 | 55 | // UnmarshalBinary interface implementation 56 | func (m *InstanceConfigurationStatuses) UnmarshalBinary(b []byte) error { 57 | var res InstanceConfigurationStatuses 58 | if err := swag.ReadJSON(b, &res); err != nil { 59 | return err 60 | } 61 | *m = res 62 | return nil 63 | } 64 | -------------------------------------------------------------------------------- /models/instance_rule.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceRule InstanceRule represents a single instance rule. 16 | // 17 | // swagger:model InstanceRule 18 | type InstanceRule struct { 19 | 20 | // ID 21 | ID string `json:"id,omitempty"` 22 | 23 | // text 24 | Text string `json:"text,omitempty"` 25 | } 26 | 27 | // Validate validates this instance rule 28 | func (m *InstanceRule) Validate(formats strfmt.Registry) error { 29 | return nil 30 | } 31 | 32 | // ContextValidate validates this instance rule based on context it is used 33 | func (m *InstanceRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // MarshalBinary interface implementation 38 | func (m *InstanceRule) MarshalBinary() ([]byte, error) { 39 | if m == nil { 40 | return nil, nil 41 | } 42 | return swag.WriteJSON(m) 43 | } 44 | 45 | // UnmarshalBinary interface implementation 46 | func (m *InstanceRule) UnmarshalBinary(b []byte) error { 47 | var res InstanceRule 48 | if err := swag.ReadJSON(b, &res); err != nil { 49 | return err 50 | } 51 | *m = res 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /models/instance_v1_u_r_ls.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV1URLs InstanceV1URLs models instance-relevant URLs for client application consumption. 16 | // 17 | // swagger:model InstanceV1URLs 18 | type InstanceV1URLs struct { 19 | 20 | // Websockets address for status and notification streaming. 21 | // Example: wss://example.org 22 | StreamingAPI string `json:"streaming_api,omitempty"` 23 | } 24 | 25 | // Validate validates this instance v1 u r ls 26 | func (m *InstanceV1URLs) Validate(formats strfmt.Registry) error { 27 | return nil 28 | } 29 | 30 | // ContextValidate validates this instance v1 u r ls based on context it is used 31 | func (m *InstanceV1URLs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 32 | return nil 33 | } 34 | 35 | // MarshalBinary interface implementation 36 | func (m *InstanceV1URLs) MarshalBinary() ([]byte, error) { 37 | if m == nil { 38 | return nil, nil 39 | } 40 | return swag.WriteJSON(m) 41 | } 42 | 43 | // UnmarshalBinary interface implementation 44 | func (m *InstanceV1URLs) UnmarshalBinary(b []byte) error { 45 | var res InstanceV1URLs 46 | if err := swag.ReadJSON(b, &res); err != nil { 47 | return err 48 | } 49 | *m = res 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /models/instance_v2_configuration_translation.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV2ConfigurationTranslation Hints related to translation. 16 | // 17 | // swagger:model InstanceV2ConfigurationTranslation 18 | type InstanceV2ConfigurationTranslation struct { 19 | 20 | // Whether the Translations API is available on this instance. 21 | // Not implemented so this value is always false. 22 | Enabled bool `json:"enabled,omitempty"` 23 | } 24 | 25 | // Validate validates this instance v2 configuration translation 26 | func (m *InstanceV2ConfigurationTranslation) Validate(formats strfmt.Registry) error { 27 | return nil 28 | } 29 | 30 | // ContextValidate validates this instance v2 configuration translation based on context it is used 31 | func (m *InstanceV2ConfigurationTranslation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 32 | return nil 33 | } 34 | 35 | // MarshalBinary interface implementation 36 | func (m *InstanceV2ConfigurationTranslation) MarshalBinary() ([]byte, error) { 37 | if m == nil { 38 | return nil, nil 39 | } 40 | return swag.WriteJSON(m) 41 | } 42 | 43 | // UnmarshalBinary interface implementation 44 | func (m *InstanceV2ConfigurationTranslation) UnmarshalBinary(b []byte) error { 45 | var res InstanceV2ConfigurationTranslation 46 | if err := swag.ReadJSON(b, &res); err != nil { 47 | return err 48 | } 49 | *m = res 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /models/instance_v2_configuration_v_api_d.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV2ConfigurationVAPID InstanceV2ConfigurationVAPID holds the instance's VAPID configuration. 16 | // 17 | // swagger:model InstanceV2ConfigurationVAPID 18 | type InstanceV2ConfigurationVAPID struct { 19 | 20 | // The instance's VAPID public key, Base64-encoded. 21 | PublicKey string `json:"public_key,omitempty"` 22 | } 23 | 24 | // Validate validates this instance v2 configuration v API d 25 | func (m *InstanceV2ConfigurationVAPID) Validate(formats strfmt.Registry) error { 26 | return nil 27 | } 28 | 29 | // ContextValidate validates this instance v2 configuration v API d based on context it is used 30 | func (m *InstanceV2ConfigurationVAPID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 31 | return nil 32 | } 33 | 34 | // MarshalBinary interface implementation 35 | func (m *InstanceV2ConfigurationVAPID) MarshalBinary() ([]byte, error) { 36 | if m == nil { 37 | return nil, nil 38 | } 39 | return swag.WriteJSON(m) 40 | } 41 | 42 | // UnmarshalBinary interface implementation 43 | func (m *InstanceV2ConfigurationVAPID) UnmarshalBinary(b []byte) error { 44 | var res InstanceV2ConfigurationVAPID 45 | if err := swag.ReadJSON(b, &res); err != nil { 46 | return err 47 | } 48 | *m = res 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /models/instance_v2_contact.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/strfmt" 13 | "github.com/go-openapi/swag" 14 | ) 15 | 16 | // InstanceV2Contact Hints related to contacting a representative of the instance. 17 | // 18 | // swagger:model InstanceV2Contact 19 | type InstanceV2Contact struct { 20 | 21 | // An email address that can be messaged regarding inquiries or issues. 22 | // Empty string if no email address set. 23 | // Example: someone@example.org 24 | Email string `json:"email,omitempty"` 25 | 26 | // account 27 | Account *Account `json:"account,omitempty"` 28 | } 29 | 30 | // Validate validates this instance v2 contact 31 | func (m *InstanceV2Contact) Validate(formats strfmt.Registry) error { 32 | var res []error 33 | 34 | if err := m.validateAccount(formats); err != nil { 35 | res = append(res, err) 36 | } 37 | 38 | if len(res) > 0 { 39 | return errors.CompositeValidationError(res...) 40 | } 41 | return nil 42 | } 43 | 44 | func (m *InstanceV2Contact) validateAccount(formats strfmt.Registry) error { 45 | if swag.IsZero(m.Account) { // not required 46 | return nil 47 | } 48 | 49 | if m.Account != nil { 50 | if err := m.Account.Validate(formats); err != nil { 51 | if ve, ok := err.(*errors.Validation); ok { 52 | return ve.ValidateName("account") 53 | } else if ce, ok := err.(*errors.CompositeError); ok { 54 | return ce.ValidateName("account") 55 | } 56 | return err 57 | } 58 | } 59 | 60 | return nil 61 | } 62 | 63 | // ContextValidate validate this instance v2 contact based on the context it is used 64 | func (m *InstanceV2Contact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 65 | var res []error 66 | 67 | if err := m.contextValidateAccount(ctx, formats); err != nil { 68 | res = append(res, err) 69 | } 70 | 71 | if len(res) > 0 { 72 | return errors.CompositeValidationError(res...) 73 | } 74 | return nil 75 | } 76 | 77 | func (m *InstanceV2Contact) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { 78 | 79 | if m.Account != nil { 80 | 81 | if swag.IsZero(m.Account) { // not required 82 | return nil 83 | } 84 | 85 | if err := m.Account.ContextValidate(ctx, formats); err != nil { 86 | if ve, ok := err.(*errors.Validation); ok { 87 | return ve.ValidateName("account") 88 | } else if ce, ok := err.(*errors.CompositeError); ok { 89 | return ce.ValidateName("account") 90 | } 91 | return err 92 | } 93 | } 94 | 95 | return nil 96 | } 97 | 98 | // MarshalBinary interface implementation 99 | func (m *InstanceV2Contact) MarshalBinary() ([]byte, error) { 100 | if m == nil { 101 | return nil, nil 102 | } 103 | return swag.WriteJSON(m) 104 | } 105 | 106 | // UnmarshalBinary interface implementation 107 | func (m *InstanceV2Contact) UnmarshalBinary(b []byte) error { 108 | var res InstanceV2Contact 109 | if err := swag.ReadJSON(b, &res); err != nil { 110 | return err 111 | } 112 | *m = res 113 | return nil 114 | } 115 | -------------------------------------------------------------------------------- /models/instance_v2_registrations.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV2Registrations Information about registering for this instance. 16 | // 17 | // swagger:model InstanceV2Registrations 18 | type InstanceV2Registrations struct { 19 | 20 | // Whether registrations require moderator approval. 21 | // Example: true 22 | ApprovalRequired bool `json:"approval_required,omitempty"` 23 | 24 | // Whether registrations are enabled. 25 | // Example: false 26 | Enabled bool `json:"enabled,omitempty"` 27 | 28 | // A custom message (html string) to be shown when registrations are closed. 29 | // Value will be null if no message is set. 30 | // Example: \u003cp\u003eRegistrations are currently closed on example.org because of spam bots!\u003c/p\u003e 31 | Message string `json:"message,omitempty"` 32 | } 33 | 34 | // Validate validates this instance v2 registrations 35 | func (m *InstanceV2Registrations) Validate(formats strfmt.Registry) error { 36 | return nil 37 | } 38 | 39 | // ContextValidate validates this instance v2 registrations based on context it is used 40 | func (m *InstanceV2Registrations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 41 | return nil 42 | } 43 | 44 | // MarshalBinary interface implementation 45 | func (m *InstanceV2Registrations) MarshalBinary() ([]byte, error) { 46 | if m == nil { 47 | return nil, nil 48 | } 49 | return swag.WriteJSON(m) 50 | } 51 | 52 | // UnmarshalBinary interface implementation 53 | func (m *InstanceV2Registrations) UnmarshalBinary(b []byte) error { 54 | var res InstanceV2Registrations 55 | if err := swag.ReadJSON(b, &res); err != nil { 56 | return err 57 | } 58 | *m = res 59 | return nil 60 | } 61 | -------------------------------------------------------------------------------- /models/instance_v2_thumbnail_versions.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV2ThumbnailVersions Links to scaled resolution images, for high DPI screens. 16 | // 17 | // swagger:model InstanceV2ThumbnailVersions 18 | type InstanceV2ThumbnailVersions struct { 19 | 20 | // The URL for the thumbnail image at 1x resolution. 21 | // Key/value not set if scaled versions not available. 22 | Size1URL string `json:"@1x,omitempty"` 23 | 24 | // The URL for the thumbnail image at 2x resolution. 25 | // Key/value not set if scaled versions not available. 26 | Size2URL string `json:"@2x,omitempty"` 27 | } 28 | 29 | // Validate validates this instance v2 thumbnail versions 30 | func (m *InstanceV2ThumbnailVersions) Validate(formats strfmt.Registry) error { 31 | return nil 32 | } 33 | 34 | // ContextValidate validates this instance v2 thumbnail versions based on context it is used 35 | func (m *InstanceV2ThumbnailVersions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 36 | return nil 37 | } 38 | 39 | // MarshalBinary interface implementation 40 | func (m *InstanceV2ThumbnailVersions) MarshalBinary() ([]byte, error) { 41 | if m == nil { 42 | return nil, nil 43 | } 44 | return swag.WriteJSON(m) 45 | } 46 | 47 | // UnmarshalBinary interface implementation 48 | func (m *InstanceV2ThumbnailVersions) UnmarshalBinary(b []byte) error { 49 | var res InstanceV2ThumbnailVersions 50 | if err := swag.ReadJSON(b, &res); err != nil { 51 | return err 52 | } 53 | *m = res 54 | return nil 55 | } 56 | -------------------------------------------------------------------------------- /models/instance_v2_u_r_ls.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV2URLs InstanceV2URLs models instance-relevant URLs for client application consumption. 16 | // 17 | // swagger:model InstanceV2URLs 18 | type InstanceV2URLs struct { 19 | 20 | // Websockets address for status and notification streaming. 21 | // Example: wss://example.org 22 | Streaming string `json:"streaming,omitempty"` 23 | } 24 | 25 | // Validate validates this instance v2 u r ls 26 | func (m *InstanceV2URLs) Validate(formats strfmt.Registry) error { 27 | return nil 28 | } 29 | 30 | // ContextValidate validates this instance v2 u r ls based on context it is used 31 | func (m *InstanceV2URLs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 32 | return nil 33 | } 34 | 35 | // MarshalBinary interface implementation 36 | func (m *InstanceV2URLs) MarshalBinary() ([]byte, error) { 37 | if m == nil { 38 | return nil, nil 39 | } 40 | return swag.WriteJSON(m) 41 | } 42 | 43 | // UnmarshalBinary interface implementation 44 | func (m *InstanceV2URLs) UnmarshalBinary(b []byte) error { 45 | var res InstanceV2URLs 46 | if err := swag.ReadJSON(b, &res); err != nil { 47 | return err 48 | } 49 | *m = res 50 | return nil 51 | } 52 | -------------------------------------------------------------------------------- /models/instance_v2_usage.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/strfmt" 13 | "github.com/go-openapi/swag" 14 | ) 15 | 16 | // InstanceV2Usage Usage data for this instance. 17 | // 18 | // swagger:model InstanceV2Usage 19 | type InstanceV2Usage struct { 20 | 21 | // users 22 | Users *InstanceV2Users `json:"users,omitempty"` 23 | } 24 | 25 | // Validate validates this instance v2 usage 26 | func (m *InstanceV2Usage) Validate(formats strfmt.Registry) error { 27 | var res []error 28 | 29 | if err := m.validateUsers(formats); err != nil { 30 | res = append(res, err) 31 | } 32 | 33 | if len(res) > 0 { 34 | return errors.CompositeValidationError(res...) 35 | } 36 | return nil 37 | } 38 | 39 | func (m *InstanceV2Usage) validateUsers(formats strfmt.Registry) error { 40 | if swag.IsZero(m.Users) { // not required 41 | return nil 42 | } 43 | 44 | if m.Users != nil { 45 | if err := m.Users.Validate(formats); err != nil { 46 | if ve, ok := err.(*errors.Validation); ok { 47 | return ve.ValidateName("users") 48 | } else if ce, ok := err.(*errors.CompositeError); ok { 49 | return ce.ValidateName("users") 50 | } 51 | return err 52 | } 53 | } 54 | 55 | return nil 56 | } 57 | 58 | // ContextValidate validate this instance v2 usage based on the context it is used 59 | func (m *InstanceV2Usage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 60 | var res []error 61 | 62 | if err := m.contextValidateUsers(ctx, formats); err != nil { 63 | res = append(res, err) 64 | } 65 | 66 | if len(res) > 0 { 67 | return errors.CompositeValidationError(res...) 68 | } 69 | return nil 70 | } 71 | 72 | func (m *InstanceV2Usage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { 73 | 74 | if m.Users != nil { 75 | 76 | if swag.IsZero(m.Users) { // not required 77 | return nil 78 | } 79 | 80 | if err := m.Users.ContextValidate(ctx, formats); err != nil { 81 | if ve, ok := err.(*errors.Validation); ok { 82 | return ve.ValidateName("users") 83 | } else if ce, ok := err.(*errors.CompositeError); ok { 84 | return ce.ValidateName("users") 85 | } 86 | return err 87 | } 88 | } 89 | 90 | return nil 91 | } 92 | 93 | // MarshalBinary interface implementation 94 | func (m *InstanceV2Usage) MarshalBinary() ([]byte, error) { 95 | if m == nil { 96 | return nil, nil 97 | } 98 | return swag.WriteJSON(m) 99 | } 100 | 101 | // UnmarshalBinary interface implementation 102 | func (m *InstanceV2Usage) UnmarshalBinary(b []byte) error { 103 | var res InstanceV2Usage 104 | if err := swag.ReadJSON(b, &res); err != nil { 105 | return err 106 | } 107 | *m = res 108 | return nil 109 | } 110 | -------------------------------------------------------------------------------- /models/instance_v2_users.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // InstanceV2Users Usage data related to users on this instance. 16 | // 17 | // swagger:model InstanceV2Users 18 | type InstanceV2Users struct { 19 | 20 | // The number of active users in the past 4 weeks. 21 | // Currently not implemented: will always be 0. 22 | // Example: 0 23 | ActiveMonth int64 `json:"active_month,omitempty"` 24 | } 25 | 26 | // Validate validates this instance v2 users 27 | func (m *InstanceV2Users) Validate(formats strfmt.Registry) error { 28 | return nil 29 | } 30 | 31 | // ContextValidate validates this instance v2 users based on context it is used 32 | func (m *InstanceV2Users) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 33 | return nil 34 | } 35 | 36 | // MarshalBinary interface implementation 37 | func (m *InstanceV2Users) MarshalBinary() ([]byte, error) { 38 | if m == nil { 39 | return nil, nil 40 | } 41 | return swag.WriteJSON(m) 42 | } 43 | 44 | // UnmarshalBinary interface implementation 45 | func (m *InstanceV2Users) UnmarshalBinary(b []byte) error { 46 | var res InstanceV2Users 47 | if err := swag.ReadJSON(b, &res); err != nil { 48 | return err 49 | } 50 | *m = res 51 | return nil 52 | } 53 | -------------------------------------------------------------------------------- /models/link.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Link Link represents one 'link' in a slice of links returned from a lookup request. 16 | // 17 | // See https://webfinger.net/ and https://www.rfc-editor.org/rfc/rfc6415.html#section-3.1 18 | // 19 | // swagger:model Link 20 | type Link struct { 21 | 22 | // href 23 | Href string `json:"href,omitempty"` 24 | 25 | // rel 26 | Rel string `json:"rel,omitempty"` 27 | 28 | // template 29 | Template string `json:"template,omitempty"` 30 | 31 | // type 32 | Type string `json:"type,omitempty"` 33 | } 34 | 35 | // Validate validates this link 36 | func (m *Link) Validate(formats strfmt.Registry) error { 37 | return nil 38 | } 39 | 40 | // ContextValidate validates this link based on context it is used 41 | func (m *Link) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 42 | return nil 43 | } 44 | 45 | // MarshalBinary interface implementation 46 | func (m *Link) MarshalBinary() ([]byte, error) { 47 | if m == nil { 48 | return nil, nil 49 | } 50 | return swag.WriteJSON(m) 51 | } 52 | 53 | // UnmarshalBinary interface implementation 54 | func (m *Link) UnmarshalBinary(b []byte) error { 55 | var res Link 56 | if err := swag.ReadJSON(b, &res); err != nil { 57 | return err 58 | } 59 | *m = res 60 | return nil 61 | } 62 | -------------------------------------------------------------------------------- /models/list.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // List List represents a user-created list of accounts that the user follows. 16 | // 17 | // swagger:model List 18 | type List struct { 19 | 20 | // Exclusive setting for this list. 21 | // If true, hide posts from members of this list from your home timeline. 22 | Exclusive bool `json:"exclusive,omitempty"` 23 | 24 | // The ID of the list. 25 | ID string `json:"id,omitempty"` 26 | 27 | // RepliesPolicy for this list. 28 | // followed = Show replies to any followed user 29 | // list = Show replies to members of the list 30 | // none = Show replies to no one 31 | RepliesPolicy string `json:"replies_policy,omitempty"` 32 | 33 | // The user-defined title of the list. 34 | Title string `json:"title,omitempty"` 35 | } 36 | 37 | // Validate validates this list 38 | func (m *List) Validate(formats strfmt.Registry) error { 39 | return nil 40 | } 41 | 42 | // ContextValidate validates this list based on context it is used 43 | func (m *List) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 44 | return nil 45 | } 46 | 47 | // MarshalBinary interface implementation 48 | func (m *List) MarshalBinary() ([]byte, error) { 49 | if m == nil { 50 | return nil, nil 51 | } 52 | return swag.WriteJSON(m) 53 | } 54 | 55 | // UnmarshalBinary interface implementation 56 | func (m *List) UnmarshalBinary(b []byte) error { 57 | var res List 58 | if err := swag.ReadJSON(b, &res); err != nil { 59 | return err 60 | } 61 | *m = res 62 | return nil 63 | } 64 | -------------------------------------------------------------------------------- /models/media_dimensions.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // MediaDimensions MediaDimensions models detailed properties of a piece of media. 16 | // 17 | // swagger:model MediaDimensions 18 | type MediaDimensions struct { 19 | 20 | // Aspect ratio of the media. 21 | // Equal to width / height. 22 | // Example: 1.777777778 23 | Aspect float32 `json:"aspect,omitempty"` 24 | 25 | // Bitrate of the media in bits per second. 26 | // Example: 1000000 27 | Bitrate uint64 `json:"bitrate,omitempty"` 28 | 29 | // Duration of the media in seconds. 30 | // Only set for video and audio. 31 | // Example: 5.43 32 | Duration float32 `json:"duration,omitempty"` 33 | 34 | // Framerate of the media. 35 | // Only set for video and gifs. 36 | // Example: 30 37 | FrameRate string `json:"frame_rate,omitempty"` 38 | 39 | // Height of the media in pixels. 40 | // Not set for audio. 41 | // Example: 1080 42 | Height int64 `json:"height,omitempty"` 43 | 44 | // Size of the media, in the format `[width]x[height]`. 45 | // Not set for audio. 46 | // Example: 1920x1080 47 | Size string `json:"size,omitempty"` 48 | 49 | // Width of the media in pixels. 50 | // Not set for audio. 51 | // Example: 1920 52 | Width int64 `json:"width,omitempty"` 53 | } 54 | 55 | // Validate validates this media dimensions 56 | func (m *MediaDimensions) Validate(formats strfmt.Registry) error { 57 | return nil 58 | } 59 | 60 | // ContextValidate validates this media dimensions based on context it is used 61 | func (m *MediaDimensions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 62 | return nil 63 | } 64 | 65 | // MarshalBinary interface implementation 66 | func (m *MediaDimensions) MarshalBinary() ([]byte, error) { 67 | if m == nil { 68 | return nil, nil 69 | } 70 | return swag.WriteJSON(m) 71 | } 72 | 73 | // UnmarshalBinary interface implementation 74 | func (m *MediaDimensions) UnmarshalBinary(b []byte) error { 75 | var res MediaDimensions 76 | if err := swag.ReadJSON(b, &res); err != nil { 77 | return err 78 | } 79 | *m = res 80 | return nil 81 | } 82 | -------------------------------------------------------------------------------- /models/media_focus.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // MediaFocus MediaFocus models the focal point of a piece of media. 16 | // 17 | // swagger:model MediaFocus 18 | type MediaFocus struct { 19 | 20 | // x position of the focus 21 | // should be between -1 and 1 22 | X float32 `json:"x,omitempty"` 23 | 24 | // y position of the focus 25 | // should be between -1 and 1 26 | Y float32 `json:"y,omitempty"` 27 | } 28 | 29 | // Validate validates this media focus 30 | func (m *MediaFocus) Validate(formats strfmt.Registry) error { 31 | return nil 32 | } 33 | 34 | // ContextValidate validates this media focus based on context it is used 35 | func (m *MediaFocus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 36 | return nil 37 | } 38 | 39 | // MarshalBinary interface implementation 40 | func (m *MediaFocus) MarshalBinary() ([]byte, error) { 41 | if m == nil { 42 | return nil, nil 43 | } 44 | return swag.WriteJSON(m) 45 | } 46 | 47 | // UnmarshalBinary interface implementation 48 | func (m *MediaFocus) UnmarshalBinary(b []byte) error { 49 | var res MediaFocus 50 | if err := swag.ReadJSON(b, &res); err != nil { 51 | return err 52 | } 53 | *m = res 54 | return nil 55 | } 56 | -------------------------------------------------------------------------------- /models/mention.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Mention Mention represents a mention of another account. 16 | // 17 | // swagger:model Mention 18 | type Mention struct { 19 | 20 | // The account URI as discovered via webfinger. 21 | // Equal to username for local users, or username@domain for remote users. 22 | // Example: some_user@example.org 23 | Acct string `json:"acct,omitempty"` 24 | 25 | // The ID of the mentioned account. 26 | // Example: 01FBYJHQWQZAVWFRK9PDYTKGMB 27 | ID string `json:"id,omitempty"` 28 | 29 | // The web URL of the mentioned account's profile. 30 | // Example: https://example.org/@some_user 31 | URL string `json:"url,omitempty"` 32 | 33 | // The username of the mentioned account. 34 | // Example: some_user 35 | Username string `json:"username,omitempty"` 36 | } 37 | 38 | // Validate validates this mention 39 | func (m *Mention) Validate(formats strfmt.Registry) error { 40 | return nil 41 | } 42 | 43 | // ContextValidate validates this mention based on context it is used 44 | func (m *Mention) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *Mention) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *Mention) UnmarshalBinary(b []byte) error { 58 | var res Mention 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /models/node_info_services.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // NodeInfoServices NodeInfoServices represents inbound and outbound services that this node offers connections to. 16 | // 17 | // swagger:model NodeInfoServices 18 | type NodeInfoServices struct { 19 | 20 | // inbound 21 | Inbound []string `json:"inbound"` 22 | 23 | // outbound 24 | Outbound []string `json:"outbound"` 25 | } 26 | 27 | // Validate validates this node info services 28 | func (m *NodeInfoServices) Validate(formats strfmt.Registry) error { 29 | return nil 30 | } 31 | 32 | // ContextValidate validates this node info services based on context it is used 33 | func (m *NodeInfoServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // MarshalBinary interface implementation 38 | func (m *NodeInfoServices) MarshalBinary() ([]byte, error) { 39 | if m == nil { 40 | return nil, nil 41 | } 42 | return swag.WriteJSON(m) 43 | } 44 | 45 | // UnmarshalBinary interface implementation 46 | func (m *NodeInfoServices) UnmarshalBinary(b []byte) error { 47 | var res NodeInfoServices 48 | if err := swag.ReadJSON(b, &res); err != nil { 49 | return err 50 | } 51 | *m = res 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /models/node_info_software.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // NodeInfoSoftware NodeInfoSoftware represents the name and version number of the software of this node. 16 | // 17 | // swagger:model NodeInfoSoftware 18 | type NodeInfoSoftware struct { 19 | 20 | // name 21 | // Example: gotosocial 22 | Name string `json:"name,omitempty"` 23 | 24 | // version 25 | // Example: 0.1.2 1234567 26 | Version string `json:"version,omitempty"` 27 | } 28 | 29 | // Validate validates this node info software 30 | func (m *NodeInfoSoftware) Validate(formats strfmt.Registry) error { 31 | return nil 32 | } 33 | 34 | // ContextValidate validates this node info software based on context it is used 35 | func (m *NodeInfoSoftware) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 36 | return nil 37 | } 38 | 39 | // MarshalBinary interface implementation 40 | func (m *NodeInfoSoftware) MarshalBinary() ([]byte, error) { 41 | if m == nil { 42 | return nil, nil 43 | } 44 | return swag.WriteJSON(m) 45 | } 46 | 47 | // UnmarshalBinary interface implementation 48 | func (m *NodeInfoSoftware) UnmarshalBinary(b []byte) error { 49 | var res NodeInfoSoftware 50 | if err := swag.ReadJSON(b, &res); err != nil { 51 | return err 52 | } 53 | *m = res 54 | return nil 55 | } 56 | -------------------------------------------------------------------------------- /models/node_info_usage.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/errors" 12 | "github.com/go-openapi/strfmt" 13 | "github.com/go-openapi/swag" 14 | ) 15 | 16 | // NodeInfoUsage NodeInfoUsage represents usage information about this server, such as number of users. 17 | // 18 | // swagger:model NodeInfoUsage 19 | type NodeInfoUsage struct { 20 | 21 | // local posts 22 | LocalPosts int64 `json:"localPosts,omitempty"` 23 | 24 | // users 25 | Users *NodeInfoUsers `json:"users,omitempty"` 26 | } 27 | 28 | // Validate validates this node info usage 29 | func (m *NodeInfoUsage) Validate(formats strfmt.Registry) error { 30 | var res []error 31 | 32 | if err := m.validateUsers(formats); err != nil { 33 | res = append(res, err) 34 | } 35 | 36 | if len(res) > 0 { 37 | return errors.CompositeValidationError(res...) 38 | } 39 | return nil 40 | } 41 | 42 | func (m *NodeInfoUsage) validateUsers(formats strfmt.Registry) error { 43 | if swag.IsZero(m.Users) { // not required 44 | return nil 45 | } 46 | 47 | if m.Users != nil { 48 | if err := m.Users.Validate(formats); err != nil { 49 | if ve, ok := err.(*errors.Validation); ok { 50 | return ve.ValidateName("users") 51 | } else if ce, ok := err.(*errors.CompositeError); ok { 52 | return ce.ValidateName("users") 53 | } 54 | return err 55 | } 56 | } 57 | 58 | return nil 59 | } 60 | 61 | // ContextValidate validate this node info usage based on the context it is used 62 | func (m *NodeInfoUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 63 | var res []error 64 | 65 | if err := m.contextValidateUsers(ctx, formats); err != nil { 66 | res = append(res, err) 67 | } 68 | 69 | if len(res) > 0 { 70 | return errors.CompositeValidationError(res...) 71 | } 72 | return nil 73 | } 74 | 75 | func (m *NodeInfoUsage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { 76 | 77 | if m.Users != nil { 78 | 79 | if swag.IsZero(m.Users) { // not required 80 | return nil 81 | } 82 | 83 | if err := m.Users.ContextValidate(ctx, formats); err != nil { 84 | if ve, ok := err.(*errors.Validation); ok { 85 | return ve.ValidateName("users") 86 | } else if ce, ok := err.(*errors.CompositeError); ok { 87 | return ce.ValidateName("users") 88 | } 89 | return err 90 | } 91 | } 92 | 93 | return nil 94 | } 95 | 96 | // MarshalBinary interface implementation 97 | func (m *NodeInfoUsage) MarshalBinary() ([]byte, error) { 98 | if m == nil { 99 | return nil, nil 100 | } 101 | return swag.WriteJSON(m) 102 | } 103 | 104 | // UnmarshalBinary interface implementation 105 | func (m *NodeInfoUsage) UnmarshalBinary(b []byte) error { 106 | var res NodeInfoUsage 107 | if err := swag.ReadJSON(b, &res); err != nil { 108 | return err 109 | } 110 | *m = res 111 | return nil 112 | } 113 | -------------------------------------------------------------------------------- /models/node_info_users.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // NodeInfoUsers NodeInfoUsers represents aggregate information about the users on the server. 16 | // 17 | // swagger:model NodeInfoUsers 18 | type NodeInfoUsers struct { 19 | 20 | // total 21 | Total int64 `json:"total,omitempty"` 22 | } 23 | 24 | // Validate validates this node info users 25 | func (m *NodeInfoUsers) Validate(formats strfmt.Registry) error { 26 | return nil 27 | } 28 | 29 | // ContextValidate validates this node info users based on context it is used 30 | func (m *NodeInfoUsers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 31 | return nil 32 | } 33 | 34 | // MarshalBinary interface implementation 35 | func (m *NodeInfoUsers) MarshalBinary() ([]byte, error) { 36 | if m == nil { 37 | return nil, nil 38 | } 39 | return swag.WriteJSON(m) 40 | } 41 | 42 | // UnmarshalBinary interface implementation 43 | func (m *NodeInfoUsers) UnmarshalBinary(b []byte) error { 44 | var res NodeInfoUsers 45 | if err := swag.ReadJSON(b, &res); err != nil { 46 | return err 47 | } 48 | *m = res 49 | return nil 50 | } 51 | -------------------------------------------------------------------------------- /models/policy_value.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // PolicyValue One interaction policy entry for a status. 15 | // 16 | // It can be EITHER one of the internal keywords listed below, OR a full-fledged ActivityPub URI of an Actor, like "https://example.org/users/some_user". 17 | // 18 | // Internal keywords: 19 | // 20 | // public - Public, aka anyone who can see the status according to its visibility level. 21 | // followers - Followers of the status author. 22 | // following - People followed by the status author. 23 | // mutuals - Mutual follows of the status author (reserved, unused). 24 | // mentioned - Accounts mentioned in, or replied-to by, the status. 25 | // author - The status author themself. 26 | // me - If request was made with an authorized user, "me" represents the user who made the request and is now looking at this interaction policy. 27 | // 28 | // swagger:model PolicyValue 29 | type PolicyValue string 30 | 31 | // Validate validates this policy value 32 | func (m PolicyValue) Validate(formats strfmt.Registry) error { 33 | return nil 34 | } 35 | 36 | // ContextValidate validates this policy value based on context it is used 37 | func (m PolicyValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 38 | return nil 39 | } 40 | -------------------------------------------------------------------------------- /models/poll_option.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // PollOption PollOption represents the current vote counts for different poll options. 16 | // 17 | // swagger:model PollOption 18 | type PollOption struct { 19 | 20 | // The text value of the poll option. String. 21 | Title string `json:"title,omitempty"` 22 | 23 | // The number of received votes for this option. 24 | VotesCount int64 `json:"votes_count,omitempty"` 25 | } 26 | 27 | // Validate validates this poll option 28 | func (m *PollOption) Validate(formats strfmt.Registry) error { 29 | return nil 30 | } 31 | 32 | // ContextValidate validates this poll option based on context it is used 33 | func (m *PollOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // MarshalBinary interface implementation 38 | func (m *PollOption) MarshalBinary() ([]byte, error) { 39 | if m == nil { 40 | return nil, nil 41 | } 42 | return swag.WriteJSON(m) 43 | } 44 | 45 | // UnmarshalBinary interface implementation 46 | func (m *PollOption) UnmarshalBinary(b []byte) error { 47 | var res PollOption 48 | if err := swag.ReadJSON(b, &res); err != nil { 49 | return err 50 | } 51 | *m = res 52 | return nil 53 | } 54 | -------------------------------------------------------------------------------- /models/relationship.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Relationship Relationship represents a relationship between accounts. 16 | // 17 | // swagger:model Relationship 18 | type Relationship struct { 19 | 20 | // This account is blocking you. 21 | BlockedBy bool `json:"blocked_by,omitempty"` 22 | 23 | // You are blocking this account. 24 | Blocking bool `json:"blocking,omitempty"` 25 | 26 | // You are blocking this account's domain. 27 | DomainBlocking bool `json:"domain_blocking,omitempty"` 28 | 29 | // You are featuring this account on your profile. 30 | Endorsed bool `json:"endorsed,omitempty"` 31 | 32 | // This account follows you. 33 | FollowedBy bool `json:"followed_by,omitempty"` 34 | 35 | // You are following this account. 36 | Following bool `json:"following,omitempty"` 37 | 38 | // The account id. 39 | // Example: 01FBW9XGEP7G6K88VY4S9MPE1R 40 | ID string `json:"id,omitempty"` 41 | 42 | // You are muting this account. 43 | Muting bool `json:"muting,omitempty"` 44 | 45 | // You are muting notifications from this account. 46 | MutingNotifications bool `json:"muting_notifications,omitempty"` 47 | 48 | // Your note on this account. 49 | Note string `json:"note,omitempty"` 50 | 51 | // You are seeing notifications when this account posts. 52 | Notifying bool `json:"notifying,omitempty"` 53 | 54 | // You have requested to follow this account, and the request is pending. 55 | Requested bool `json:"requested,omitempty"` 56 | 57 | // This account has requested to follow you, and the request is pending. 58 | RequestedBy bool `json:"requested_by,omitempty"` 59 | 60 | // You are seeing reblogs/boosts from this account in your home timeline. 61 | ShowingReblogs bool `json:"showing_reblogs,omitempty"` 62 | } 63 | 64 | // Validate validates this relationship 65 | func (m *Relationship) Validate(formats strfmt.Registry) error { 66 | return nil 67 | } 68 | 69 | // ContextValidate validates this relationship based on context it is used 70 | func (m *Relationship) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 71 | return nil 72 | } 73 | 74 | // MarshalBinary interface implementation 75 | func (m *Relationship) MarshalBinary() ([]byte, error) { 76 | if m == nil { 77 | return nil, nil 78 | } 79 | return swag.WriteJSON(m) 80 | } 81 | 82 | // UnmarshalBinary interface implementation 83 | func (m *Relationship) UnmarshalBinary(b []byte) error { 84 | var res Relationship 85 | if err := swag.ReadJSON(b, &res); err != nil { 86 | return err 87 | } 88 | *m = res 89 | return nil 90 | } 91 | -------------------------------------------------------------------------------- /models/status_source.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // StatusSource StatusSource represents the source text of a 16 | // status as submitted to the API when it was created. 17 | // 18 | // swagger:model StatusSource 19 | type StatusSource struct { 20 | 21 | // ID of the status. 22 | // Example: 01FBVD42CQ3ZEEVMW180SBX03B 23 | ID string `json:"id,omitempty"` 24 | 25 | // Plain-text version of spoiler text. 26 | SpoilerText string `json:"spoiler_text,omitempty"` 27 | 28 | // Plain-text source of a status. 29 | Text string `json:"text,omitempty"` 30 | } 31 | 32 | // Validate validates this status source 33 | func (m *StatusSource) Validate(formats strfmt.Registry) error { 34 | return nil 35 | } 36 | 37 | // ContextValidate validates this status source based on context it is used 38 | func (m *StatusSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 39 | return nil 40 | } 41 | 42 | // MarshalBinary interface implementation 43 | func (m *StatusSource) MarshalBinary() ([]byte, error) { 44 | if m == nil { 45 | return nil, nil 46 | } 47 | return swag.WriteJSON(m) 48 | } 49 | 50 | // UnmarshalBinary interface implementation 51 | func (m *StatusSource) UnmarshalBinary(b []byte) error { 52 | var res StatusSource 53 | if err := swag.ReadJSON(b, &res); err != nil { 54 | return err 55 | } 56 | *m = res 57 | return nil 58 | } 59 | -------------------------------------------------------------------------------- /models/swagger_collection_page.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // SwaggerCollectionPage SwaggerCollectionPage represents one page of a collection. 16 | // 17 | // swagger:model SwaggerCollectionPage 18 | type SwaggerCollectionPage struct { 19 | 20 | // ActivityStreams ID. 21 | // Example: https://example.org/users/some_user/statuses/106717595988259568/replies?page=true 22 | ID string `json:"id,omitempty"` 23 | 24 | // Items on this page. 25 | // Example: ["https://example.org/users/some_other_user/statuses/086417595981111564","https://another.example.com/users/another_user/statuses/01FCN8XDV3YG7B4R42QA6YQZ9R"] 26 | Items []string `json:"items"` 27 | 28 | // Link to the next page. 29 | // Example: https://example.org/users/some_user/statuses/106717595988259568/replies?only_other_accounts=true\u0026page=true 30 | Next string `json:"next,omitempty"` 31 | 32 | // Collection this page belongs to. 33 | // Example: https://example.org/users/some_user/statuses/106717595988259568/replies 34 | PartOf string `json:"partOf,omitempty"` 35 | 36 | // ActivityStreams type. 37 | // Example: CollectionPage 38 | Type string `json:"type,omitempty"` 39 | } 40 | 41 | // Validate validates this swagger collection page 42 | func (m *SwaggerCollectionPage) Validate(formats strfmt.Registry) error { 43 | return nil 44 | } 45 | 46 | // ContextValidate validates this swagger collection page based on context it is used 47 | func (m *SwaggerCollectionPage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 48 | return nil 49 | } 50 | 51 | // MarshalBinary interface implementation 52 | func (m *SwaggerCollectionPage) MarshalBinary() ([]byte, error) { 53 | if m == nil { 54 | return nil, nil 55 | } 56 | return swag.WriteJSON(m) 57 | } 58 | 59 | // UnmarshalBinary interface implementation 60 | func (m *SwaggerCollectionPage) UnmarshalBinary(b []byte) error { 61 | var res SwaggerCollectionPage 62 | if err := swag.ReadJSON(b, &res); err != nil { 63 | return err 64 | } 65 | *m = res 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /models/swagger_featured_collection.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // SwaggerFeaturedCollection SwaggerFeaturedCollection represents an ActivityPub OrderedCollection. 16 | // 17 | // swagger:model SwaggerFeaturedCollection 18 | type SwaggerFeaturedCollection struct { 19 | 20 | // ActivityStreams JSON-LD context. 21 | // A string or an array of strings, or more 22 | // complex nested items. 23 | // Example: https://www.w3.org/ns/activitystreams 24 | Context interface{} `json:"@context,omitempty"` 25 | 26 | // ActivityStreams ID. 27 | // Example: https://example.org/users/some_user/collections/featured 28 | ID string `json:"id,omitempty"` 29 | 30 | // List of status URIs. 31 | // Example: ["https://example.org/users/some_user/statuses/01GSZ0F7Q8SJKNRF777GJD271R","https://example.org/users/some_user/statuses/01GSZ0G012CBQ7TEKX689S3QRE"] 32 | Items []string `json:"items"` 33 | 34 | // Number of items in this collection. 35 | // Example: 2 36 | TotalItems int64 `json:"TotalItems,omitempty"` 37 | 38 | // ActivityStreams type. 39 | // Example: OrderedCollection 40 | Type string `json:"type,omitempty"` 41 | } 42 | 43 | // Validate validates this swagger featured collection 44 | func (m *SwaggerFeaturedCollection) Validate(formats strfmt.Registry) error { 45 | return nil 46 | } 47 | 48 | // ContextValidate validates this swagger featured collection based on context it is used 49 | func (m *SwaggerFeaturedCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 50 | return nil 51 | } 52 | 53 | // MarshalBinary interface implementation 54 | func (m *SwaggerFeaturedCollection) MarshalBinary() ([]byte, error) { 55 | if m == nil { 56 | return nil, nil 57 | } 58 | return swag.WriteJSON(m) 59 | } 60 | 61 | // UnmarshalBinary interface implementation 62 | func (m *SwaggerFeaturedCollection) UnmarshalBinary(b []byte) error { 63 | var res SwaggerFeaturedCollection 64 | if err := swag.ReadJSON(b, &res); err != nil { 65 | return err 66 | } 67 | *m = res 68 | return nil 69 | } 70 | -------------------------------------------------------------------------------- /models/tag.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Tag Tag represents a hashtag used within the content of a status. 16 | // 17 | // swagger:model Tag 18 | type Tag struct { 19 | 20 | // Following is true if the user is following this tag, false if they're not, 21 | // and not present if there is no currently authenticated user. 22 | Following bool `json:"following,omitempty"` 23 | 24 | // History of this hashtag's usage. 25 | // Currently just a stub, if provided will always be an empty array. 26 | // Example: [] 27 | History []interface{} `json:"history"` 28 | 29 | // The value of the hashtag after the # sign. 30 | // Example: helloworld 31 | Name string `json:"name,omitempty"` 32 | 33 | // Web link to the hashtag. 34 | // Example: https://example.org/tags/helloworld 35 | URL string `json:"url,omitempty"` 36 | } 37 | 38 | // Validate validates this tag 39 | func (m *Tag) Validate(formats strfmt.Registry) error { 40 | return nil 41 | } 42 | 43 | // ContextValidate validates this tag based on context it is used 44 | func (m *Tag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 45 | return nil 46 | } 47 | 48 | // MarshalBinary interface implementation 49 | func (m *Tag) MarshalBinary() ([]byte, error) { 50 | if m == nil { 51 | return nil, nil 52 | } 53 | return swag.WriteJSON(m) 54 | } 55 | 56 | // UnmarshalBinary interface implementation 57 | func (m *Tag) UnmarshalBinary(b []byte) error { 58 | var res Tag 59 | if err := swag.ReadJSON(b, &res); err != nil { 60 | return err 61 | } 62 | *m = res 63 | return nil 64 | } 65 | -------------------------------------------------------------------------------- /models/theme.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Theme Theme represents one user-selectable preset CSS theme. 16 | // 17 | // swagger:model Theme 18 | type Theme struct { 19 | 20 | // User-facing description of this theme. 21 | Description string `json:"description,omitempty"` 22 | 23 | // FileName of this theme in the themes directory. 24 | FileName string `json:"file_name,omitempty"` 25 | 26 | // User-facing title of this theme. 27 | Title string `json:"title,omitempty"` 28 | } 29 | 30 | // Validate validates this theme 31 | func (m *Theme) Validate(formats strfmt.Registry) error { 32 | return nil 33 | } 34 | 35 | // ContextValidate validates this theme based on context it is used 36 | func (m *Theme) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 37 | return nil 38 | } 39 | 40 | // MarshalBinary interface implementation 41 | func (m *Theme) MarshalBinary() ([]byte, error) { 42 | if m == nil { 43 | return nil, nil 44 | } 45 | return swag.WriteJSON(m) 46 | } 47 | 48 | // UnmarshalBinary interface implementation 49 | func (m *Theme) UnmarshalBinary(b []byte) error { 50 | var res Theme 51 | if err := swag.ReadJSON(b, &res); err != nil { 52 | return err 53 | } 54 | *m = res 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /models/timeline_marker.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // TimelineMarker TimelineMarker contains information about a user's progress through a specific timeline. 16 | // 17 | // swagger:model TimelineMarker 18 | type TimelineMarker struct { 19 | 20 | // The ID of the most recently viewed entity. 21 | LastReadID string `json:"last_read_id,omitempty"` 22 | 23 | // The timestamp of when the marker was set (ISO 8601 Datetime) 24 | UpdatedAt string `json:"updated_at,omitempty"` 25 | 26 | // Used for locking to prevent write conflicts. 27 | Version int64 `json:"version,omitempty"` 28 | } 29 | 30 | // Validate validates this timeline marker 31 | func (m *TimelineMarker) Validate(formats strfmt.Registry) error { 32 | return nil 33 | } 34 | 35 | // ContextValidate validates this timeline marker based on context it is used 36 | func (m *TimelineMarker) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 37 | return nil 38 | } 39 | 40 | // MarshalBinary interface implementation 41 | func (m *TimelineMarker) MarshalBinary() ([]byte, error) { 42 | if m == nil { 43 | return nil, nil 44 | } 45 | return swag.WriteJSON(m) 46 | } 47 | 48 | // UnmarshalBinary interface implementation 49 | func (m *TimelineMarker) UnmarshalBinary(b []byte) error { 50 | var res TimelineMarker 51 | if err := swag.ReadJSON(b, &res); err != nil { 52 | return err 53 | } 54 | *m = res 55 | return nil 56 | } 57 | -------------------------------------------------------------------------------- /models/token.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // Token Token represents an OAuth token used for authenticating with the GoToSocial API and performing actions. 16 | // 17 | // swagger:model Token 18 | type Token struct { 19 | 20 | // Access token used for authorization. 21 | AccessToken string `json:"access_token,omitempty"` 22 | 23 | // When the OAuth token was generated (UNIX timestamp seconds). 24 | // Example: 1627644520 25 | CreatedAt int64 `json:"created_at,omitempty"` 26 | 27 | // OAuth scopes granted by this token, space-separated. 28 | // Example: read write admin 29 | Scope string `json:"scope,omitempty"` 30 | 31 | // OAuth token type. Will always be 'Bearer'. 32 | // Example: bearer 33 | TokenType string `json:"token_type,omitempty"` 34 | } 35 | 36 | // Validate validates this token 37 | func (m *Token) Validate(formats strfmt.Registry) error { 38 | return nil 39 | } 40 | 41 | // ContextValidate validates this token based on context it is used 42 | func (m *Token) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 43 | return nil 44 | } 45 | 46 | // MarshalBinary interface implementation 47 | func (m *Token) MarshalBinary() ([]byte, error) { 48 | if m == nil { 49 | return nil, nil 50 | } 51 | return swag.WriteJSON(m) 52 | } 53 | 54 | // UnmarshalBinary interface implementation 55 | func (m *Token) UnmarshalBinary(b []byte) error { 56 | var res Token 57 | if err := swag.ReadJSON(b, &res); err != nil { 58 | return err 59 | } 60 | *m = res 61 | return nil 62 | } 63 | -------------------------------------------------------------------------------- /models/user.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // User User models fields relevant to one user. 16 | // 17 | // swagger:model User 18 | type User struct { 19 | 20 | // User is an admin. 21 | // Example: false 22 | Admin bool `json:"admin,omitempty"` 23 | 24 | // User was approved by an admin. 25 | // Example: true 26 | Approved bool `json:"approved,omitempty"` 27 | 28 | // Time when the last "please confirm your email address" email was sent, if at all. (ISO 8601 Datetime) 29 | // Example: 2021-07-30T09:20:25+00:00 30 | ConfirmationSentAt string `json:"confirmation_sent_at,omitempty"` 31 | 32 | // Time at which the email given in the `email` field was confirmed, if at all. (ISO 8601 Datetime) 33 | // Example: 2021-07-30T09:20:25+00:00 34 | ConfirmedAt string `json:"confirmed_at,omitempty"` 35 | 36 | // Time this user was created. (ISO 8601 Datetime) 37 | // Example: 2021-07-30T09:20:25+00:00 38 | CreatedAt string `json:"created_at,omitempty"` 39 | 40 | // User's account is disabled. 41 | // Example: false 42 | Disabled bool `json:"disabled,omitempty"` 43 | 44 | // Confirmed email address of this user, if set. 45 | // Example: someone@example.org 46 | Email string `json:"email,omitempty"` 47 | 48 | // Database ID of this user. 49 | // Example: 01FBVD42CQ3ZEEVMW180SBX03B 50 | ID string `json:"id,omitempty"` 51 | 52 | // Time at which this user was last emailed, if at all. (ISO 8601 Datetime) 53 | // Example: 2021-07-30T09:20:25+00:00 54 | LastEmailedAt string `json:"last_emailed_at,omitempty"` 55 | 56 | // User is a moderator. 57 | // Example: false 58 | Moderator bool `json:"moderator,omitempty"` 59 | 60 | // Reason for sign-up, if provided. 61 | // Example: Please! Pretty please! 62 | Reason string `json:"reason,omitempty"` 63 | 64 | // Time when the last "please reset your password" email was sent, if at all. (ISO 8601 Datetime) 65 | // Example: 2021-07-30T09:20:25+00:00 66 | ResetPasswordSentAt string `json:"reset_password_sent_at,omitempty"` 67 | 68 | // Unconfirmed email address of this user, if set. 69 | // Example: someone.else@somewhere.else.example.org 70 | UnconfirmedEmail string `json:"unconfirmed_email,omitempty"` 71 | } 72 | 73 | // Validate validates this user 74 | func (m *User) Validate(formats strfmt.Registry) error { 75 | return nil 76 | } 77 | 78 | // ContextValidate validates this user based on context it is used 79 | func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 80 | return nil 81 | } 82 | 83 | // MarshalBinary interface implementation 84 | func (m *User) MarshalBinary() ([]byte, error) { 85 | if m == nil { 86 | return nil, nil 87 | } 88 | return swag.WriteJSON(m) 89 | } 90 | 91 | // UnmarshalBinary interface implementation 92 | func (m *User) UnmarshalBinary(b []byte) error { 93 | var res User 94 | if err := swag.ReadJSON(b, &res); err != nil { 95 | return err 96 | } 97 | *m = res 98 | return nil 99 | } 100 | -------------------------------------------------------------------------------- /models/web_push_notification.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // WebPushNotification WebPushNotification represents a notification summary delivered to the client by the Web Push server. 16 | // 17 | // It does not contain an entire Notification, just the NotificationID and some preview information. 18 | // It is not used in the client API directly, but is included in the API doc for decoding Web Push notifications. 19 | // 20 | // swagger:model WebPushNotification 21 | type WebPushNotification struct { 22 | 23 | // AccessToken is the access token associated with the Web Push subscription. 24 | // I don't know why this is sent, given that the client should know that already, 25 | // but Feditext does use it. 26 | AccessToken string `json:"access_token,omitempty"` 27 | 28 | // Body is a preview of the notification body, 29 | // such as the first line of a status's CW or text, 30 | // or the first line of an account bio. 31 | Body string `json:"body,omitempty"` 32 | 33 | // Icon is an image URL that can be displayed with the notification, 34 | // normally the account's avatar. 35 | Icon string `json:"icon,omitempty"` 36 | 37 | // NotificationID is the Notification.ID of the referenced Notification. 38 | NotificationID string `json:"notification_id,omitempty"` 39 | 40 | // NotificationType is the Notification.Type of the referenced Notification. 41 | NotificationType string `json:"notification_type,omitempty"` 42 | 43 | // PreferredLocale is a BCP 47 language tag for the receiving user's locale. 44 | PreferredLocale string `json:"preferred_locale,omitempty"` 45 | 46 | // Title is a title for the notification, 47 | // generally describing an action taken by a user. 48 | Title string `json:"title,omitempty"` 49 | } 50 | 51 | // Validate validates this web push notification 52 | func (m *WebPushNotification) Validate(formats strfmt.Registry) error { 53 | return nil 54 | } 55 | 56 | // ContextValidate validates this web push notification based on context it is used 57 | func (m *WebPushNotification) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 58 | return nil 59 | } 60 | 61 | // MarshalBinary interface implementation 62 | func (m *WebPushNotification) MarshalBinary() ([]byte, error) { 63 | if m == nil { 64 | return nil, nil 65 | } 66 | return swag.WriteJSON(m) 67 | } 68 | 69 | // UnmarshalBinary interface implementation 70 | func (m *WebPushNotification) UnmarshalBinary(b []byte) error { 71 | var res WebPushNotification 72 | if err := swag.ReadJSON(b, &res); err != nil { 73 | return err 74 | } 75 | *m = res 76 | return nil 77 | } 78 | -------------------------------------------------------------------------------- /models/web_push_notification_policy.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // WebPushNotificationPolicy WebPushNotificationPolicy names sets of accounts that can generate notifications. 15 | // 16 | // swagger:model WebPushNotificationPolicy 17 | type WebPushNotificationPolicy string 18 | 19 | // Validate validates this web push notification policy 20 | func (m WebPushNotificationPolicy) Validate(formats strfmt.Registry) error { 21 | return nil 22 | } 23 | 24 | // ContextValidate validates this web push notification policy based on context it is used 25 | func (m WebPushNotificationPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 26 | return nil 27 | } 28 | -------------------------------------------------------------------------------- /models/web_push_subscription_alerts.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | 11 | "github.com/go-openapi/strfmt" 12 | "github.com/go-openapi/swag" 13 | ) 14 | 15 | // WebPushSubscriptionAlerts WebPushSubscriptionAlerts represents the specific events that this Web Push subscription will receive. 16 | // 17 | // swagger:model WebPushSubscriptionAlerts 18 | type WebPushSubscriptionAlerts struct { 19 | 20 | // Receive a push notification when a new report has been filed? 21 | AdminReport bool `json:"admin.report,omitempty"` 22 | 23 | // Receive a push notification when a new user has signed up? 24 | AdminSignup bool `json:"admin.sign_up,omitempty"` 25 | 26 | // Receive a push notification when a status you created has been favourited by someone else? 27 | Favourite bool `json:"favourite,omitempty"` 28 | 29 | // Receive a push notification when someone has followed you? 30 | Follow bool `json:"follow,omitempty"` 31 | 32 | // Receive a push notification when someone has requested to follow you? 33 | FollowRequest bool `json:"follow_request,omitempty"` 34 | 35 | // Receive a push notification when someone else has mentioned you in a status? 36 | Mention bool `json:"mention,omitempty"` 37 | 38 | // Receive a push notification when a fave is pending? 39 | PendingFavourite bool `json:"pending.favourite,omitempty"` 40 | 41 | // Receive a push notification when a boost is pending? 42 | PendingReblog bool `json:"pending.reblog,omitempty"` 43 | 44 | // Receive a push notification when a reply is pending? 45 | PendingReply bool `json:"pending.reply,omitempty"` 46 | 47 | // Receive a push notification when a poll you voted in or created has ended? 48 | Poll bool `json:"poll,omitempty"` 49 | 50 | // Receive a push notification when a status you created has been boosted by someone else? 51 | Reblog bool `json:"reblog,omitempty"` 52 | 53 | // Receive a push notification when a subscribed account posts a status? 54 | Status bool `json:"status,omitempty"` 55 | 56 | // Receive a push notification when a status you interacted with has been edited? 57 | Update bool `json:"update,omitempty"` 58 | } 59 | 60 | // Validate validates this web push subscription alerts 61 | func (m *WebPushSubscriptionAlerts) Validate(formats strfmt.Registry) error { 62 | return nil 63 | } 64 | 65 | // ContextValidate validates this web push subscription alerts based on context it is used 66 | func (m *WebPushSubscriptionAlerts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 67 | return nil 68 | } 69 | 70 | // MarshalBinary interface implementation 71 | func (m *WebPushSubscriptionAlerts) MarshalBinary() ([]byte, error) { 72 | if m == nil { 73 | return nil, nil 74 | } 75 | return swag.WriteJSON(m) 76 | } 77 | 78 | // UnmarshalBinary interface implementation 79 | func (m *WebPushSubscriptionAlerts) UnmarshalBinary(b []byte) error { 80 | var res WebPushSubscriptionAlerts 81 | if err := swag.ReadJSON(b, &res); err != nil { 82 | return err 83 | } 84 | *m = res 85 | return nil 86 | } 87 | -------------------------------------------------------------------------------- /models/well_known_response.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package models 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "strconv" 11 | 12 | "github.com/go-openapi/errors" 13 | "github.com/go-openapi/strfmt" 14 | "github.com/go-openapi/swag" 15 | ) 16 | 17 | // WellKnownResponse WellKnownResponse represents the response to either a webfinger request for an 'acct' resource, or a request to nodeinfo. 18 | // For example, it would be returned from https://example.org/.well-known/webfinger?resource=acct:some_username@example.org 19 | // 20 | // See https://webfinger.net/ 21 | // 22 | // swagger:model WellKnownResponse 23 | type WellKnownResponse struct { 24 | 25 | // aliases 26 | Aliases []string `json:"aliases"` 27 | 28 | // links 29 | Links []*Link `json:"links"` 30 | 31 | // subject 32 | Subject string `json:"subject,omitempty"` 33 | } 34 | 35 | // Validate validates this well known response 36 | func (m *WellKnownResponse) Validate(formats strfmt.Registry) error { 37 | var res []error 38 | 39 | if err := m.validateLinks(formats); err != nil { 40 | res = append(res, err) 41 | } 42 | 43 | if len(res) > 0 { 44 | return errors.CompositeValidationError(res...) 45 | } 46 | return nil 47 | } 48 | 49 | func (m *WellKnownResponse) validateLinks(formats strfmt.Registry) error { 50 | if swag.IsZero(m.Links) { // not required 51 | return nil 52 | } 53 | 54 | for i := 0; i < len(m.Links); i++ { 55 | if swag.IsZero(m.Links[i]) { // not required 56 | continue 57 | } 58 | 59 | if m.Links[i] != nil { 60 | if err := m.Links[i].Validate(formats); err != nil { 61 | if ve, ok := err.(*errors.Validation); ok { 62 | return ve.ValidateName("links" + "." + strconv.Itoa(i)) 63 | } else if ce, ok := err.(*errors.CompositeError); ok { 64 | return ce.ValidateName("links" + "." + strconv.Itoa(i)) 65 | } 66 | return err 67 | } 68 | } 69 | 70 | } 71 | 72 | return nil 73 | } 74 | 75 | // ContextValidate validate this well known response based on the context it is used 76 | func (m *WellKnownResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 77 | var res []error 78 | 79 | if err := m.contextValidateLinks(ctx, formats); err != nil { 80 | res = append(res, err) 81 | } 82 | 83 | if len(res) > 0 { 84 | return errors.CompositeValidationError(res...) 85 | } 86 | return nil 87 | } 88 | 89 | func (m *WellKnownResponse) contextValidateLinks(ctx context.Context, formats strfmt.Registry) error { 90 | 91 | for i := 0; i < len(m.Links); i++ { 92 | 93 | if m.Links[i] != nil { 94 | 95 | if swag.IsZero(m.Links[i]) { // not required 96 | return nil 97 | } 98 | 99 | if err := m.Links[i].ContextValidate(ctx, formats); err != nil { 100 | if ve, ok := err.(*errors.Validation); ok { 101 | return ve.ValidateName("links" + "." + strconv.Itoa(i)) 102 | } else if ce, ok := err.(*errors.CompositeError); ok { 103 | return ce.ValidateName("links" + "." + strconv.Itoa(i)) 104 | } 105 | return err 106 | } 107 | } 108 | 109 | } 110 | 111 | return nil 112 | } 113 | 114 | // MarshalBinary interface implementation 115 | func (m *WellKnownResponse) MarshalBinary() ([]byte, error) { 116 | if m == nil { 117 | return nil, nil 118 | } 119 | return swag.WriteJSON(m) 120 | } 121 | 122 | // UnmarshalBinary interface implementation 123 | func (m *WellKnownResponse) UnmarshalBinary(b []byte) error { 124 | var res WellKnownResponse 125 | if err := swag.ReadJSON(b, &res); err != nil { 126 | return err 127 | } 128 | *m = res 129 | return nil 130 | } 131 | -------------------------------------------------------------------------------- /tools/tools.go: -------------------------------------------------------------------------------- 1 | //go:build tools 2 | 3 | // tools exists to pull in command-line tools that we need to go get, 4 | // and is behind a build tag that is otherwise unused and thus only visible 5 | // to dependency management commands. See https://stackoverflow.com/a/54028731. 6 | package tools 7 | 8 | import ( 9 | // Provides swagger command used to update GtS client library 10 | _ "github.com/go-swagger/go-swagger/cmd/swagger" 11 | ) 12 | --------------------------------------------------------------------------------