summaryrefslogtreecommitdiff
path: root/internal/api/model
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-10-04 15:24:19 +0200
committerLibravatar GitHub <noreply@github.com>2021-10-04 15:24:19 +0200
commite04b187702acb0c9908237a35b3a9857e2167b3f (patch)
tree29839b8d5bbc28d34aba759a48dd7b005f1444f5 /internal/api/model
parentFollow request auto approval (#259) (diff)
downloadgotosocial-e04b187702acb0c9908237a35b3a9857e2167b3f.tar.xz
Refactor/tidy (#261)
* tidy up streaming * cut down code duplication * test get followers/following * test streaming processor * fix some test models * add TimeMustParse * fix uri / url typo * make trace logging less verbose * make logging more consistent * disable quote on logging * remove context.Background * remove many extraneous mastodon references * regenerate swagger * don't log query on no rows result * log latency first for easier reading
Diffstat (limited to 'internal/api/model')
-rw-r--r--internal/api/model/conversation.go2
-rw-r--r--internal/api/model/error.go32
-rw-r--r--internal/api/model/featuredtag.go2
-rw-r--r--internal/api/model/filter.go2
-rw-r--r--internal/api/model/history.go2
-rw-r--r--internal/api/model/identityproof.go33
-rw-r--r--internal/api/model/list.go2
-rw-r--r--internal/api/model/marker.go4
-rw-r--r--internal/api/model/notification.go2
-rw-r--r--internal/api/model/oauth.go1
-rw-r--r--internal/api/model/preferences.go2
-rw-r--r--internal/api/model/pushsubscription.go2
-rw-r--r--internal/api/model/results.go2
-rw-r--r--internal/api/model/scheduledstatus.go4
-rw-r--r--internal/api/model/source.go1
-rw-r--r--internal/api/model/status.go2
-rw-r--r--internal/api/model/timeline.go18
17 files changed, 32 insertions, 81 deletions
diff --git a/internal/api/model/conversation.go b/internal/api/model/conversation.go
index b0568c17e..36da6aab5 100644
--- a/internal/api/model/conversation.go
+++ b/internal/api/model/conversation.go
@@ -18,7 +18,7 @@
package model
-// Conversation represents a conversation with "direct message" visibility. See https://docs.joinmastodon.org/entities/conversation/
+// Conversation represents a conversation with "direct message" visibility.
type Conversation struct {
// REQUIRED
diff --git a/internal/api/model/error.go b/internal/api/model/error.go
deleted file mode 100644
index f145d69f2..000000000
--- a/internal/api/model/error.go
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- GoToSocial
- Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-package model
-
-// Error represents an error message returned from the API. See https://docs.joinmastodon.org/entities/error/
-type Error struct {
- // REQUIRED
-
- // The error message.
- Error string `json:"error"`
-
- // OPTIONAL
-
- // A longer description of the error, mainly provided with the OAuth API.
- ErrorDescription string `json:"error_description"`
-}
diff --git a/internal/api/model/featuredtag.go b/internal/api/model/featuredtag.go
index 3df3fe4c9..a0ea536f9 100644
--- a/internal/api/model/featuredtag.go
+++ b/internal/api/model/featuredtag.go
@@ -18,7 +18,7 @@
package model
-// FeaturedTag represents a hashtag that is featured on a profile. See https://docs.joinmastodon.org/entities/featuredtag/
+// FeaturedTag represents a hashtag that is featured on a profile.
type FeaturedTag struct {
// The internal ID of the featured tag in the database.
ID string `json:"id"`
diff --git a/internal/api/model/filter.go b/internal/api/model/filter.go
index 519922ba3..2b0b05e5c 100644
--- a/internal/api/model/filter.go
+++ b/internal/api/model/filter.go
@@ -18,7 +18,7 @@
package model
-// Filter represents a user-defined filter for determining which statuses should not be shown to the user. See https://docs.joinmastodon.org/entities/filter/
+// Filter represents a user-defined filter for determining which statuses should not be shown to the user.
// If whole_word is true , client app should do:
// Define ‘word constituent character’ for your app. In the official implementation, it’s [A-Za-z0-9_] in JavaScript, and [[:word:]] in Ruby.
// Ruby uses the POSIX character class (Letter | Mark | Decimal_Number | Connector_Punctuation).
diff --git a/internal/api/model/history.go b/internal/api/model/history.go
index d8b4d6b4f..92b7d4d77 100644
--- a/internal/api/model/history.go
+++ b/internal/api/model/history.go
@@ -18,7 +18,7 @@
package model
-// History represents daily usage history of a hashtag. See https://docs.joinmastodon.org/entities/history/
+// History represents daily usage history of a hashtag.
type History struct {
// UNIX timestamp on midnight of the given day (string cast from integer).
Day string `json:"day"`
diff --git a/internal/api/model/identityproof.go b/internal/api/model/identityproof.go
deleted file mode 100644
index 400835fca..000000000
--- a/internal/api/model/identityproof.go
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- GoToSocial
- Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-package model
-
-// IdentityProof represents a proof from an external identity provider. See https://docs.joinmastodon.org/entities/identityproof/
-type IdentityProof struct {
- // The name of the identity provider.
- Provider string `json:"provider"`
- // The account owner's username on the identity provider's service.
- ProviderUsername string `json:"provider_username"`
- // The account owner's profile URL on the identity provider.
- ProfileURL string `json:"profile_url"`
- // A link to a statement of identity proof, hosted by the identity provider.
- ProofURL string `json:"proof_url"`
- // When the identity proof was last updated.
- UpdatedAt string `json:"updated_at"`
-}
diff --git a/internal/api/model/list.go b/internal/api/model/list.go
index 220cde59e..61dd199d0 100644
--- a/internal/api/model/list.go
+++ b/internal/api/model/list.go
@@ -18,7 +18,7 @@
package model
-// List represents a list of some users that the authenticated user follows. See https://docs.joinmastodon.org/entities/list/
+// List represents a list of some users that the authenticated user follows.
type List struct {
// The internal database ID of the list.
ID string `json:"id"`
diff --git a/internal/api/model/marker.go b/internal/api/model/marker.go
index 1e39f1516..7705f499b 100644
--- a/internal/api/model/marker.go
+++ b/internal/api/model/marker.go
@@ -18,7 +18,7 @@
package model
-// Marker represents the last read position within a user's timelines. See https://docs.joinmastodon.org/entities/marker/
+// Marker represents the last read position within a user's timelines.
type Marker struct {
// Information about the user's position in the home timeline.
Home *TimelineMarker `json:"home"`
@@ -26,7 +26,7 @@ type Marker struct {
Notifications *TimelineMarker `json:"notifications"`
}
-// TimelineMarker contains information about a user's progress through a specific timeline. See https://docs.joinmastodon.org/entities/marker/
+// TimelineMarker contains information about a user's progress through a specific timeline.
type TimelineMarker struct {
// The ID of the most recently viewed entity.
LastReadID string `json:"last_read_id"`
diff --git a/internal/api/model/notification.go b/internal/api/model/notification.go
index 2163251b4..2f6d8e595 100644
--- a/internal/api/model/notification.go
+++ b/internal/api/model/notification.go
@@ -18,7 +18,7 @@
package model
-// Notification represents a notification of an event relevant to the user. See https://docs.joinmastodon.org/entities/notification/
+// Notification represents a notification of an event relevant to the user.
type Notification struct {
// REQUIRED
diff --git a/internal/api/model/oauth.go b/internal/api/model/oauth.go
index 10c150474..7ff58daef 100644
--- a/internal/api/model/oauth.go
+++ b/internal/api/model/oauth.go
@@ -19,7 +19,6 @@
package model
// OAuthAuthorize represents a request sent to https://example.org/oauth/authorize
-// See here: https://docs.joinmastodon.org/methods/apps/oauth/
type OAuthAuthorize struct {
// Forces the user to re-login, which is necessary for authorizing with multiple accounts from the same instance.
ForceLogin string `form:"force_login" json:"force_login"`
diff --git a/internal/api/model/preferences.go b/internal/api/model/preferences.go
index 9e410091e..0ff50bbd7 100644
--- a/internal/api/model/preferences.go
+++ b/internal/api/model/preferences.go
@@ -18,7 +18,7 @@
package model
-// Preferences represents a user's preferences. See https://docs.joinmastodon.org/entities/preferences/
+// Preferences represents a user's preferences.
type Preferences struct {
// Default visibility for new posts.
// public = Public post
diff --git a/internal/api/model/pushsubscription.go b/internal/api/model/pushsubscription.go
index f34c63374..a8dd69b97 100644
--- a/internal/api/model/pushsubscription.go
+++ b/internal/api/model/pushsubscription.go
@@ -18,7 +18,7 @@
package model
-// PushSubscription represents a subscription to the push streaming server. See https://docs.joinmastodon.org/entities/pushsubscription/
+// PushSubscription represents a subscription to the push streaming server.
type PushSubscription struct {
// The id of the push subscription in the database.
ID string `json:"id"`
diff --git a/internal/api/model/results.go b/internal/api/model/results.go
index 1b2625a0d..266d2083b 100644
--- a/internal/api/model/results.go
+++ b/internal/api/model/results.go
@@ -18,7 +18,7 @@
package model
-// Results represents the results of a search. See https://docs.joinmastodon.org/entities/results/
+// Results represents the results of a search.
type Results struct {
// Accounts which match the given query
Accounts []Account `json:"accounts"`
diff --git a/internal/api/model/scheduledstatus.go b/internal/api/model/scheduledstatus.go
index deafd22aa..38f70d96a 100644
--- a/internal/api/model/scheduledstatus.go
+++ b/internal/api/model/scheduledstatus.go
@@ -18,7 +18,7 @@
package model
-// ScheduledStatus represents a status that will be published at a future scheduled date. See https://docs.joinmastodon.org/entities/scheduledstatus/
+// ScheduledStatus represents a status that will be published at a future scheduled date.
type ScheduledStatus struct {
ID string `json:"id"`
ScheduledAt string `json:"scheduled_at"`
@@ -26,7 +26,7 @@ type ScheduledStatus struct {
MediaAttachments []Attachment `json:"media_attachments"`
}
-// StatusParams represents parameters for a scheduled status. See https://docs.joinmastodon.org/entities/scheduledstatus/
+// StatusParams represents parameters for a scheduled status.
type StatusParams struct {
Text string `json:"text"`
InReplyToID string `json:"in_reply_to_id,omitempty"`
diff --git a/internal/api/model/source.go b/internal/api/model/source.go
index 441af71de..9e429a3ca 100644
--- a/internal/api/model/source.go
+++ b/internal/api/model/source.go
@@ -20,7 +20,6 @@ package model
// Source represents display or publishing preferences of user's own account.
// Returned as an additional entity when verifying and updated credentials, as an attribute of Account.
-// See https://docs.joinmastodon.org/entities/source/
type Source struct {
// The default post privacy to be used for new statuses.
// public = Public post
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
index 8be1a4870..ff0cd2e80 100644
--- a/internal/api/model/status.go
+++ b/internal/api/model/status.go
@@ -177,7 +177,7 @@ const (
VisibilityDirect Visibility = "direct"
)
-// AdvancedStatusCreateForm wraps the mastodon status create form along with the GTS advanced
+// AdvancedStatusCreateForm wraps the mastodon-compatible status create form along with the GTS advanced
// visibility settings.
//
// swagger:model advancedStatusCreateForm
diff --git a/internal/api/model/timeline.go b/internal/api/model/timeline.go
index 52d920879..de50c16cb 100644
--- a/internal/api/model/timeline.go
+++ b/internal/api/model/timeline.go
@@ -1,3 +1,21 @@
+/*
+ GoToSocial
+ Copyright (C) 2021 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
package model
// StatusTimelineResponse wraps a slice of statuses, ready to be serialized, along with the Link