summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2025-01-05 13:20:33 +0100
committerLibravatar GitHub <noreply@github.com>2025-01-05 13:20:33 +0100
commite9bb7ddd3aa11da5c48a75c4a600f8fe5cc1c990 (patch)
treea2897775112a821aa093b6e2686044814912001f /internal/api/model
parent[chore] Update robots.txt with more AI bots (#3634) (diff)
downloadgotosocial-e9bb7ddd3aa11da5c48a75c4a600f8fe5cc1c990.tar.xz
[feature] Create/update/remove domain permission subscriptions (#3623)
* [feature] Create/update/remove domain permission subscriptions * lint * envparsing * remove errant fmt.Println * create drafts, subs, exclude, from snapshot models * name etag column correctly * remove count column * lint
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/domain.go98
1 files changed, 98 insertions, 0 deletions
diff --git a/internal/api/model/domain.go b/internal/api/model/domain.go
index c973c7d92..94a190f63 100644
--- a/internal/api/model/domain.go
+++ b/internal/api/model/domain.go
@@ -99,3 +99,101 @@ type DomainKeysExpireRequest struct {
// hostname/domain to expire keys for.
Domain string `form:"domain" json:"domain"`
}
+
+// DomainPermissionSubscription represents an auto-refreshing subscription to a list of domain permissions (allows, blocks).
+//
+// swagger:model domainPermissionSubscription
+type DomainPermissionSubscription struct {
+ // The ID of the domain permission subscription.
+ // example: 01FBW21XJA09XYX51KV5JVBW0F
+ // readonly: true
+ ID string `json:"id"`
+ // Priority of this subscription compared to others of the same permission type. 0-255 (higher = higher priority).
+ // example: 100
+ Priority uint8 `json:"priority"`
+ // Title of this subscription, as set by admin who created or updated it.
+ // example: really cool list of neato pals
+ Title string `json:"title"`
+ // The type of domain permission subscription (allow, block).
+ // example: block
+ PermissionType string `json:"permission_type"`
+ // If true, domain permissions arising from this subscription will be created as drafts that must be approved by a moderator to take effect. If false, domain permissions from this subscription will come into force immediately.
+ // example: true
+ AsDraft bool `json:"as_draft"`
+ // If true, this domain permission subscription will "adopt" domain permissions which already exist on the instance, and which meet the following conditions: 1) they have no subscription ID (ie., they're "orphaned") and 2) they are present in the subscribed list. Such orphaned domain permissions will be given this subscription's subscription ID value.
+ // example: false
+ AdoptOrphans bool `json:"adopt_orphans"`
+ // Time at which the subscription was created (ISO 8601 Datetime).
+ // example: 2021-07-30T09:20:25+00:00
+ CreatedAt string `json:"created_at"`
+ // ID of the account that created this subscription.
+ // example: 01FBW21XJA09XYX51KV5JVBW0F
+ // readonly: true
+ CreatedBy string `json:"created_by"`
+ // URI to call in order to fetch the permissions list.
+ // example: https://www.example.org/blocklists/list1.csv
+ URI string `json:"uri"`
+ // MIME content type to use when parsing the permissions list.
+ // example: text/csv
+ ContentType string `json:"content_type"`
+ // (Optional) username to set for basic auth when doing a fetch of URI.
+ // example: admin123
+ FetchUsername string `json:"fetch_username,omitempty"`
+ // (Optional) password to set for basic auth when doing a fetch of URI.
+ // example: admin123
+ FetchPassword string `json:"fetch_password,omitempty"`
+ // Time of the most recent fetch attempt (successful or otherwise) (ISO 8601 Datetime).
+ // example: 2021-07-30T09:20:25+00:00
+ // readonly: true
+ FetchedAt string `json:"fetched_at,omitempty"`
+ // Time of the most recent successful fetch (ISO 8601 Datetime).
+ // example: 2021-07-30T09:20:25+00:00
+ // readonly: true
+ SuccessfullyFetchedAt string `json:"successfully_fetched_at,omitempty"`
+ // If most recent fetch attempt failed, this field will contain an error message related to the fetch attempt.
+ // example: Oopsie doopsie, we made a fucky wucky.
+ // readonly: true
+ Error string `json:"error,omitempty"`
+ // Count of domain permission entries discovered at URI on last (successful) fetch.
+ // example: 53
+ // readonly: true
+ Count uint64 `json:"count"`
+}
+
+// DomainPermissionSubscriptionRequest represents a request to create or update a domain permission subscription..
+//
+// swagger:ignore
+type DomainPermissionSubscriptionRequest struct {
+ // Priority of this subscription compared to others of the same permission type. 0-255 (higher = higher priority).
+ // example: 100
+ Priority *int `form:"priority" json:"priority"`
+ // Title of this subscription, as set by admin who created or updated it.
+ // example: really cool list of neato pals
+ Title *string `form:"title" json:"title"`
+ // The type of domain permission subscription (allow, block).
+ // example: block
+ PermissionType *string `form:"permission_type" json:"permission_type"`
+ // URI to call in order to fetch the permissions list.
+ // example: https://www.example.org/blocklists/list1.csv
+ URI *string `form:"uri" json:"uri"`
+ // MIME content type to use when parsing the permissions list.
+ // example: text/csv
+ ContentType *string `form:"content_type" json:"content_type"`
+ // If true, domain permissions arising from this subscription will be
+ // created as drafts that must be approved by a moderator to take effect.
+ // If false, domain permissions from this subscription will come into force immediately.
+ // example: true
+ AsDraft *bool `form:"as_draft" json:"as_draft"`
+ // If true, this domain permission subscription will "adopt" domain permissions
+ // which already exist on the instance, and which meet the following conditions:
+ // 1) they have no subscription ID (ie., they're "orphaned") and 2) they are present
+ // in the subscribed list. Such orphaned domain permissions will be given this
+ // subscription's subscription ID value and be managed by this subscription.
+ AdoptOrphans *bool `form:"adopt_orphans" json:"adopt_orphans"`
+ // (Optional) username to set for basic auth when doing a fetch of URI.
+ // example: admin123
+ FetchUsername *string `form:"fetch_username" json:"fetch_username"`
+ // (Optional) password to set for basic auth when doing a fetch of URI.
+ // example: admin123
+ FetchPassword *string `form:"fetch_password" json:"fetch_password"`
+}