├── .github
├── dependabot.yml
└── workflows
│ ├── codeql-analysis.yml
│ └── go.yml
├── .gitignore
├── LICENSE
├── README.md
├── api.go
├── go.mod
├── interfaces.go
├── meta
└── banner.jpg
├── object
├── account.go
├── accountField.go
├── accountSource.go
├── adminAccount.go
├── adminCanonicalEmailBlock.go
├── adminCohort.go
├── adminDimension.go
├── adminDomainAllow.go
├── adminDomainBlock.go
├── adminEmailDomainBlock.go
├── adminIP.go
├── adminIPBlock.go
├── adminMeasure.go
├── adminReport.go
├── announcement.go
├── announcementAccount.go
├── announcementStatus.go
├── application.go
├── context.go
├── conversation.go
├── customEmoji.go
├── domainBlock.go
├── error.go
├── extendedDescription.go
├── familiarFollowers.go
├── featuredTag.go
├── filter.go
├── filterKeyword.go
├── filterResult.go
├── filterStatus.go
├── identityProof.go
├── instance.go
├── instanceConfiguration.go
├── instanceContact.go
├── instanceRegistration.go
├── instanceThumbnail.go
├── instanceUsage.go
├── instance_v1.go
├── list.go
├── marker.go
├── mediaAttachment.go
├── notification.go
├── poll.go
├── previewCard.go
├── reaction.go
├── relatioinship.go
├── report.go
├── rule.go
├── scheduledStatus.go
├── search.go
├── status.go
├── statusApplication.go
├── statusEdit.go
├── statusMention.go
├── statusSource.go
├── statusTag.go
├── suggestion.go
├── tag.go
├── tagHistory.go
├── token.go
├── translation.go
├── v1_filter.go
└── webPushSubscription.go
├── pageInfo.go
├── route
├── accounts.go
├── admin-.go
├── admin-accounts.go
├── admin-canonical-email-blocks.go
├── admin-dimensions.go
├── admin-domain-allows.go
├── admin-domain-blocks.go
├── admin-email-blocks.go
├── admin-ip-blocks.go
├── admin-measures.go
├── admin-reports.go
├── admin-retention.go
├── admin-trends.go
├── announcements.go
├── apps.go
├── blocks.go
├── bookmarks.go
├── conversations.go
├── custom-emojis.go
├── directory.go
├── domain-blocks.go
├── emails.go
├── endorsements.go
├── favourites.go
├── featured-tags.go
├── filters.go
├── follow-requests.go
├── followed-tags.go
├── instance.go
├── lists.go
├── markers.go
├── media.go
├── mutes.go
├── notifications.go
├── oauth.go
├── oembed.go
├── polls.go
├── preferences.go
├── profile.go
├── push.go
├── reports.go
├── scheduled-statuses.go
├── search.go
├── statuses.go
├── streaming.go
├── suggestions.go
├── tags.go
├── timelines.go
└── trends.go
├── scope
├── accounts.go
├── admin-.go
├── admin-accounts.go
├── admin-canonical-email-blocks.go
├── admin-dimensions.go
├── admin-domain-allows.go
├── admin-domain-blocks.go
├── admin-email-blocks.go
├── admin-ip-blocks.go
├── admin-measures.go
├── admin-reports.go
├── admin-retention.go
├── admin-trends.go
├── announcements.go
├── apps.go
├── blocks.go
├── bookmarks.go
├── conversations.go
├── custom-emojis.go
├── directory.go
├── domain-blocks.go
├── emails.go
├── endorsements.go
├── favourites.go
├── featured-tags.go
├── filters.go
├── follow-requests.go
├── followed-tags.go
├── instance.go
├── lists.go
├── markers.go
├── media.go
├── mutes.go
├── notifications.go
├── oauth.go
├── oembed.go
├── polls.go
├── preferences.go
├── profile.go
├── push.go
├── reports.go
├── scheduled-statuses.go
├── scope.go
├── search.go
├── statuses.go
├── streaming.go
├── suggestions.go
├── tags.go
├── timelines.go
└── trends.go
└── txn
├── accounts.go
├── admin-.go
├── admin-accounts.go
├── admin-canonical-email-blocks.go
├── admin-dimensions.go
├── admin-domain-allows.go
├── admin-domain-blocks.go
├── admin-email-blocks.go
├── admin-ip-blocks.go
├── admin-measures.go
├── admin-reports.go
├── admin-retention.go
├── admin-trends.go
├── announcements.go
├── apps.go
├── blocks.go
├── bookmarks.go
├── conversations.go
├── custom-emojis.go
├── directory.go
├── domain-blocks.go
├── emails.go
├── endorsements.go
├── favourites.go
├── featured-tags.go
├── filters.go
├── follow-requests.go
├── followed-tags.go
├── instance.go
├── lists.go
├── markers.go
├── media.go
├── mutes.go
├── notifications.go
├── oauth.go
├── oembed.go
├── polls.go
├── preferences.go
├── profile.go
├── push.go
├── queryPage.go
├── reports.go
├── scheduled-statuses.go
├── search.go
├── statuses.go
├── streaming.go
├── suggestions.go
├── tags.go
├── timelines.go
└── trends.go
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "gomod" # See documentation for possible values
9 | directory: "/" # Location of package manifests
10 | target-branch: "main"
11 | schedule:
12 | interval: "daily"
13 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | # For most projects, this workflow file will not need changing; you simply need
2 | # to commit it to your repository.
3 | #
4 | # You may wish to alter this file to override the set of languages analyzed,
5 | # or to provide custom queries or build logic.
6 | #
7 | # ******** NOTE ********
8 | # We have attempted to detect the languages in your repository. Please check
9 | # the `language` matrix defined below to confirm you have the correct set of
10 | # supported CodeQL languages.
11 | #
12 | name: "CodeQL"
13 |
14 | on:
15 | push:
16 | branches: [ main ]
17 | pull_request:
18 | # The branches below must be a subset of the branches above
19 | branches: [ main ]
20 | schedule:
21 | - cron: '27 14 * * 1'
22 |
23 | jobs:
24 | analyze:
25 | name: Analyze
26 | runs-on: ubuntu-latest
27 | permissions:
28 | actions: read
29 | contents: read
30 | security-events: write
31 |
32 | strategy:
33 | fail-fast: false
34 | matrix:
35 | language: [ 'go' ]
36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37 | # Learn more about CodeQL language support at https://git.io/codeql-language-support
38 |
39 | steps:
40 | - name: Checkout repository
41 | uses: actions/checkout@v4
42 |
43 | # Initializes the CodeQL tools for scanning.
44 | - name: Initialize CodeQL
45 | uses: github/codeql-action/init@v3
46 | with:
47 | languages: ${{ matrix.language }}
48 | # If you wish to specify custom queries, you can do so here or in a config file.
49 | # By default, queries listed here will override any specified in a config file.
50 | # Prefix the list here with "+" to use these queries and those in the config file.
51 | # queries: ./path/to/local/query, your-org/your-repo/queries@main
52 |
53 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54 | # If this step fails, then you should remove it and run the build manually (see below)
55 | - name: Autobuild
56 | uses: github/codeql-action/autobuild@v3
57 |
58 | # ℹ️ Command-line programs to run using the OS shell.
59 | # 📚 https://git.io/JvXDl
60 |
61 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62 | # and modify them (or add more) to build your code if your project
63 | # uses a compiled language
64 |
65 | #- run: |
66 | # make bootstrap
67 | # make release
68 |
69 | - name: Perform CodeQL Analysis
70 | uses: github/codeql-action/analyze@v3
71 |
--------------------------------------------------------------------------------
/.github/workflows/go.yml:
--------------------------------------------------------------------------------
1 | name: Go
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | jobs:
10 |
11 | build:
12 | runs-on: ubuntu-latest
13 | steps:
14 | - uses: actions/checkout@v4
15 |
16 | - name: Set up Go
17 | uses: actions/setup-go@v5
18 | with:
19 | go-version: '1.23'
20 |
21 | - name: Test
22 | run: go test -race -coverprofile=coverage.txt -covermode=atomic -v ./...
23 |
24 | - name: Report Code Coverage
25 | uses: codecov/codecov-action@v5
26 | with:
27 | fail_ci_if_error: true
28 | flags: unittests
29 | token: ${{ secrets.CODECOV_TOKEN }}
30 | verbose: true
31 |
32 | - name: GolangCI-Lint
33 | uses: golangci/golangci-lint-action@v6
34 | with:
35 | # Require: The version of golangci-lint to use.
36 | # When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
37 | # When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
38 | version: latest
39 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # If you prefer the allow list template instead of the deny list, see community template:
2 | # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3 | #
4 | # Binaries for programs and plugins
5 | *.exe
6 | *.exe~
7 | *.dll
8 | *.so
9 | *.dylib
10 |
11 | # Test binary, built with `go test -c`
12 | *.test
13 |
14 | # Output of the go coverage tool, specifically when used with LiteIDE
15 | *.out
16 |
17 | # Dependency directories (remove the comment below to include it)
18 | # vendor/
19 |
20 | # Go workspace file
21 | go.work
22 | .DS_Store
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # toot
2 |
3 |
4 |
5 | [](http://pkg.go.dev/github.com/benpate/toot)
6 | [](https://github.com/benpate/toot/releases)
7 | [](https://github.com/benpate/toot/actions/workflows/go.yml)
8 | [](https://goreportcard.com/report/github.com/benpate/toot)
9 | [](https://codecov.io/gh/benpate/toot)
10 |
11 | ## Mastodon API Server for Go
12 |
13 | Toot implements a REST API server that matches the [Mastodon REST API](https://docs.joinmastodon.org/api/). It plugs into your existing application seamlessly (using [router adapter](#routers)) making your Go application accessible to any Mastodon-compatible client app.
14 |
15 | ## Why would I do this?
16 |
17 | Most client apps use the Mastodon REST API instead of the official ActivityPub Client-to-Server (C2S) API. However, the Mastodon API is very large, with a huge number of routes, handlers, and scopes required to support. Toot provides a consistent catalog of all of these values, and handles lots of busywork -- matching the specific routes, authorization, parameters, and results that Mastodon requires -- so that you can write happly little API handlers like this:
18 |
19 | ```go
20 | api.PostStatus = func(authorization model.Authorization, values txn.PostStatus) (object.Status, error) {
21 | // Do the thing that:
22 | // 1) creates a new `status`
23 | // 2) writes it to the database
24 | // 3) returns the value to the caller
25 | }
26 |
27 | // Once your handlers are defined, connect Toot to your router like this:
28 | e := echo.New()
29 | tootecho.Register(e, api)
30 | ```
31 |
32 | ## Routers
33 |
34 | Currently, I have only written a connector to the echo Router (because that's what I'm using for my own applications). It should, however, be a simple project to write adapters for other routers, such as [Chi](https://github.com/go-chi/chi), [Gin](https://github.com/gin-gonic/gin), [Fiber](https://github.com/gofiber/fiber), or others. If you'd like to use Toot with a different router, please get in touch and let's work together.
35 |
36 | ## Project Status (Alpha?)
37 |
38 | This project is still in early alpha testing, as I continue filling out the Mastodon support in [Emissary](https://emissary.dev). Some interfaces may change in the future if I run into trouble making things work with this reference implementation.
39 |
40 | However, at this point, feedback from other developers will be immensely helpful in making Tooth a useful tool for the Go community. Please feel free to open issues, or submit pull requests.
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/benpate/toot
2 |
3 | go 1.20
4 |
--------------------------------------------------------------------------------
/interfaces.go:
--------------------------------------------------------------------------------
1 | package toot
2 |
3 | import "net/http"
4 |
5 | // APIFunc represents an API method. It can return either a single result or a paged result.
6 | type APIFunc[AuthToken ScopesGetter, Input any, Output any] interface {
7 | APIFunc_SingleResult[AuthToken, Input, Output] | APIFunc_PagedResult[AuthToken, Input, Output]
8 | }
9 |
10 | // APIFunc_SingleResult represents an API method that returns a single result.
11 | type APIFunc_SingleResult[AuthToken ScopesGetter, Input any, Output any] func(AuthToken, Input) (Output, error)
12 |
13 | // APIFunc_PagedResult represents an API method that returns a many results with pagination data.
14 | type APIFunc_PagedResult[AuthToken ScopesGetter, Input any, Output any] func(AuthToken, Input) (Output, PageInfo, error)
15 |
16 | // Authorizer represents a function that can authorize an HTTP request.
17 | // If the Bearer token is valid, then it returns an AuthToken object (which is also a ScopesGetter).
18 | // If the request is not authorized, then it returns an error.
19 | type Authorizer[AuthToken ScopesGetter] func(*http.Request) (AuthToken, error)
20 |
21 | // ScopesGetter represents an object that can return a list of Scopes that it includes.
22 | // It is used as the base for AuthTokens so that we can verify allowed scopes separately from the
23 | // custom Authorizer code.
24 | type ScopesGetter interface {
25 | Scopes() []string
26 | }
27 |
--------------------------------------------------------------------------------
/meta/banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benpate/toot/fe4b0165711bf9fcfab6c9724eff1d62f592fedd/meta/banner.jpg
--------------------------------------------------------------------------------
/object/account.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Account represents a user of Mastodon and their associated profile.
4 | // https://docs.joinmastodon.org/entities/Account/
5 | type Account struct {
6 | ID string `json:"id"` // The account id.
7 | Username string `json:"username"` // The username of the account, not including domain.
8 | Acct string `json:"acct"` // The Webfinger account URI. Equal to username for local users, or username@domain for remote users.
9 | URL string `json:"url"` // The location of the user’s profile page.
10 | DisplayName string `json:"display_name"` // The profile's display name.
11 | Note string `json:"note"` // The profile’s bio or description.
12 | Avatar string `json:"avatar"` // An image icon that is shown next to statuses and in the profile.
13 | AvatarStatic string `json:"avatar_static"` // A static version of the avatar. Equal to avatar if its value is a static image; different if avatar is an animated GIF.
14 | Header string `json:"header"` // An image banner that is shown above the profile and in profile cards.
15 | HeaderStatic string `json:"header_static"` // A static version of the header. Equal to header if its value is a static image; different if header is an animated GIF.
16 | Locked bool `json:"locked"` // Whether the account manually approves follow requests.
17 | Fields []AccountField `json:"fields"` // Metadata defined by the instance.
18 | Emojis []CustomEmoji `json:"emojis"` // Custom emoji entities to be used when rendering the profile.
19 | Bot bool `json:"bot"` // Indicates that the account may perform automated actions, may not be monitored, or identifies as a robot.
20 | Group bool `json:"group"` // Indicates that the account represents a Group actor.
21 | Discoverable bool `json:"discoverable"` // Whether the account has opted into discovery features such as the profile directory.
22 | NoIndex bool `json:"noindex"` // Whether the local user has opted out of being indexed by search engines.
23 | Moved *Account `json:"moved,omitempty"` // Indicates that the profile is currently inactive and that its user has moved to a new account.
24 | Suspended bool `json:"suspended,omitempty"` // An extra attribute returned only when an account is suspended.
25 | Limited bool `json:"limited,omitempty"` // An extra attribute returned only when an account is silenced. If true, indicates that the account should be hidden behind a warning screen.
26 | CreatedAt string `json:"created_at"` // When the account was created. (ISO 8601 Datetime)
27 | LastStatusAt string `json:"last_status_at"` // When the most recent status was posted. (ISO 8601 Datetime) or null if no statuses.
28 | StatusesCount int `json:"statuses_count"` // How many statuses are attached to this account.
29 | FollowersCount int `json:"followers_count"` // The reported followers of this profile.
30 | FollowingCount int `json:"following_count"` // The reported follows of this profile.
31 |
32 | // Optional values for special kinds of accounts
33 | Source *AccountSource `json:"source,omitempty"` // An extra attribute that contains source values to be used with API methods that verify credentials and update credentials.
34 | MuteExpiresAt string `json:"mute_expires_at,omitempty"` // When a timed mute will expire, if applicable. (ISO 8601 Datetime), or null if the mute is indefinite
35 | }
36 |
--------------------------------------------------------------------------------
/object/accountField.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Account/#Field
4 | type AccountField struct {
5 | Name string `json:"name"` // The key of a given field’s key-value pair.
6 | Value string `json:"value"` // The value associated with the name key.
7 | VerifiedAt string `json:"verified_at,omitempty"` // Timestamp of when the server verified a URL value for a rel=“me” link. NULLABLE String (ISO 8601 Datetime) if value is a verified URL. Otherwise, null.
8 | }
9 |
--------------------------------------------------------------------------------
/object/accountSource.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Account/#source
4 | type AccountSource struct {
5 | Note string `json:"note"` // Profile bio, in plain-text instead of in HTML.
6 | Fields []AccountField `json:"fields"` // Metadata about the account.
7 | Privacy string `json:"privacy"` // The default post privacy to be used for new statuses. [public | unlisted | private | direct]
8 | Sensitive bool `json:"sensitive"` // Whether new statuses should be marked sensitive by default.
9 | Language string `json:"language"` // The default posting language for new statuses. (ISO 639-1 language two-letter code) or empty string
10 | FollowRequestsCount int `json:"follow_requests_count"` // The number of pending follow requests.
11 | }
12 |
--------------------------------------------------------------------------------
/object/adminAccount.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_Account/
4 | type AdminAccount struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminCanonicalEmailBlock.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_CanonicalEmailBlock/
4 | type AdminCanonicalEmailBlock struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminCohort.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_Cohort/
4 | type AdminCohort struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminDimension.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_Dimension/
4 | type AdminDimension struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminDomainAllow.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_DomainAllow/
4 | type AdminDomainAllow struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminDomainBlock.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_DomainBlock/
4 | type AdminDomainBlock struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminEmailDomainBlock.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_EmailDomainBlock/
4 | type AdminEmailDomainBlock struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminIP.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_Ip/
4 | type AdminIP struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminIPBlock.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_IpBlock/
4 | type AdminIPBlock struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminMeasure.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Admin_Measure/
4 | type AdminMeasure struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/adminReport.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Admin::Report represents admin-level information about a filed report.
4 | // https://docs.joinmastodon.org/entities/Admin_Report/
5 | type AdminReport struct {
6 | ID string `json:"id"` // The ID of the report in the database.
7 | ActionTaken bool `json:"action_taken"` // Whether an action was taken to resolve this report.
8 | ActionTakenAt string `json:"action_taken_at"` // When an action was taken, if this report is currently resolved. (ISO 8601 Datetime)
9 | Category string `json:"category"` // The category under which the report is classified. [spam | violation | other]
10 | Comment string `json:"comment"` // An optional reason for reporting.
11 | Forwarded bool `json:"forwarded"` // Whether a report was forwarded to a remote instance.
12 | CreatedAt string `json:"created_at"` // The time the report was filed. (ISO 8601 Datetime)
13 | UpdatedAt string `json:"updated_at"` // The time of last action on this report. (ISO 8601 Datetime)
14 | Account AdminAccount `json:"account"` // The account which filed the report.
15 | TargetAccount AdminAccount `json:"target_account"` // The account being reported.
16 | AssignedAccount *AdminAccount `json:"assigned_account,omitempty"` // The account of the moderator assigned to this report.
17 | ActionTakenByAccount *AdminAccount `json:"action_taken_by_account,omitempty"` // The account of the moderator who handled the report.
18 | Statuses []Status `json:"statuses"` // Statuses attached to the report, for context.
19 | Rules []Rule `json:"rules"` // Rules attached to the report, for context.
20 | }
21 |
--------------------------------------------------------------------------------
/object/announcement.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Announcement represents an announcement set by an administrator.
4 | // https://docs.joinmastodon.org/entities/Announcement/
5 | type Announcement struct {
6 | ID string `json:"id"` // The ID of the announcement in the database. (cast from an integer, but not guaranteed to be a number)
7 | Content string `json:"content"` // The text of the announcement. (HTML)
8 | StartsAt string `json:"starts_at"` // When the announcement will start. (ISO 8601 Datetime) or null
9 | EndsAt string `json:"ends_at"` // When the announcement will end. (ISO 8601 Datetime) or null
10 | Published bool `json:"published"` // Whether the announcement is currently active.
11 | AllDay bool `json:"all_day"` // Whether the announcement should start and end on dates only instead of datetimes. Will be false if there is no starts_at or ends_at time.
12 | PublishedAt string `json:"published_at"` // When the announcement was published. (ISO 8601 Datetime)
13 | UpdatedAt string `json:"updated_at"` // When the announcement was last updated. (ISO 8601 Datetime)
14 | Read bool `json:"read,omitempty"` // Whether the announcement has been read by the current user.
15 | Mentions []AnnouncementAccount `json:"mentions"` // Accounts mentioned in the announcement text
16 | Statuses []AnnouncementStatus `json:"statuses"` // Statuses linked in the announcement text.
17 | Tags []StatusTag `json:"tags"` // Tags linked in the announcement text.
18 | Emojis []CustomEmoji `json:"emojis"` // Custom emoji used in the announcement text.
19 | Reactions []Reaction
20 | }
21 |
--------------------------------------------------------------------------------
/object/announcementAccount.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Announcement/#Account
4 | type AnnouncementAccount struct {
5 | ID string `json:"id"` // The account ID of the mentioned user.
6 | Username string `json:"username"` // The username of the mentioned user.
7 | URL string `json:"url"` // The location of the mentioned user’s profile.
8 | Acct string `json:"acct"` // The webfinger acct: URI of the mentioned user. Equivalent to username for local users, or username@domain for remote users.
9 | }
10 |
--------------------------------------------------------------------------------
/object/announcementStatus.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Announcement/#Status
4 | type AnnouncementStatus struct {
5 | ID string `json:"id"` // The ID of an attached Status in the database.
6 | URL string `json:"url"` // The URL of an attached Status.
7 | }
8 |
--------------------------------------------------------------------------------
/object/application.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Application represents an application that interfaces with the REST API to access accounts or post statuses.
4 | // https://docs.joinmastodon.org/entities/Application/
5 | type Application struct {
6 | Name string `json:"name"` // The name of your application.
7 | Website string `json:"website,omitempty"` // The website associated with your application.
8 | VapidKey string `json:"vapid_key,omitempty"` // Used for Push Streaming API. Returned with POST /api/v1/apps. Equivalent to WebPushSubscription#server_key
9 | ClientID string `json:"client_id,omitempty"` // Client ID key, to be used for obtaining OAuth tokens
10 | ClientSecret string `json:"client_secret,omitempty"` // Client secret key, to be used for obtaining OAuth tokens
11 | }
12 |
--------------------------------------------------------------------------------
/object/context.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Context represents the tree around a given status. Used for reconstructing threads of statuses.
4 | // https://docs.joinmastodon.org/entities/Context/
5 | type Context struct {
6 | Ancestors []Status `json:"ancestors"` // Parents in the thread.
7 | Descendants []Status `json:"descendants"` // Children in the thread.
8 | }
9 |
--------------------------------------------------------------------------------
/object/conversation.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Conversation represents a conversation with "direct message" visibility.
4 | // https://docs.joinmastodon.org/entities/Conversation/
5 | type Conversation struct {
6 | ID string `json:"id"` // The ID of the conversation in the database.
7 | Unread bool `json:"unread"` // Is the conversation currently marked as unread?
8 | Accounts []Account `json:"accounts"` // Participants in the conversation.
9 | LastStatus Status `json:"last_status,omitempty"` // The last status in the conversation.
10 | }
11 |
--------------------------------------------------------------------------------
/object/customEmoji.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // CustomEmoji represents a custom emoji.
4 | // https://docs.joinmastodon.org/entities/CustomEmoji/
5 | type CustomEmoji struct {
6 | ShortCode string `json:"shortcode"` // The name of the custom emoji.
7 | URL string `json:"url"` // A link to the custom emoji.
8 | StaticURL string `json:"static_url"` // A link to a static copy of the custom emoji.
9 | VisibleInPicker bool `json:"visible_in_picker"` // Whether this Emoji should be visible in the picker or unlisted.
10 | Category string `json:"category"` // Used for sorting custom emoji in the picker.
11 | }
12 |
--------------------------------------------------------------------------------
/object/domainBlock.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // DomainBlock represents a domain that is blocked by the instance.
4 | // https://docs.joinmastodon.org/entities/DomainBlock/
5 | type DomainBlock struct {
6 | Domain string `json:"domain"` // The domain which is blocked. This may be obfuscated or partially censored.
7 | Digest string `json:"digest"` // The SHA256 hash digest of the domain string.
8 | Severity string `json:"severity"` // The level to which the domain is blocked. [silence | suspend]
9 | Comment string `json:"comment,omitempty"` // An optional reason for the domain block.
10 | }
11 |
12 | // Users from this domain will be hidden from timelines, threads, and notifications (unless you follow the user).
13 | const DomainBlockSeveritySilence = "silence"
14 |
15 | // Incoming messages from this domain will be rejected and dropped entirely.
16 | const DomainBlockSeveritySuspend = "suspend"
17 |
--------------------------------------------------------------------------------
/object/error.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Error represents an error message.
4 | // https://docs.joinmastodon.org/entities/Error/
5 | type Error struct {
6 | Error int `json:"error"` // The error message.
7 | ErrorDescription string `json:"error_description"` // A longer description of the error, mainly provided with the OAuth API.
8 | }
9 |
--------------------------------------------------------------------------------
/object/extendedDescription.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // ExtendedDescription represents an extended description for the instance, to be shown on its about page.
4 | // https://docs.joinmastodon.org/entities/ExtendedDescription/
5 | type ExtendedDescription struct {
6 | UpdatedAt string `json:"updated_at"` // A timestamp of when the extended description was last updated. (ISO 8601 Datetime)
7 | Content string `json:"content"` // The rendered HTML content of the extended description.
8 | }
9 |
--------------------------------------------------------------------------------
/object/familiarFollowers.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // FamiliarFollowers represents a subset of your follows who also follow some other user.
4 | // https://docs.joinmastodon.org/entities/FamiliarFollowers/
5 | type FamiliarFollowers []FamiliarFollower
6 |
7 | // https://docs.joinmastodon.org/entities/FamiliarFollowers/#attributes
8 | type FamiliarFollower struct {
9 | ID string `json:"id"` // The ID of the Account in the database.
10 | Accounts []Account `json:"accounts"` // Accounts you follow that also follow this account.
11 | }
12 |
--------------------------------------------------------------------------------
/object/featuredTag.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // FeaturedTag represents a hashtag that is featured on a profile.
4 | // https://docs.joinmastodon.org/entities/FeaturedTag/
5 | type FeaturedTag struct {
6 | ID string `json:"id"` // The internal ID of the featured tag in the database.
7 | Name string `json:"name"` // The name of the hashtag being featured.
8 | URL string `json:"url"` // A link to all statuses by a user that contain this hashtag.
9 | StatusesCount int `json:"statuses_count"` // The number of authored statuses containing this hashtag.
10 | LastStatusAt string `json:"last_status_at"` // The timestamp of the last authored status containing this hashtag. (ISO 8601 Datetime)
11 | }
12 |
--------------------------------------------------------------------------------
/object/filter.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Filter represents a user-defined filter for determining which statuses should not be shown to the user.
4 | // https://docs.joinmastodon.org/entities/Filter/
5 | type Filter struct {
6 | ID string `json:"id"` // The ID of the Filter in the database.
7 | Title string `json:"title"` // A title given by the user to name the filter.
8 | Context []string `json:"context"` // The contexts in which the filter should be applied. [notifications | public | thread | account]
9 | ExpiresAt string `json:"expires_at"` // When the filter should no longer be applied. (ISO 8601 Datetime)
10 | FilterAction string `json:"filter_action"` // The action to be taken when a status matches this filter. [warn | hide]
11 | Keywords string `json:"keywords"` // The keywords grouped under this filter.
12 | Statuses []FilterStatus `json:"statuses"` // The statuses grouped under this filter.
13 | }
14 |
--------------------------------------------------------------------------------
/object/filterKeyword.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // FilterKeyword represents a keyword that, if matched, should cause the filter action to be taken.
4 | // https://docs.joinmastodon.org/entities/FilterKeyword/
5 | type FilterKeyword struct {
6 | ID string `json:"id"` // The ID of the FilterKeyword in the database.
7 | Keyword string `json:"keyword"` // The phrase to be matched against.
8 | WholeWord bool `json:"whole_word"` // Should the filter consider word boundaries? See implementation guidelines for filters. https://docs.joinmastodon.org/api/guidelines/#filters
9 | }
10 |
--------------------------------------------------------------------------------
/object/filterResult.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/FilterResult/
4 | type FilterResult struct {
5 | Filter Filter `json:"filter"` // The filter that was matched.
6 | KeywordMatches []string `json:"keyword_matches,omitempty"` // The keyword within the filter that was matched.
7 | StatusMatches []string `json:"status_matches,omitempty"` // The status ID within the filter that was matched.
8 | }
9 |
--------------------------------------------------------------------------------
/object/filterStatus.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // FilterStatus represents a status ID that, if matched, should cause the filter action to be taken.
4 | // https://docs.joinmastodon.org/entities/FilterStatus/
5 | type FilterStatus struct {
6 | ID string `json:"id"` // The ID of the FilterStatus in the database.
7 | StatusID string `json:"status_id"` // The ID of the Status that will be filtered.
8 | }
9 |
--------------------------------------------------------------------------------
/object/identityProof.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // IdentityProof represents a proof from an external identity provider.
4 | // https://docs.joinmastodon.org/entities/IdentityProof/
5 | type IdentityProof struct {
6 | Provider string `json:"provider"` // The name of the identity provider.
7 | ProviderUsername string `json:"provider_username"` // The account owner’s username on the identity provider’s service.
8 | UpdatedAt string `json:"updated_at"` // When the identity proof was last updated. (ISO 8601 Datetime)
9 | ProofURL string `json:"proof_url"` // A link to a statement of identity proof, hosted by the identity provider.
10 | ProfileURL string `json:"profile_url"` // The account owner’s profile URL on the identity provider.
11 | }
12 |
--------------------------------------------------------------------------------
/object/instance.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Instance represents the software instance of Mastodon running on this domain.
4 | // https://docs.joinmastodon.org/entities/Instance/
5 | type Instance struct {
6 | Domain string `json:"domain"` // The domain name of the instance.
7 | Title string `json:"title"` // The title of the website.
8 | Version string `json:"version"` // The version of Mastodon installed on the instance.
9 | SourceURL string `json:"source_url"` // The URL for the source code of the software running on this instance, in keeping with AGPL license requirements.
10 | Description string `json:"description"` // A short, plain-text description defined by the admin.
11 | Usage InstanceUsage `json:"usage"` // Usage data for this instance.
12 | Thumbnail InstanceThumbnail `json:"thumbnail"` // An image used to represent this instance.
13 | Languages []string `json:"languages"` // Primary languages of the website and its staff. (ISO 639-1 two letter code)
14 | Configuration InstanceConfiguration `json:"configuration"` // Configured values and limits for this website.
15 | Registrations InstanceRegistrations `json:"registrations"` // Information about registering for this website.
16 | Contact InstanceContact `json:"contact"` // Hints related to contacting a representative of the website.
17 | Rules []Rule `json:"rules"` // An itemized list of rules for this website.
18 | }
19 |
--------------------------------------------------------------------------------
/object/instanceConfiguration.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // InstanceConfiguration contains configured values and limits for this website.
4 | // https://docs.joinmastodon.org/entities/Instance/#configuration
5 | type InstanceConfiguration struct {
6 | URLs InstanceConfigurationURLs `json:"urls"` // URLs of interest for clients apps.
7 | Accounts InstanceConfigurationAccounts `json:"accounts"`
8 | }
9 |
10 | // URLs of interest for clients apps.
11 | // https://docs.joinmastodon.org/entities/Instance/#urls
12 | type InstanceConfigurationURLs struct {
13 | StreamingAPI string `json:"streaming_api"` // The Websockets URL for connecting to the streaming API.
14 | }
15 |
16 | // Limits related to accounts.
17 | // https://docs.joinmastodon.org/entities/Instance/#accounts
18 | type InstanceConfigurationAccounts struct {
19 | MaxFeaturedTags int `json:"max_featured_tags"` // The maximum number of featured tags allowed for each account.
20 | }
21 |
22 | // Limits related to authoring statuses.
23 | // https://docs.joinmastodon.org/entities/Instance/#statuses
24 | type InstanceConfigurationStatus struct {
25 | MaxMediaAttachments int `json:"max_media_attachments"` // The maximum number of media attachments that can be added to a status.
26 | CharactersReservedPerURL int `json:"characters_reserved_per_media"` // Each URL in a status will be assumed to be exactly this many characters.
27 | }
28 |
29 | // Hints for which attachments will be accepted.
30 | // https://docs.joinmastodon.org/entities/Instance/#media_attachments
31 | type InstanceConfigurationMediaAttachments struct {
32 | SupportedMimeTypes []string `json:"mime_types"` // Contains MIME types that can be uploaded.
33 | ImageSizeLimit int `json:"image_size_limit"` // The maximum size of any uploaded image, in bytes.
34 | ImageMatrixLimit int `json:"image_matrix_limit"` // The maximum number of pixels (width times height) for image uploads.
35 | VideoSizeLimit int `json:"video_size_limit"` // The maximum size of any uploaded video, in bytes.
36 | VideoFrameLimit int `json:"video_frame_limit"` // The maximum number of pixels (width times height) for video uploads.
37 | }
38 |
39 | // Limits related to polls.
40 | //
41 | // https://docs.joinmastodon.org/entities/Instance/#polls
42 | type InstanceConfigurationPolls struct {
43 | MaxOptions int `json:"max_options"` // Each poll is allowed to have up to this many options.
44 | MinExpiration int `json:"min_expiration"` // The shortest allowed poll duration, in seconds.
45 | MaxExpiration int `json:"max_expiration"` // The longest allowed poll duration, in seconds.
46 | }
47 |
48 | // Hints related to translation.
49 | // https://docs.joinmastodon.org/entities/Instance/#translation
50 | type InstanceConfigurationTranslation struct {
51 | Enabled bool `json:"enabled"` // Whether the Translations API is available on this instance.
52 | }
53 |
--------------------------------------------------------------------------------
/object/instanceContact.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Hints related to contacting a representative of the website.
4 | // https://docs.joinmastodon.org/entities/Instance/#contact
5 | type InstanceContact struct {
6 | Email string `json:"email"` // An email address that can be messaged regarding inquiries or issues.
7 | Account Account `json:"account"` // An account that can be contacted natively over the network regarding inquiries or issues.
8 | }
9 |
--------------------------------------------------------------------------------
/object/instanceRegistration.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Information about registering for this website.
4 | // https://docs.joinmastodon.org/entities/Instance/#registrations
5 | type InstanceRegistrations struct {
6 | Enabled bool `json:"enabled"` // Whether registrations are enabled.
7 | ApprovalRequired bool `json:"approval_required"` // Whether registrations require moderator approval.
8 | Message string `json:"message,omitempty"` // A custom message to be shown when registrations are closed.
9 | }
10 |
--------------------------------------------------------------------------------
/object/instanceThumbnail.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Instance/#thumbnail
4 | type InstanceThumbnail struct {
5 | URL string `json:"url"` // The URL for the thumbnail image.
6 | Blurhash string `json:"blurhash,omitempty"` // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.
7 | Versions InstanceThumbnailVersions `json:"versions,omitempty"` // Links to scaled resolution images, for high DPI screens.
8 | }
9 |
10 | // https://docs.joinmastodon.org/entities/Instance/#thumbnail-versions
11 | type InstanceThumbnailVersions struct {
12 | At1X string `json:"@1x,omitempty"` // The URL for the thumbnail image at 1x resolution.
13 | At2X string `json:"@2x,omitempty"` // The URL for the thumbnail image at 2x resolution.
14 | }
15 |
--------------------------------------------------------------------------------
/object/instanceUsage.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Instance/#usage
4 | type InstanceUsage struct {
5 | Users InstanceUsageUsers `json:"users"` // Usage data related to users on this instance.
6 | }
7 |
8 | // https://docs.joinmastodon.org/entities/Instance/#active_month
9 | type InstanceUsageUsers struct {
10 | ActiveMonth int `json:"active_month"` // The number of active users in the past 4 weeks.
11 | }
12 |
--------------------------------------------------------------------------------
/object/instance_v1.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Instance_V1/
4 | type Instance_V1 struct {
5 | URI string `json:"uri"`
6 | Title string `json:"title"`
7 | ShortDescription string `json:"short_description"`
8 | Description string `json:"description"`
9 | Email string `json:"email"`
10 | Version string `json:"version"`
11 | URLs struct {
12 | StreamingAPI string `json:"streaming_api"`
13 | }
14 | Stats struct {
15 | UserCount int `json:"user_count"`
16 | StatusCount int `json:"status_count"`
17 | DomainCount int `json:"domain_count"`
18 | }
19 | Thumbnail string `json:"thumbnail"`
20 | Languages []string `json:"languages"`
21 | Registrations bool `json:"registrations"`
22 | ApprovalRequired bool `json:"approval_required"`
23 | InvitesEnabled bool `json:"invites_enabled"`
24 | Configuration Instance_Configuration_V1 `json:"configuration"`
25 | ContactAccount Account `json:"contact_account"`
26 | Rules []Rule `json:"rules"`
27 | }
28 |
29 | type Instance_Configuration_V1 struct {
30 | Accounts Instance_Accounts_V1 `json:"accounts"`
31 | Statuses Instance_Statuses_V1 `json:"statuses"`
32 | MediaAttachments Instance_Media_V1 `json:"media_attachments"`
33 | Polls Instance_Polls_V1 `json:"polls"`
34 | }
35 |
36 | type Instance_Accounts_V1 struct {
37 | MaxFeaturedTags int `json:"max_featured_tags"`
38 | }
39 |
40 | type Instance_Statuses_V1 struct {
41 | MaxMediaAttachments int `json:"max_media_attachments"`
42 | CharactersReservedPerURL int `json:"characters_reserved_per_url"`
43 | }
44 |
45 | type Instance_Media_V1 struct {
46 | SupportedMimeTypes []string `json:"supported_mime_types"`
47 | ImageSizeLimit int `json:"image_size_limit"`
48 | ImageMatrixLimit int `json:"image_matrix_limit"`
49 | VideoSizeLimit int `json:"video_size_limit"`
50 | VideoFrameRateLimit int `json:"video_frame_rate_limit"`
51 | VideoMatrixLimit int `json:"video_matrix_limit"`
52 | }
53 |
54 | type Instance_Polls_V1 struct {
55 | MaxOptions int `json:"max_options"`
56 | MaxCharactersPerOption int `json:"max_characters_per_option"`
57 | MinExpiration int `json:"min_expiration"`
58 | MaxExpiration int `json:"max_expiration"`
59 | }
60 |
--------------------------------------------------------------------------------
/object/list.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // List represents a list of some users that the authenticated user follows.
4 | // https://docs.joinmastodon.org/entities/List/
5 | type List struct {
6 | ID string `json:"id"` // The internal database ID of the list.
7 | Title string `json:"title"` // The user-defined title of the list.
8 | RepliesPolicy string `json:"replies_policy"` // Which replies should be shown in the list. [followed | list | none]
9 | }
10 |
11 | // Show replies to any followed user
12 | const ListRepliesPolicyFollowed = "followed"
13 |
14 | // Show replies to members of the list
15 | const ListRepliesPolicyList = "list"
16 |
17 | // Show replies to no one
18 | const ListRepliesPolicyNone = "none"
19 |
--------------------------------------------------------------------------------
/object/marker.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Marker represents the last read position within a user's timelines.
4 | // https://docs.joinmastodon.org/entities/Marker/
5 | type Marker struct {
6 | LastReadID string `json:"last_read_id"` // The ID of the most recently viewed entity.
7 | Version int `json:"version"` // An incrementing counter, used for locking to prevent write conflicts.
8 | UpdatedAt string `json:"updated_at"` // The timestamp of when the marker was set.
9 | }
10 |
--------------------------------------------------------------------------------
/object/mediaAttachment.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // MediaAttachment represents a file or media attachment that can be added to a status.
4 | // https://docs.joinmastodon.org/entities/MediaAttachment/
5 | type MediaAttachment struct {
6 | ID string `json:"id"` // The ID of the attachment in the database.
7 | Type string `json:"type"` // The type of the attachment. [ image | gifv | video | audio ]
8 | URL string `json:"url"` // The location of the original full-size attachment.
9 | PreviewURL string `json:"preview_url"` // The location of a scaled-down preview of the attachment.
10 | RemoteURL string `json:"remote_url,omitempty"` // The location of the full-size original attachment on the remote website.
11 | Meta map[string]any `json:"meta"` // Metadata returned by Paperclip. https://docs.joinmastodon.org/api/guidelines/#focal-points
12 | Description string `json:"description"` // Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load.
13 | Blurhash string `json:"blurhash"` // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. https://github.com/woltapp/blurhash
14 | }
15 |
--------------------------------------------------------------------------------
/object/notification.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Notification represents a notification of an event relevant to the user.
4 | // https://docs.joinmastodon.org/entities/Notification/
5 | type Notification struct {
6 | ID string `json:"id"` // The id of the notification in the database.
7 | Type string `json:"type"` // The type of event that resulted in the notification. [mention | status | reblog | follow | follow_request |favourite | poll | update | admin.sign_up | admin.report ]
8 | CreatedAt string `json:"created_at"` // The timestamp of the notification. (ISO 8601 Datetime)
9 | Account Account `json:"account"` // The account that performed the action that generated the notification.
10 | Status *Status `json:"status,omitempty"` // Status that was the object of the notification. Attached when type of the notification is favourite, reblog, status, mention, poll, or update.
11 | Report *AdminReport `json:"report,omitempty"` // Report that was the object of the notification. Attached when type of the notification is admin.report.
12 | }
13 |
--------------------------------------------------------------------------------
/object/poll.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Poll represents a poll attached to a status.
4 | // https://docs.joinmastodon.org/entities/Poll/
5 | type Poll struct {
6 | ID string `json:"id"` // The ID of the poll in the database.
7 | ExpiresAt string `json:"expires_at"` // When the poll ends. (ISO 8601 Datetime)
8 | Expired bool `json:"expired"` // Is the poll currently expired?
9 | Multiple bool `json:"multiple"` // Does the poll allow multiple-choice answers?
10 | VotesCount int `json:"votes_count"` // How many votes have been received.
11 | VotersCount int `json:"voters_count,omitempty"` // How many unique accounts have voted on a multiple-choice poll.
12 | Options []PollOption `json:"options"` // Possible answers for the poll.
13 | Emojis []CustomEmoji `json:"emojis"` // Custom emoji to be used for rendering poll options.
14 | Voted bool `json:"voted,omitempty"` // When called with a user token, has the authorized user voted?
15 | OwnVotes []int `json:"own_votes"` // When called with a user token, which options has the authorized user chosen? Contains an array of index values for options.
16 | }
17 |
18 | // https://docs.joinmastodon.org/entities/Poll/#Option
19 | type PollOption struct {
20 | Title string `json:"title"` // The text value of the poll option.
21 | VotesCount int `json:"votes_count"` // The total number of received votes for this option.
22 | }
23 |
--------------------------------------------------------------------------------
/object/previewCard.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // PreviewCard represents a rich preview card that is generated using OpenGraph tags from a URL.
4 | // https://docs.joinmastodon.org/entities/PreviewCard/
5 | type PreviewCard struct {
6 | URL string `json:"url"` // Location of linked resource.
7 | Title string `json:"title"` // Title of linked resource.
8 | Description string `json:"description"` // Description of preview.
9 | Type string `json:"type"` // The type of the preview card. [link | photo | video | rich]
10 | AuthorName string `json:"author_name"` // The author of the original resource.
11 | AuthorURL string `json:"author_url"` // A link to the author of the original resource.
12 | ProviderName string `json:"provider_name"` // The provider of the original resource.
13 | ProviderURL string `json:"provider_url"` // A link to the provider of the original resource.
14 | HTML string `json:"html"` // HTML to be used for generating the preview card.
15 | Width int `json:"width"` // Width of preview, in pixels.
16 | Height int `json:"height"` // Height of preview, in pixels.
17 | Image string `json:"image,omitempty"` // Preview thumbnail.
18 | EmbedURL string `json:"embed_url"` // Used for photo embeds, instead of custom html.
19 | Blurhash string `json:"blurhash"` // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.
20 | }
21 |
--------------------------------------------------------------------------------
/object/reaction.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Reaction represents an emoji reaction to an Announcement.
4 | // https://docs.joinmastodon.org/entities/Reaction/
5 | type Reaction struct {
6 | Name string `json:"name"` // The emoji used for the reaction. Either a unicode emoji, or a custom emoji’s shortcode.
7 | Count int `json:"count"` // The total number of users who have added this reaction.
8 | Me bool `json:"me"` // If there is a currently authorized user: Have you added this reaction?
9 | URL string `json:"url"` // If the reaction is a custom emoji: A link to the custom emoji.
10 | StaticURL string `json:"static_url"` // If the reaction is a custom emoji: A link to a non-animated version of the custom emoji.
11 | }
12 |
--------------------------------------------------------------------------------
/object/relatioinship.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Relationship represents the relationship between accounts, such as following / blocking / muting / etc.
4 | // https://docs.joinmastodon.org/entities/Relationship/
5 | type Relationship struct {
6 | ID string `json:"id"` // The account ID.
7 | Following bool `json:"following"` // Are you following this user?
8 | ShowingReblogs bool `json:"showing_reblogs"` // Are you receiving this user’s boosts in your home timeline?
9 | Notifying bool `json:"notifying"` // Have you enabled notifications for this user?
10 | Languages []string `json:"languages"` // Which languages are you following from this user? ISO 8601 2-letter language codes
11 | FollowedBy bool `json:"followed_by"` // Are you followed by this user?
12 | Blocking bool `json:"blocking"` // Are you blocking this user?
13 | BlockedBy bool `json:"blocked_by"` // Is this user blocking you?
14 | Muting bool `json:"muting"` // Are you muting this user?
15 | MutingNotifications bool `json:"muting_notifications"` // Are you muting notifications from this user?
16 | Requested bool `json:"requested"` // Do you have a pending follow request for this user?
17 | DomainBlocking bool `json:"domain_blocking"` // Are you blocking this user’s domain?
18 | Endorsed bool `json:"endorsed"` // Are you featuring this user on your profile?
19 | Note string `json:"note"` // The user’s profile bio
20 | }
21 |
--------------------------------------------------------------------------------
/object/report.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Report represents reports filed against users and/or statuses, to be taken action on by moderators.
4 | // https://docs.joinmastodon.org/entities/Report/
5 | type Report struct {
6 | ID string `json:"id"` // The ID of the report in the database.
7 | ActionTaken bool `json:"action_taken"` // Whether an action was taken yet.
8 | ActionTakenAt string `json:"action_taken_at"` // When an action was taken against the report. (ISO 8601 datetime)
9 | Category string `json:"category"` // The generic reason for the report. (spam | violoation | other)
10 | Comment string `json:"comment"` // The reason for the report.
11 | Forwarded bool `json:"forwarded"` // Whether the report was forwarded to a remote domain.
12 | CreatedAt string `json:"created_at"` // When the report was created.
13 | StatusIDs []string `json:"status_ids,omitempty"` // IDs of statuses that have been attached to this report for additional context.
14 | RuleIDs []string `json:"rule_ids,omitempty"` // IDs of the rules that have been cited as a violation by this report.
15 | TargetAcount Account `json:"target_account"` // The account that was reported.
16 | }
17 |
--------------------------------------------------------------------------------
/object/rule.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Rule represents a rule that server users should follow.
4 | // https://docs.joinmastodon.org/entities/Rule/
5 | type Rule struct {
6 | ID string `json:"id"` // An identifier for the rule.
7 | Text string `json:"text"` // The rule to be followed.
8 | }
9 |
--------------------------------------------------------------------------------
/object/scheduledStatus.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // ScheduledStatus represents a status that will be published at a future scheduled date.
4 | // https://docs.joinmastodon.org/entities/ScheduledStatus/
5 | type ScheduledStatus struct {
6 | ID string `json:"id"`
7 | ScheduledAt string `json:"scheduled_at"`
8 | Params map[string]any `json:"params"`
9 | MediaAttachments []MediaAttachment `json:"media_attachments"`
10 | }
11 |
--------------------------------------------------------------------------------
/object/search.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Search represents the results of a search.
4 | // https://docs.joinmastodon.org/entities/Search/
5 | type Search struct {
6 | Accounts []Account `json:"accounts"` // Accounts which match the given query
7 | Statuses []Status `json:"statuses"` // Statuses which match the given query
8 | Hashtags []Tag `json:"hashtags"` // Hashtags which match the given query
9 | }
10 |
--------------------------------------------------------------------------------
/object/status.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Status represents a status posted by an account.
4 | // https://docs.joinmastodon.org/entities/Status/
5 | type Status struct {
6 | ID string `json:"id"` // ID of the status in the database.
7 | URI string `json:"uri"` // URI of the status used for federation.
8 | CreatedAt string `json:"created_at"` // The date when this status was created. (ISO 8601 Datetime)
9 | Account Account `json:"account"` // The account that authored this status.
10 | Content string `json:"content"` // HTML-encoded status content.
11 | Visibility string `json:"visibility"` // Visibility of this status. [public | unlisted | private | direct]
12 | Sensitive bool `json:"sensitive"` // Is this status marked as sensitive content?
13 | SpoilerText string `json:"spoiler_text"` // Subject or summary line, below which status content is collapsed until expanded.
14 | MediaAttachments []MediaAttachment `json:"media_attachments"` // Media that is attached to this status.
15 | Application *StatusApplication `json:"application,omitempty"` // The application used to post this status.
16 | Mentions []StatusMention `json:"mentions"` // Mentions of users within the status content.
17 | Tags []StatusTag `json:"tags"` // Hashtags used within the status content.
18 | Emojis []CustomEmoji `json:"emojis"` // Custom emoji to be used when rendering status content.
19 | ReblogsCount int `json:"reblogs_count"` // How many boosts this status has received.
20 | FavouritesCount int `json:"favourites_count"` // How many favourites this status has received.
21 | RepliesCount int `json:"replies_count"` // How many replies this status has received.
22 | URL string `json:"url"` // A link to the status’s HTML representation.
23 | InReplyToID string `json:"in_reply_to_id,omitempty"` // ID of the status being replied to.
24 | InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"` // ID of the account that authored the status being replied to.
25 | Reblog *Status `json:"reblog,omitempty"` // The status being reblogged.
26 | Poll *Poll `json:"poll,omitempty"` // The poll attached to the status.
27 | Card *PreviewCard `json:"card,omitempty"` // Preview card for links included within status content.
28 | Language string `json:"language,omitempty"` // Primary language of this status. (ISO 639 Part 1 two-letter language code)
29 | Text string `json:"text"` // Plain-text source of a status. Returned instead of content when status is deleted, so the user may redraft from the source text without the client having to reverse-engineer the original text from the HTML content.
30 | EditedAt string `json:"edited_at"` // Timestamp of when the status was last edited. (ISO 8601 Datetime)
31 | Favourited bool `json:"favourited"` // If the current token has an authorized user: Have you favourited this status?
32 | Reblogged bool `json:"reblogged"` // If the current token has an authorized user: Have you boosted this status?
33 | Muted bool `json:"muted"` // If the current token has an authorized user: Have you muted notifications for this status’s conversation?
34 | Bookmarked bool `json:"bookmarked"` // If the current token has an authorized user: Have you bookmarked this status?
35 | Pinned bool `json:"pinned"` // If the current token has an authorized user: Have you pinned this status? Only appears if the status is pinnable.
36 | Filtered []FilterResult `json:"filtered"` // If the current token has an authorized user: The filter and keywords that matched this status.
37 | }
38 |
--------------------------------------------------------------------------------
/object/statusApplication.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // The application used to post this status.
4 | // https://docs.joinmastodon.org/entities/Status/#application
5 | type StatusApplication struct {
6 | Name string `json:"name"` // The name of the application that posted this status.
7 | Website string `json:"website,omitempty"` // The website associated with the application that posted this status.
8 | }
9 |
--------------------------------------------------------------------------------
/object/statusEdit.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // StatusEdit represents a revision of a status that has been edited.
4 | // https://docs.joinmastodon.org/entities/StatusEdit/
5 | type StatusEdit struct {
6 | Content string `json:"content"` // The content of the status at this revision.
7 | SpoilerText string `json:"spoiler_text"` // The content of the subject or content warning at this revision.
8 | Sensitive bool `json:"sensitive"` // Whether the status was marked sensitive at this revision.
9 | CreatedAt string `json:"created_at"` // The timestamp of when the revision was published. (ISO 8601 Datetime)
10 | Account Account `json:"account"` // The account that published this revision.
11 | Poll *Poll `json:"poll"` // The current state of the poll options at this revision. Note that edits changing the poll options will be collapsed together into one edit, since this action resets the poll.
12 | MediaAttachments []MediaAttachment `json:"media_attachments"` // The current state of the poll options at this revision. Note that edits changing the poll options will be collapsed together into one edit, since this action resets the poll.
13 | Emojis []CustomEmoji `json:"emojis"` // Any custom emoji that are used in the current revision.
14 | }
15 |
--------------------------------------------------------------------------------
/object/statusMention.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Mentions of users within the status content.
4 | // https://docs.joinmastodon.org/entities/Status/#mentions
5 | type StatusMention struct {
6 | ID string `json:"id"` // The account ID of the mentioned user.
7 | Username string `json:"username"` // The username of the mentioned user.
8 | URL string `json:"url"` // The location of the mentioned user’s profile.
9 | Acct string `json:"acct"` // The webfinger acct: URI of the mentioned user. Equivalent to username for local users, or username@domain for remote users.
10 | }
11 |
--------------------------------------------------------------------------------
/object/statusSource.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // StatusSource represents a status's source as plain text.
4 | // https://docs.joinmastodon.org/entities/StatusSource/
5 | type StatusSource struct {
6 | ID string `json:"id"` // ID of the status in the database.
7 | Text string `json:"text"` // The plain text used to compose the status.
8 | SpoilerText string `json:"spoiler_text"` // The plain text used to compose the status’s subject or content warning.
9 | }
10 |
--------------------------------------------------------------------------------
/object/statusTag.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Status/#Tag
4 | type StatusTag struct {
5 | Name string `json:"name"` // The value of the hashtag after the # sign.
6 | URL string `json:"url"` // A link to the hashtag on the instance.
7 | }
8 |
--------------------------------------------------------------------------------
/object/suggestion.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Suggestion/
4 | type Suggestion struct {
5 | Source string `json:"source"` // The reason this account is being suggested. [staff | past_interactions | global]
6 | Account Account `json:"account"` // The account being recommended to follow.
7 | }
8 |
--------------------------------------------------------------------------------
/object/tag.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Tag/
4 | type Tag struct {
5 | Name string `json:"name"` // The value of the hashtag after the # sign.
6 | URL string `json:"url"` // A link to the hashtag on the instance.
7 | History []TagHistory `json:"history"` // Usage statistics for given days (typically the past week).
8 | Following bool `json:"following"` // Whether the current token’s authorized user is following this tag.
9 | }
10 |
--------------------------------------------------------------------------------
/object/tagHistory.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // Usage statistics for given days (typically the past week).
4 | // https://docs.joinmastodon.org/entities/Tag/#history
5 | type TagHistory struct {
6 | Day string `json:"day"` // UNIX timestamp on midnight of the given day.
7 | Uses string `json:"uses"` // The counted usage of the tag within that day.
8 | Accounts string `json:"accounts"` // The total of accounts using the tag within that day.
9 | }
10 |
--------------------------------------------------------------------------------
/object/token.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Token/
4 | type Token struct {
5 | AccessToken string `json:"access_token"` // An OAuth token to be used for authorization.
6 | TokenType string `json:"token_type"` // The OAuth token type. Mastodon uses Bearer tokens.
7 | Scope string `json:"scope"` // The OAuth scopes granted by this token, space-separated.
8 | CreatedAt int64 `json:"created_at"` // When the token was generated. (Unix Timestamp)
9 | }
10 |
--------------------------------------------------------------------------------
/object/translation.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/Translation/
4 | type Translation struct {
5 | Content string `json:"content"` // HTML: The translated text of the status.
6 | DetectedSourceLanguage string `json:"detected_source_language"` // ISO 639 Language Code: The language of the source text, as auto-detected by the machine translation provider.
7 | Provider string `json:"provider"` // The service that provided the machine translation.
8 | }
9 |
--------------------------------------------------------------------------------
/object/v1_filter.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/V1_Filter/
4 | type V1_Filter struct {
5 | }
6 |
--------------------------------------------------------------------------------
/object/webPushSubscription.go:
--------------------------------------------------------------------------------
1 | package object
2 |
3 | // https://docs.joinmastodon.org/entities/WebPushSubscription/
4 | type WebPushSubscription struct {
5 | }
6 |
--------------------------------------------------------------------------------
/pageInfo.go:
--------------------------------------------------------------------------------
1 | package toot
2 |
3 | import (
4 | "net/http"
5 | "strings"
6 | )
7 |
8 | // PageInfo is used to add pagination headers to a response
9 | type PageInfo struct {
10 | MinID string // If present, then a link header will be created
11 | MaxID string // If present, then a link header will be created
12 | Offset string // If present, then a link header will be created
13 | }
14 |
15 | // SetHeaders adds pagination headers to a response.
16 | func (p PageInfo) SetHeaders(response *http.Response) {
17 |
18 | if response == nil {
19 | return
20 | }
21 |
22 | // NPE Guard
23 | if response.Request == nil {
24 | return
25 | }
26 |
27 | // NPE Guard
28 | if response.Request.URL == nil {
29 | return
30 | }
31 |
32 | uri := response.Request.URL.String()
33 | uri, _, _ = strings.Cut(uri, "?")
34 |
35 | if prev := p.GetPreviousPage(uri); prev != "" {
36 | response.Header.Set("Link", "<"+prev+">; rel=\"prev\"")
37 | }
38 |
39 | if next := p.GetNextPage(uri); next != "" {
40 | response.Header.Set("Link", "<"+next+">; rel=\"next\"")
41 | }
42 | }
43 |
44 | // GetPreviousPage returns a URL for the previou page of results.
45 | // If there is no previous page, then an empty string is returned.
46 | func (p PageInfo) GetPreviousPage(path string) string {
47 |
48 | if p.MinID == "" {
49 | return ""
50 | }
51 |
52 | return path + "?min_id=" + p.MinID
53 | }
54 |
55 | // GetNextPage returns a URL for the next page of results.
56 | // If there is no next page, then an empty string is returned.
57 | func (p PageInfo) GetNextPage(path string) string {
58 |
59 | if p.MaxID != "" {
60 | return path + "?max_id=" + p.MaxID
61 | }
62 |
63 | if p.Offset != "" {
64 | return path + "?offset=" + p.Offset
65 | }
66 |
67 | return ""
68 | }
69 |
--------------------------------------------------------------------------------
/route/accounts.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Accounts API Methods
5 | * Methods concerning accounts and profiles
6 | * https://docs.joinmastodon.org/methods/accounts/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/accounts/#create
10 | const PostAccount = "/api/v1/accounts"
11 |
12 | // https://docs.joinmastodon.org/methods/accounts/#verify_credentials
13 | const GetAccount_VerifyCredentials = "/api/v1/accounts/verify_credentials"
14 |
15 | // https://docs.joinmastodon.org/methods/accounts/#update_credentials
16 | const PatchAccount_UpdateCredentials = "/api/v1/accounts/update_credentials"
17 |
18 | // https://docs.joinmastodon.org/methods/accounts/#get
19 | const GetAccount = "/api/v1/accounts/:id"
20 |
21 | // https://docs.joinmastodon.org/methods/accounts/#statuses
22 | const GetAccount_Statuses = "/api/v1/accounts/:id/statuses"
23 |
24 | // https://docs.joinmastodon.org/methods/accounts/#followers
25 | const GetAccount_Followers = "/api/v1/accounts/:id/followers"
26 |
27 | // https://docs.joinmastodon.org/methods/accounts/#following
28 | const GetAccount_Following = "/api/v1/accounts/:id/following"
29 |
30 | // https://docs.joinmastodon.org/methods/accounts/#featured_tags
31 | const GetAccount_FeaturedTags = "/api/v1/accounts/:id/featured_tags"
32 |
33 | // https://docs.joinmastodon.org/methods/accounts/#lists
34 | const GetAccount_Lists = "/api/v1/accounts/:id/lists"
35 |
36 | // https://docs.joinmastodon.org/methods/accounts/#follow
37 | const PostAccont_Follow = "/api/v1/accounts/:id/follow"
38 |
39 | // https://docs.joinmastodon.org/methods/accounts/#unfollow
40 | const PostAccount_Unfollow = "/api/v1/accounts/:id/unfollow"
41 |
42 | // https://docs.joinmastodon.org/methods/accounts/#remove_from_followers
43 | const PostAccount_RemoveFromFollowers = "/api/v1/accounts/:id/remove_from_followers"
44 |
45 | // https://docs.joinmastodon.org/methods/accounts/#block
46 | const PostAccount_Block = "/api/v1/accounts/:id/block"
47 |
48 | // https://docs.joinmastodon.org/methods/accounts/#unblock
49 | const PostAccount_Unblock = "/api/v1/accounts/:id/unblock"
50 |
51 | // https://docs.joinmastodon.org/methods/accounts/#mute
52 | const PostAccount_Mute = "/api/v1/accounts/:id/mute"
53 |
54 | // https://docs.joinmastodon.org/methods/accounts/#unmute
55 | const PostAccount_Unmute = "/api/v1/accounts/:id/unmute"
56 |
57 | // https://docs.joinmastodon.org/methods/accounts/#pin
58 | const PostAccount_Pin = "/api/v1/accounts/:id/pin"
59 |
60 | // https://docs.joinmastodon.org/methods/accounts/#unpin
61 | const PostAccount_Unpin = "/api/v1/accounts/:id/unpin"
62 |
63 | // https://docs.joinmastodon.org/methods/accounts/#note
64 | const PostAccount_Note = "/api/v1/accounts/:id/note"
65 |
66 | // https://docs.joinmastodon.org/methods/accounts/#relationships
67 | const PostAccount_Relationships = "/api/v1/accounts/relationships"
68 |
69 | // https://docs.joinmastodon.org/methods/accounts/#familiar_followers
70 | const GetAccount_FamiliarFollowers = "/api/v1/accounts/:id/familiar_followers"
71 |
72 | // https://docs.joinmastodon.org/methods/accounts/#search
73 | const GetAccount_Search = "/api/v1/accounts/search"
74 |
75 | // https://docs.joinmastodon.org/methods/accounts/#lookup
76 | const GetAccount_Lookup = "/api/v1/accounts/lookup"
77 |
--------------------------------------------------------------------------------
/route/admin-.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/
4 |
--------------------------------------------------------------------------------
/route/admin-accounts.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/accounts/
4 |
--------------------------------------------------------------------------------
/route/admin-canonical-email-blocks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/canonical_email_blocks/
4 |
--------------------------------------------------------------------------------
/route/admin-dimensions.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/dimensions/
4 |
--------------------------------------------------------------------------------
/route/admin-domain-allows.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/domain_allows/
4 |
--------------------------------------------------------------------------------
/route/admin-domain-blocks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/domain_blocks/
4 |
--------------------------------------------------------------------------------
/route/admin-email-blocks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/email_domain_blocks/
4 |
--------------------------------------------------------------------------------
/route/admin-ip-blocks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/ip_blocks/
4 |
--------------------------------------------------------------------------------
/route/admin-measures.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/measures/
4 |
--------------------------------------------------------------------------------
/route/admin-reports.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/reports/
4 |
--------------------------------------------------------------------------------
/route/admin-retention.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/retention/
4 |
--------------------------------------------------------------------------------
/route/admin-trends.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | // https://docs.joinmastodon.org/methods/admin/trends/
4 |
--------------------------------------------------------------------------------
/route/announcements.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Announcements API Methods
5 | * For announcements set by administration
6 | * https://docs.joinmastodon.org/methods/announcements/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/announcements/#get
10 | const GetAnnouncements = "/api/v1/announcements"
11 |
12 | // https://docs.joinmastodon.org/methods/announcements/#dismiss
13 | const PostAnnouncement_Dismiss = "/api/v1/announcements/:id/dismiss"
14 |
15 | // https://docs.joinmastodon.org/methods/announcements/#put-reactions
16 | const PutAnnouncement_Reaction = "/api/v1/announcements/:id/reactions/:name"
17 |
18 | // https://docs.joinmastodon.org/methods/announcements/#delete-reactions
19 | const DeleteAnnouncement_Reaction = "/api/v1/announcements/:id/reactions/:name"
20 |
--------------------------------------------------------------------------------
/route/apps.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Apps API Methods
5 | * Register client applications that can be used to obtain OAuth tokens
6 | * https://docs.joinmastodon.org/methods/apps/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/apps/#create
10 | const PostApplication = "/api/v1/apps"
11 |
12 | // https://docs.joinmastodon.org/methods/apps/#verify_credentials
13 | const GetApplication_VerifyCredentials = "/api/v1/apps/verify_credentials"
14 |
--------------------------------------------------------------------------------
/route/blocks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Blocks API Methods
5 | * View your blocks. See also accounts/:id/blocks
6 | * https://docs.joinmastodon.org/methods/blocks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/blocks/#get
10 | const GetBlocks = "/api/v1/blocks"
11 |
--------------------------------------------------------------------------------
/route/bookmarks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Bookmarks API Methods
5 | * View your bookmarks. See also statuses/:id/(bookmark,unbookmark)
6 | * https://docs.joinmastodon.org/methods/bookmarks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/bookmarks/#get
10 | const GetBookmarks = "/api/v1/bookmarks"
11 |
--------------------------------------------------------------------------------
/route/conversations.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Conversations API Methods
5 | * Direct conversations with other participants.
6 | * (Currently, just threads containing a post with "direct" visibility.)
7 | * https://docs.joinmastodon.org/methods/conversations/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/conversations/#get
11 | const GetConversations = "/api/v1/conversations"
12 |
13 | // https://docs.joinmastodon.org/methods/conversations/#delete
14 | const DeleteConversation = "/api/v1/conversations/:id"
15 |
16 | // https://docs.joinmastodon.org/methods/conversations/#read
17 | const PostConversationRead = "/api/v1/conversations/:id/read"
18 |
--------------------------------------------------------------------------------
/route/custom-emojis.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Custom Emoji API Methods
5 | * Each site can define and upload its own custom emoji to be attached to profiles or statuses.
6 | * https://docs.joinmastodon.org/methods/custom_emojis/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/custom_emojis/#get
10 | const GetCustomEmojis = "/api/v1/custom_emojis"
11 |
--------------------------------------------------------------------------------
/route/directory.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Directory API Methods
5 | * A directory of profiles that your website is aware of.
6 | * https://docs.joinmastodon.org/methods/directory/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/directory/#get
10 | const GetDirectory = "/api/v1/directory"
11 |
--------------------------------------------------------------------------------
/route/domain-blocks.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Domain Blocks API Methods
5 | * Manage a User's blocked domains.
6 | * https://docs.joinmastodon.org/methods/domain_blocks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/domain_blocks/#get
10 | const GetDomainBlocks = "/api/v1/domain_blocks"
11 |
12 | // https://docs.joinmastodon.org/methods/domain_blocks/#block
13 | const PostDomainBlock = "/api/v1/domain_blocks"
14 |
15 | // https://docs.joinmastodon.org/methods/domain_blocks/#unblock
16 | const DeleteDomainBlock = "/api/v1/domain_blocks"
17 |
--------------------------------------------------------------------------------
/route/emails.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Emails API Methods
5 | * Request a new confirmation email, potentially to a new email address
6 | * https://docs.joinmastodon.org/methods/emails/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/emails/#confirmation
10 | const PostEmailConfirmation = "/api/v1/email/confirmation"
11 |
--------------------------------------------------------------------------------
/route/endorsements.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Endorsements API Methods
5 | * Feature other profiles on your own profile. See also accounts/:id/{pin,unpin}
6 | * https://docs.joinmastodon.org/methods/endorsements/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/endorsements/#get
10 | const GetEndorsements = "/api/v1/endorsements"
11 |
--------------------------------------------------------------------------------
/route/favourites.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Favourites API Methods
5 | * View your favourites. See also /statuses/:id/{favourite,unfavourite}
6 | * https://docs.joinmastodon.org/methods/favourites/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/favourites/#get
10 | const GetFavourites = "/api/v1/favourites"
11 |
--------------------------------------------------------------------------------
/route/featured-tags.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Featured Tags API Methods
5 | * Feature tags that you use frequently on your profile
6 | * https://docs.joinmastodon.org/methods/featured_tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/featured_tags/#get
10 | const GetFeaturedTags = "/api/v1/featured_tags"
11 |
12 | // https://docs.joinmastodon.org/methods/featured_tags/#feature
13 | const PostFeaturedTag = "/api/v1/featured_tags"
14 |
15 | // https://docs.joinmastodon.org/methods/featured_tags/#unfeature
16 | const DeleteFeaturedTag = "/api/v1/featured_tags/:id"
17 |
18 | // https://docs.joinmastodon.org/methods/featured_tags/#suggestions
19 | const GetFeaturedTags_Suggestions = "/api/v1/featured_tags/suggestions"
20 |
--------------------------------------------------------------------------------
/route/filters.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Filters API Methods
5 | * Create and manage filters
6 | * https://docs.joinmastodon.org/methods/filters/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/filters/#get
10 | const GetFilters = "/api/v2/filters"
11 |
12 | // https://docs.joinmastodon.org/methods/filters/#get-one
13 | const GetFilter = "/api/v2/filters/:id"
14 |
15 | // https://docs.joinmastodon.org/methods/filters/#create
16 | const PostFilter = "/api/v2/filters"
17 |
18 | // https://docs.joinmastodon.org/methods/filters/#update
19 | const PutFilter = "/api/v2/filters/:id"
20 |
21 | // https://docs.joinmastodon.org/methods/filters/#delete
22 | const DeleteFilter = "/api/v2/filters/:id"
23 |
24 | // https://docs.joinmastodon.org/methods/filters/#keywords-get
25 | const GetFilter_Keywords = "/api/v2/filters/:filter_id/keywords"
26 |
27 | // https://docs.joinmastodon.org/methods/filters/#keywords-create
28 | const PostFilter_Keyword = "/api/v2/filters/:filter_id/keywords"
29 |
30 | // https://docs.joinmastodon.org/methods/filters/#keywords-get-one
31 | const GetFilter_Keyword = "/api/v2/filters/keywords/:id"
32 |
33 | // https://docs.joinmastodon.org/methods/filters/#keywords-update
34 | const PutFilter_Keyword = "/api/v2/filters/keywords/:id"
35 |
36 | // https://docs.joinmastodon.org/methods/filters/#keywords-delete
37 | const DeleteFilter_Keyword = "/api/v2/filters/keywords/:id"
38 |
39 | // https://docs.joinmastodon.org/methods/filters/#statuses-get
40 | const GetFilter_Statuses = "/api/v2/filters/:filter_id/statuses"
41 |
42 | // https://docs.joinmastodon.org/methods/filters/#statuses-add
43 | const PostFilter_Status = "/api/v2/filters/:filter_id/statuses"
44 |
45 | // https://docs.joinmastodon.org/methods/filters/#statuses-get-one
46 | const GetFilter_Status = "/api/v2/filters/statuses/:id"
47 |
48 | // https://docs.joinmastodon.org/methods/filters/#statuses-remove
49 | const DeleteFilter_Status = "/api/v2/filters/statuses/:id"
50 |
51 | // https://docs.joinmastodon.org/methods/filters/#get-v1
52 | const GetFilters_V1 = "/api/v1/filters"
53 |
54 | // https://docs.joinmastodon.org/methods/filters/#get-one-v1
55 | const GetFilter_V1 = "/api/v1/filters/:id"
56 |
57 | // https://docs.joinmastodon.org/methods/filters/#create-v1
58 | const PostFilter_V1 = "/api/v1/filters"
59 |
60 | // https://docs.joinmastodon.org/methods/filters/#update-v1
61 | const PutFilter_V1 = "/api/v1/filters/:id"
62 |
63 | // https://docs.joinmastodon.org/methods/filters/#delete-v1
64 | const DeleteFilter_V1 = "/api/v1/filters/:id"
65 |
--------------------------------------------------------------------------------
/route/follow-requests.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Follow Requests API Methods
5 | * View and manage follow requests
6 | * https://docs.joinmastodon.org/methods/follow_requests/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/follow_requests/#get
10 | const GetFollowRequests = "/api/v1/follow_requests"
11 |
12 | // https://docs.joinmastodon.org/methods/follow_requests/#accept
13 | const PostFollowRequest_Authorize = "/api/v1/follow_requests/:account_id/authorize"
14 |
15 | // https://docs.joinmastodon.org/methods/follow_requests/#reject
16 | const PostFollowRequest_Reject = "/api/v1/follow_requests/:account_id/reject"
17 |
--------------------------------------------------------------------------------
/route/followed-tags.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Followed Tags API Methods
5 | * View your followed hashtags
6 | * https://docs.joinmastodon.org/methods/followed_tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/followed_tags/#get
10 | const GetFollowedTags = "/api/v1/followed_tags"
11 |
--------------------------------------------------------------------------------
/route/instance.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Instance API Methods
5 | * Discover information about a Mastodon website
6 | * https://docs.joinmastodon.org/methods/instance/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/instance/#v2
10 | const GetInstance = "/api/v2/instance"
11 |
12 | // https://docs.joinmastodon.org/methods/instance/#peers
13 | const GetInstance_Peers = "/api/v1/instance/peers"
14 |
15 | // https://docs.joinmastodon.org/methods/instance/#activity
16 | const GetInstance_Activity = "/api/v1/instance/activity"
17 |
18 | // https://docs.joinmastodon.org/methods/instance/#rules
19 | const GetInstance_Rules = "/api/v1/instance/rules"
20 |
21 | // https://docs.joinmastodon.org/methods/instance/#domain_blocks
22 | const GetInstance_DomainBlocks = "/api/v1/instance/domain_blocks"
23 |
24 | // https://docs.joinmastodon.org/methods/instance/#extended_description
25 | const GetInstance_ExtendedDescription = "/api/v1/instance/extended_description"
26 |
27 | // https://docs.joinmastodon.org/methods/instance/#v1
28 | const GetInstance_V1 = "/api/v1/instance"
29 |
--------------------------------------------------------------------------------
/route/lists.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Lists API Methods
5 | * View and manage lists. See also /api/v1/timelines/list/:id for loading a list timeline
6 | * https://docs.joinmastodon.org/methods/lists/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/lists/#get
10 | const GetLists = "/api/v1/lists"
11 |
12 | // https://docs.joinmastodon.org/methods/lists/#get-one
13 | const GetList = "/api/v1/lists/:id"
14 |
15 | // https://docs.joinmastodon.org/methods/lists/#create
16 | const PostList = "/api/v1/lists"
17 |
18 | // https://docs.joinmastodon.org/methods/lists/#update
19 | const PutList = "/api/v1/lists/:id"
20 |
21 | // https://docs.joinmastodon.org/methods/lists/#delete
22 | const DeleteList = "/api/v1/lists/:id"
23 |
24 | // https://docs.joinmastodon.org/methods/lists/#accounts
25 | const GetList_Accounts = "/api/v1/lists/:id/accounts"
26 |
27 | // https://docs.joinmastodon.org/methods/lists/#accounts-add
28 | const PostList_Accounts = "/api/v1/lists/:id/accounts"
29 |
30 | // https://docs.joinmastodon.org/methods/lists/#accounts-remove
31 | const DeleteList_Accounts = "/api/v1/lists/:id/accounts"
32 |
--------------------------------------------------------------------------------
/route/markers.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Markers API Methods
5 | * Save and restore your position in timelines
6 | * https://docs.joinmastodon.org/methods/markers/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/markers/#get
10 | const GetMarkers = "/api/v1/markers"
11 |
12 | // https://docs.joinmastodon.org/methods/markers/#create
13 | const PostMarker = "/api/v1/markers"
14 |
--------------------------------------------------------------------------------
/route/media.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Media API Methods
5 | * Attach media to authored statuses. See Using Mastodon > Posting toots > Attachments
6 | * for more information about size and format limits
7 | * https://docs.joinmastodon.org/methods/media/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/media/#v2
11 | const PostMedia = "/api/v2/media"
12 |
--------------------------------------------------------------------------------
/route/mutes.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Mutes API Methods
5 | * View your mutes. See also /accounts/:id/{mute,unmute}
6 | * https://docs.joinmastodon.org/methods/mutes/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/mutes/#get
10 | const GetMutes = "/api/v1/mutes"
11 |
--------------------------------------------------------------------------------
/route/notifications.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Notifications API Methods
5 | * Receive notifications for activity on your account or statuses
6 | * https://docs.joinmastodon.org/methods/notifications/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/notifications/#get
10 | const GetNotifications = "/api/v1/notifications"
11 |
12 | // https://docs.joinmastodon.org/methods/notifications/#get-one
13 | const GetNotification = "/api/v1/notifications/:id"
14 |
15 | // https://docs.joinmastodon.org/methods/notifications/#clear
16 | const PostNotifications_Clear = "/api/v1/notifications/clear"
17 |
18 | // https://docs.joinmastodon.org/methods/notifications/#dismiss
19 | const PostNotification_Dismiss = "/api/v1/notifications/dismiss"
20 |
--------------------------------------------------------------------------------
/route/oauth.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * OAuth API Methods
5 | * Generate and manage OAuth tokens
6 | * https://docs.joinmastodon.org/methods/oauth/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/oauth/#authorize
10 | const GetOAuth_Authorize = "/oauth/authorize"
11 |
12 | // https://docs.joinmastodon.org/methods/oauth/#token
13 | const PostOAuth_Token = "/oauth/token"
14 |
15 | // https://docs.joinmastodon.org/methods/oauth/#revoke
16 | const PostOAuth_Revoke = "/oauth/revoke"
17 |
--------------------------------------------------------------------------------
/route/oembed.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * OEmbed API Methods
5 | * For generating OEmbed previews
6 | * https://docs.joinmastodon.org/methods/oembed/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/oembed/#get
10 | const GetOEmbed = "/api/oembed"
11 |
--------------------------------------------------------------------------------
/route/polls.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Polls API Methods
5 | * View and vode on polls attached to statuses. To discover pollID,
6 | * you will need to GET a Status first and then check for a `poll` property.
7 | * https://docs.joinmastodon.org/methods/polls/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/polls/#get
11 | const GetPoll = "/api/v1/polls/:id"
12 |
13 | // https://docs.joinmastodon.org/methods/polls/#vote
14 | const PostPoll_Votes = "/api/v1/polls/:id/votes"
15 |
--------------------------------------------------------------------------------
/route/preferences.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Preferences API Methods
5 | * Preferred common behaviors to be shared across clients.
6 | * https://docs.joinmastodon.org/methods/preferences/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/preferences/#get
10 | const GetPreferences = "/api/v1/preferences"
11 |
--------------------------------------------------------------------------------
/route/profile.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Profile API Methods
5 | * Methods concerning profiles
6 | * https://docs.joinmastodon.org/methods/profile/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/profile/#delete-profile-avatar
10 | const DeleteProfile_Avatar = "/api/v1/profile/avatar"
11 |
12 | // https://docs.joinmastodon.org/methods/profile/#delete-profile-header
13 | const DeleteProfile_Header = "/api/v1/profile/header"
14 |
--------------------------------------------------------------------------------
/route/push.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Push API Methods
5 | * Subscribe to and receive push notifications when a server-side
6 | * notification is received, via the Web Push API
7 | * https://docs.joinmastodon.org/methods/push/
8 | ******************************************/
9 |
--------------------------------------------------------------------------------
/route/reports.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Reports API Methods
5 | * Report problematic users to your moderators
6 | * https://docs.joinmastodon.org/methods/reports/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/reports/#post
10 | const PostReport = "/api/v1/reports"
11 |
--------------------------------------------------------------------------------
/route/scheduled-statuses.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Scheduled Statuses API Methods
5 | * Manage statuses that were scheduled to be published at a future date.
6 | * https://docs.joinmastodon.org/methods/scheduled_statuses/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#get
10 | const GetScheduledStatuses = "/api/v1/scheduled_statuses"
11 |
12 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#get-one
13 | const GetScheduledStatus = "/api/v1/scheduled_statuses/:id"
14 |
15 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#update
16 | const PutScheduledStatus = "/api/v1/scheduled_statuses/:id"
17 |
18 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#cancel
19 | const DeleteScheduledStatus = "/api/v1/scheduled_statuses/:id"
20 |
--------------------------------------------------------------------------------
/route/search.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Search API Methods
5 | * Search for content in accounts, statuses and hashtags
6 | * https://docs.joinmastodon.org/methods/search/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/search/#v2
10 | const GetSearch = "/api/v2/search"
11 |
--------------------------------------------------------------------------------
/route/statuses.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Statuses API Methods
5 | * Publish, interact, and view information about statuses
6 | * https://docs.joinmastodon.org/methods/statuses/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/statuses/#create
10 | const PostStatus = "/api/v1/statuses"
11 |
12 | // https://docs.joinmastodon.org/methods/statuses/#get
13 | const GetStatus = "/api/v1/statuses/:id"
14 |
15 | // https://docs.joinmastodon.org/methods/statuses/#delete
16 | const DeleteStatus = "/api/v1/statuses/:id"
17 |
18 | // https://docs.joinmastodon.org/methods/statuses/#context
19 | const GetStatus_Context = "/api/v1/statuses/:id/context"
20 |
21 | // https://docs.joinmastodon.org/methods/statuses/#translate
22 | const PostStatus_Translate = "/api/v1/statuses/:id/translate"
23 |
24 | // https://docs.joinmastodon.org/methods/statuses/#reblogged_by
25 | const GetStatus_RebloggedBy = "/api/v1/statuses/:id/reblogged_by"
26 |
27 | // https://docs.joinmastodon.org/methods/statuses/#favourited_by
28 | const GetStatus_FavouritedBy = "/api/v1/statuses/:id/favourited_by"
29 |
30 | // https://docs.joinmastodon.org/methods/statuses/#favourite
31 | const PostStatus_Favourite = "/api/v1/statuses/:id/favourite"
32 |
33 | // https://docs.joinmastodon.org/methods/statuses/#unfavourite
34 | const PostStatus_Unfavourite = "/api/v1/statuses/:id/unfavourite"
35 |
36 | // https://docs.joinmastodon.org/methods/statuses/#reblog
37 | const PostStatus_Reblog = "/api/v1/statuses/:id/reblog"
38 |
39 | // https://docs.joinmastodon.org/methods/statuses/#unreblog
40 | const PostStatus_Unreblog = "/api/v1/statuses/:id/unreblog"
41 |
42 | // https://docs.joinmastodon.org/methods/statuses/#bookmark
43 | const PostStatus_Bookmark = "/api/v1/statuses/:id/bookmark"
44 |
45 | // https://docs.joinmastodon.org/methods/statuses/#unbookmark
46 | const PostStatus_Unbookmark = "/api/v1/statuses/:id/unbookmark"
47 |
48 | // https://docs.joinmastodon.org/methods/statuses/#mute
49 | const PostStatus_Mute = "/api/v1/statuses/:id/mute"
50 |
51 | // https://docs.joinmastodon.org/methods/statuses/#unmute
52 | const PostStatus_Unmute = "/api/v1/statuses/:id/unmute"
53 |
54 | // https://docs.joinmastodon.org/methods/statuses/#pin
55 | const PostStatus_Pin = "/api/v1/statuses/:id/pin"
56 |
57 | // https://docs.joinmastodon.org/methods/statuses/#unpin
58 | const PostStatus_Unpin = "/api/v1/statuses/:id/unpin"
59 |
60 | // https://docs.joinmastodon.org/methods/statuses/#edit
61 | const PutStatus = "/api/v1/statuses/:id"
62 |
63 | // https://docs.joinmastodon.org/methods/statuses/#history
64 | const GetStatus_History = "/api/v1/statuses/:id/history"
65 |
66 | // https://docs.joinmastodon.org/methods/statuses/#source
67 | const GetStatus_Source = "/api/v1/statuses/:id/source"
68 |
--------------------------------------------------------------------------------
/route/streaming.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Streaming API Methods
5 | * Subscribe to server-sent events for real-time updates
6 | * via long-lived HTTP connections or via WebSocket
7 | * https://docs.joinmastodon.org/methods/streaming/
8 | ******************************************/
9 |
--------------------------------------------------------------------------------
/route/suggestions.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Suggestions API Methods
5 | * Server-generated suggestions on who to follow, based on previous
6 | * positive interactions
7 | * https://docs.joinmastodon.org/methods/suggestions/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/suggestions/#v2
11 | const GetSuggestions = "/api/v2/suggestions"
12 |
13 | // https://docs.joinmastodon.org/methods/suggestions/#remove
14 | const DeleteSuggestion = "/api/v1/suggestions/:account_id"
15 |
--------------------------------------------------------------------------------
/route/tags.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Tags API Methods
5 | * View information about or follow/unfollow hashtags
6 | * https://docs.joinmastodon.org/methods/tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/tags/#get
10 | const GetTag = "/api/v1/tags/:id"
11 |
12 | // https://docs.joinmastodon.org/methods/tags/#follow
13 | const PostTag_Follow = "/api/v1/tags/:id/follow"
14 |
15 | // https://docs.joinmastodon.org/methods/tags/#unfollow
16 | const PostTag_Unfollow = "/api/v1/tags/:id/unfollow"
17 |
--------------------------------------------------------------------------------
/route/timelines.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Timelines API Methods
5 | * Read and view timelines of statuses
6 | * https://docs.joinmastodon.org/methods/timelines/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/timelines/#public
10 | const GetTimeline_Public = "/api/v1/timelines/public"
11 |
12 | // https://docs.joinmastodon.org/methods/timelines/#tag
13 | const GetTimeline_Hashtag = "/api/v1/timelines/tag/:hashtag"
14 |
15 | // https://docs.joinmastodon.org/methods/timelines/#home
16 | const GetTimeline_Home = "/api/v1/timelines/home"
17 |
18 | // https://docs.joinmastodon.org/methods/timelines/#list
19 | const GetTimeline_List = "/api/v1/timelines/list/:list_id"
20 |
--------------------------------------------------------------------------------
/route/trends.go:
--------------------------------------------------------------------------------
1 | package route
2 |
3 | /******************************************
4 | * Trends API Methods
5 | * View hashtags that are currently being used more frequently than usual.
6 | * https://docs.joinmastodon.org/methods/trends/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/trends/#tags
10 | const GetTrends = "/api/v1/trends"
11 |
12 | // https://docs.joinmastodon.org/methods/trends/#statuses
13 | const GetTrends_Statuses = "/api/v1/trends/statuses"
14 |
15 | // https://docs.joinmastodon.org/methods/trends/#links
16 | const GetTrends_Links = "/api/v1/trends/links"
17 |
--------------------------------------------------------------------------------
/scope/accounts.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Accounts API Methods
5 | * Methods concerning accounts and profiles
6 | * https://docs.joinmastodon.org/methods/accounts/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/accounts/#create
10 | const PostAccount = WriteAccounts
11 |
12 | // https://docs.joinmastodon.org/methods/accounts/#verify_credentials
13 | const GetAccount_VerifyCredentials = ReadAccounts
14 |
15 | // https://docs.joinmastodon.org/methods/accounts/#update_credentials
16 | const PatchAccount_UpdateCredentials = WriteAccounts
17 |
18 | // https://docs.joinmastodon.org/methods/accounts/#get
19 | const GetAccount = Public
20 |
21 | // https://docs.joinmastodon.org/methods/accounts/#statuses
22 | const GetAccount_Statuses = ReadStatuses
23 |
24 | // https://docs.joinmastodon.org/methods/accounts/#followers
25 | const GetAccount_Followers = Private
26 |
27 | // https://docs.joinmastodon.org/methods/accounts/#following
28 | const GetAccount_Following = Private
29 |
30 | // https://docs.joinmastodon.org/methods/accounts/#featured_tags
31 | const GetAccount_FeaturedTags = Private
32 |
33 | // https://docs.joinmastodon.org/methods/accounts/#lists
34 | const GetAccount_Lists = ReadLists
35 |
36 | // https://docs.joinmastodon.org/methods/accounts/#follow
37 | const PostAccont_Follow = WriteFollows
38 |
39 | // https://docs.joinmastodon.org/methods/accounts/#unfollow
40 | const PostAccount_Unfollow = WriteFollows
41 |
42 | // https://docs.joinmastodon.org/methods/accounts/#remove_from_followers
43 | const PostAccount_RemoveFromFollowers = WriteFollows
44 |
45 | // https://docs.joinmastodon.org/methods/accounts/#block
46 | const PostAccount_Block = WriteBlocks
47 |
48 | // https://docs.joinmastodon.org/methods/accounts/#unblock
49 | const PostAccount_Unblock = WriteBlocks
50 |
51 | // https://docs.joinmastodon.org/methods/accounts/#mute
52 | const PostAccount_Mute = WriteMutes
53 |
54 | // https://docs.joinmastodon.org/methods/accounts/#unmute
55 | const PostAccount_Unmute = WriteMutes
56 |
57 | // https://docs.joinmastodon.org/methods/accounts/#pin
58 | const PostAccount_Pin = WriteAccounts
59 |
60 | // https://docs.joinmastodon.org/methods/accounts/#unpin
61 | const PostAccount_Unpin = WriteAccounts
62 |
63 | // https://docs.joinmastodon.org/methods/accounts/#note
64 | const PostAccount_Note = WriteAccounts
65 |
66 | // https://docs.joinmastodon.org/methods/accounts/#relationships
67 | const PostAccount_Relationships = ReadFollows
68 |
69 | // https://docs.joinmastodon.org/methods/accounts/#familiar_followers
70 | const GetAccount_FamiliarFollowers = ReadFollows
71 |
72 | // https://docs.joinmastodon.org/methods/accounts/#search
73 | const GetAccount_Search = ReadAccounts
74 |
75 | // https://docs.joinmastodon.org/methods/accounts/#lookup
76 | const GetAccount_Lookup = Private
77 |
--------------------------------------------------------------------------------
/scope/admin-.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/
4 |
--------------------------------------------------------------------------------
/scope/admin-accounts.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/accounts/
4 |
--------------------------------------------------------------------------------
/scope/admin-canonical-email-blocks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/canonical_email_blocks/
4 |
--------------------------------------------------------------------------------
/scope/admin-dimensions.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/dimensions/
4 |
--------------------------------------------------------------------------------
/scope/admin-domain-allows.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/domain_allows/
4 |
--------------------------------------------------------------------------------
/scope/admin-domain-blocks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/domain_blocks/
4 |
--------------------------------------------------------------------------------
/scope/admin-email-blocks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/email_domain_blocks/
4 |
--------------------------------------------------------------------------------
/scope/admin-ip-blocks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/ip_blocks/
4 |
--------------------------------------------------------------------------------
/scope/admin-measures.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/measures/
4 |
--------------------------------------------------------------------------------
/scope/admin-reports.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/reports/
4 |
--------------------------------------------------------------------------------
/scope/admin-retention.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/retention/
4 |
--------------------------------------------------------------------------------
/scope/admin-trends.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | // https://docs.joinmastodon.org/methods/admin/trends/
4 |
--------------------------------------------------------------------------------
/scope/announcements.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Announcements API Methods
5 | * For announcements set by administration
6 | * https://docs.joinmastodon.org/methods/announcements/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/announcements/#get
10 | const GetAnnouncements = "*"
11 |
12 | // https://docs.joinmastodon.org/methods/announcements/#dismiss
13 | const PostAnnoucement_Dismis = "write:accounts"
14 |
15 | // https://docs.joinmastodon.org/methods/announcements/#put-reactions
16 | const PutAnnouncement_Reaction = "write:favourites"
17 |
18 | // https://docs.joinmastodon.org/methods/announcements/#delete-reactions
19 | const DeleteAnnouncement_Reaction = "write:favourites"
20 |
--------------------------------------------------------------------------------
/scope/apps.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Apps API Methods
5 | * Register client applications that can be used to obtain OAuth tokens
6 | * https://docs.joinmastodon.org/methods/apps/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/apps/#create
10 | const PostApplication = ""
11 |
12 | // https://docs.joinmastodon.org/methods/apps/#verify_credentials
13 | const GetApplication_VerifyCredentials = Private
14 |
--------------------------------------------------------------------------------
/scope/blocks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Blocks API Methods
5 | * View your blocks. See also accounts/:id/blocks
6 | * https://docs.joinmastodon.org/methods/blocks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/blocks/#get
10 | const GetBlocks = ReadBlocks
11 |
--------------------------------------------------------------------------------
/scope/bookmarks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Bookmarks API Methods
5 | * View your bookmarks. See also statuses/:id/(bookmark,unbookmark)
6 | * https://docs.joinmastodon.org/methods/bookmarks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/bookmarks/#get
10 | const GetBookmarks = ReadBookmarks
11 |
--------------------------------------------------------------------------------
/scope/conversations.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Conversations API Methods
5 | * Direct conversations with other participants.
6 | * (Currently, just threads containing a post with "direct" visibility.)
7 | * https://docs.joinmastodon.org/methods/conversations/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/conversations/#get
11 | const GetConversations = ReadStatuses
12 |
13 | // https://docs.joinmastodon.org/methods/conversations/#delete
14 | const DeleteConversation = WriteConversations
15 |
16 | // https://docs.joinmastodon.org/methods/conversations/#read
17 | const PostConversationRead = WriteConversations
18 |
--------------------------------------------------------------------------------
/scope/custom-emojis.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Custom Emoji API Methods
5 | * Each site can define and upload its own custom emoji to be attached to profiles or statuses.
6 | * https://docs.joinmastodon.org/methods/custom_emojis/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/custom_emojis/#get
10 | const GetCustomEmojis = Public
11 |
--------------------------------------------------------------------------------
/scope/directory.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Directory API Methods
5 | * A directory of profiles that your website is aware of.
6 | * https://docs.joinmastodon.org/methods/directory/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/directory/#get
10 | const GetDirectory = Public
11 |
--------------------------------------------------------------------------------
/scope/domain-blocks.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Domain Blocks API Methods
5 | * Manage a User's blocked domains.
6 | * https://docs.joinmastodon.org/methods/domain_blocks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/domain_blocks/#get
10 | const GetDomainBlocks = ReadBlocks
11 |
12 | // https://docs.joinmastodon.org/methods/domain_blocks/#block
13 | const PostDomainBlock = WriteBlocks
14 |
15 | // https://docs.joinmastodon.org/methods/domain_blocks/#unblock
16 | const DeleteDomainBlock = WriteBlocks
17 |
--------------------------------------------------------------------------------
/scope/emails.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Emails API Methods
5 | * Request a new confirmation email, potentially to a new email address
6 | * https://docs.joinmastodon.org/methods/emails/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/emails/#confirmation
10 | const PostEmailConfirmation = Private
11 |
--------------------------------------------------------------------------------
/scope/endorsements.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Endorsements API Methods
5 | * Feature other profiles on your own profile. See also accounts/:id/{pin,unpin}
6 | * https://docs.joinmastodon.org/methods/endorsements/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/endorsements/#get
10 | const GetEndorsements = ReadAccounts
11 |
--------------------------------------------------------------------------------
/scope/favourites.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Favourites API Methods
5 | * View your favourites. See also /statuses/:id/{favourite,unfavourite}
6 | * https://docs.joinmastodon.org/methods/favourites/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/favourites/#get
10 | const GetFavourites = ReadFavourites
11 |
--------------------------------------------------------------------------------
/scope/featured-tags.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Featured Tags API Methods
5 | * Feature tags that you use frequently on your profile
6 | * https://docs.joinmastodon.org/methods/featured_tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/featured_tags/#get
10 | const GetFeaturedTags = ReadAccounts
11 |
12 | // https://docs.joinmastodon.org/methods/featured_tags/#feature
13 | const PostFeaturedTag = WriteAccounts
14 |
15 | // https://docs.joinmastodon.org/methods/featured_tags/#unfeature
16 | const DeleteFeaturedTag = WriteAccounts
17 |
18 | // https://docs.joinmastodon.org/methods/featured_tags/#suggestions
19 | const GetFeaturedTags_Suggestions = ReadAccounts
20 |
--------------------------------------------------------------------------------
/scope/filters.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Filters API Methods
5 | * Create and manage filters
6 | * https://docs.joinmastodon.org/methods/filters/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/filters/#get
10 | const GetFilters = ReadFilters
11 |
12 | // https://docs.joinmastodon.org/methods/filters/#get-one
13 | const GetFilter = ReadFilters
14 |
15 | // https://docs.joinmastodon.org/methods/filters/#create
16 | const PostFilter = WriteFilters
17 |
18 | // https://docs.joinmastodon.org/methods/filters/#update
19 | const PutFilter = WriteFilters
20 |
21 | // https://docs.joinmastodon.org/methods/filters/#delete
22 | const DeleteFilter = WriteFilters
23 |
24 | // https://docs.joinmastodon.org/methods/filters/#keywords-get
25 | const GetFilter_Keywords = ReadFilters
26 |
27 | // https://docs.joinmastodon.org/methods/filters/#keywords-create
28 | const PostFilter_Keyword = WriteFilters
29 |
30 | // https://docs.joinmastodon.org/methods/filters/#keywords-get-one
31 | const GetFilter_Keyword = ReadFilters
32 |
33 | // https://docs.joinmastodon.org/methods/filters/#keywords-update
34 | const PutFilter_Keyword = WriteFilters
35 |
36 | // https://docs.joinmastodon.org/methods/filters/#keywords-delete
37 | const DeleteFilter_Keyword = WriteFilters
38 |
39 | // https://docs.joinmastodon.org/methods/filters/#statuses-get
40 | const GetFilter_Statuses = ReadFilters
41 |
42 | // https://docs.joinmastodon.org/methods/filters/#statuses-add
43 | const PostFilter_Status = WriteFilters
44 |
45 | // https://docs.joinmastodon.org/methods/filters/#statuses-get-one
46 | const GetFilter_Status = ReadFilters
47 |
48 | // https://docs.joinmastodon.org/methods/filters/#statuses-remove
49 | const DeleteFilter_Status = WriteFilters
50 |
51 | // https://docs.joinmastodon.org/methods/filters/#get-v1
52 | const GetFilters_V1 = ReadFilters
53 |
54 | // https://docs.joinmastodon.org/methods/filters/#get-one-v1
55 | const GetFilter_V1 = ReadFilters
56 |
57 | // https://docs.joinmastodon.org/methods/filters/#create-v1
58 | const PostFilter_V1 = WriteFilters
59 |
60 | // https://docs.joinmastodon.org/methods/filters/#update-v1
61 | const PutFilter_V1 = WriteFilters
62 |
63 | // https://docs.joinmastodon.org/methods/filters/#delete-v1
64 | const DeleteFilter_V1 = WriteFilters
65 |
--------------------------------------------------------------------------------
/scope/follow-requests.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Follow Requests API Methods
5 | * View and manage follow requests
6 | * https://docs.joinmastodon.org/methods/follow_requests/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/follow_requests/#get
10 | const GetFollowRequests = ReadFollows
11 |
12 | // https://docs.joinmastodon.org/methods/follow_requests/#accept
13 | const PostFollowRequest_Authorize = WriteFollows
14 |
15 | // https://docs.joinmastodon.org/methods/follow_requests/#reject
16 | const PostFollowRequest_Reject = WriteFollows
17 |
--------------------------------------------------------------------------------
/scope/followed-tags.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Followed Tags API Methods
5 | * View your followed hashtags
6 | * https://docs.joinmastodon.org/methods/followed_tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/followed_tags/#get
10 | const GetFollowedTags = ReadFollows
11 |
--------------------------------------------------------------------------------
/scope/instance.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Instance API Methods
5 | * Discover information about a Mastodon website
6 | * https://docs.joinmastodon.org/methods/instance/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/instance/#v2
10 | const GetInstance = Public
11 |
12 | // https://docs.joinmastodon.org/methods/instance/#peers
13 | const GetInstance_Peers = Public
14 |
15 | // https://docs.joinmastodon.org/methods/instance/#activity
16 | const GetInstance_Activity = Public
17 |
18 | // https://docs.joinmastodon.org/methods/instance/#rules
19 | const GetInstance_Rules = Public
20 |
21 | // https://docs.joinmastodon.org/methods/instance/#domain_blocks
22 | const GetInstance_DomainBlocks = Public
23 |
24 | // https://docs.joinmastodon.org/methods/instance/#extended_description
25 | const GetInstance_ExtendedDescription = Public
26 |
27 | // https://docs.joinmastodon.org/methods/instance/#v1
28 | const GetInstance_V1 = Public
29 |
--------------------------------------------------------------------------------
/scope/lists.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Lists API Methods
5 | * View and manage lists. See also /api/v1/timelines/list/:id for loading a list timeline
6 | * https://docs.joinmastodon.org/methods/lists/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/lists/#get
10 | const GetLists = ReadLists
11 |
12 | // https://docs.joinmastodon.org/methods/lists/#get-one
13 | const GetList = WriteLists
14 |
15 | // https://docs.joinmastodon.org/methods/lists/#create
16 | const PostList = WriteLists
17 |
18 | // https://docs.joinmastodon.org/methods/lists/#update
19 | const PutList = WriteLists
20 |
21 | // https://docs.joinmastodon.org/methods/lists/#delete
22 | const DeleteList = WriteLists
23 |
24 | // https://docs.joinmastodon.org/methods/lists/#accounts
25 | const GetList_Accounts = ReadLists
26 |
27 | // https://docs.joinmastodon.org/methods/lists/#accounts-add
28 | const PostList_Accounts = WriteLists
29 |
30 | // https://docs.joinmastodon.org/methods/lists/#accounts-remove
31 | const DeleteList_Accounts = WriteLists
32 |
--------------------------------------------------------------------------------
/scope/markers.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Markers API Methods
5 | * Save and restore your position in timelines
6 | * https://docs.joinmastodon.org/methods/markers/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/markers/#get
10 | const GetMarkers = ReadStatuses
11 |
12 | // https://docs.joinmastodon.org/methods/markers/#create
13 | const PostMarker = WriteStatuses
14 |
--------------------------------------------------------------------------------
/scope/media.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Media API Methods
5 | * Attach media to authored statuses. See Using Mastodon > Posting toots > Attachments
6 | * for more information about size and format limits
7 | * https://docs.joinmastodon.org/methods/media/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/media/#v2
11 | const PostMedia = WriteMedia
12 |
--------------------------------------------------------------------------------
/scope/mutes.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Mutes API Methods
5 | * View your mutes. See also /accounts/:id/{mute,unmute}
6 | * https://docs.joinmastodon.org/methods/mutes/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/mutes/#get
10 | const GetMutes = ReadMutes
11 |
--------------------------------------------------------------------------------
/scope/notifications.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Notifications API Methods
5 | * Receive notifications for activity on your account or statuses
6 | * https://docs.joinmastodon.org/methods/notifications/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/notifications/#get
10 | const GetNotifications = ReadNotifications
11 |
12 | // https://docs.joinmastodon.org/methods/notifications/#get-one
13 | const GetNotification = ReadNotifications
14 |
15 | // https://docs.joinmastodon.org/methods/notifications/#clear
16 | const PostNotifications_Clear = WriteNotifications
17 |
18 | // https://docs.joinmastodon.org/methods/notifications/#dismiss
19 | const PostNotification_Dismiss = WriteNotifications
20 |
--------------------------------------------------------------------------------
/scope/oauth.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * OAuth API Methods
5 | * Generate and manage OAuth tokens
6 | * https://docs.joinmastodon.org/methods/oauth/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/oauth/#authorize
10 | const GetOAuth_Authorize = Public
11 |
12 | // https://docs.joinmastodon.org/methods/oauth/#token
13 | const PostOAuth_Token = Public
14 |
15 | // https://docs.joinmastodon.org/methods/oauth/#revoke
16 | const PostOAuth_Revoke = Public
17 |
--------------------------------------------------------------------------------
/scope/oembed.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * OEmbed API Methods
5 | * For generating OEmbed previews
6 | * https://docs.joinmastodon.org/methods/oembed/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/oembed/#get
10 | const GetOEmbed = Public
11 |
--------------------------------------------------------------------------------
/scope/polls.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Polls API Methods
5 | * View and vode on polls attached to statuses. To discover pollID,
6 | * you will need to GET a Status first and then check for a `poll` property.
7 | * https://docs.joinmastodon.org/methods/polls/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/polls/#get
11 | const GetPoll = ReadStatuses
12 |
13 | // https://docs.joinmastodon.org/methods/polls/#vote
14 | const PostPoll_Votes = WriteStatuses
15 |
--------------------------------------------------------------------------------
/scope/preferences.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Preferences API Methods
5 | * Preferred common behaviors to be shared across clients.
6 | * https://docs.joinmastodon.org/methods/preferences/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/preferences/#get
10 | const GetPreferences = ReadAccounts
11 |
--------------------------------------------------------------------------------
/scope/profile.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Profile API Methods
5 | * Methods concerning profiles
6 | * https://docs.joinmastodon.org/methods/profile/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/profile/#delete-profile-avatar
10 | const DeleteProfile_Avatar = WriteAccounts
11 |
12 | // https://docs.joinmastodon.org/methods/profile/#delete-profile-header
13 | const DeleteProfile_Header = WriteAccounts
14 |
--------------------------------------------------------------------------------
/scope/push.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Push API Methods
5 | * Subscribe to and receive push notifications when a server-side
6 | * notification is received, via the Web Push API
7 | * https://docs.joinmastodon.org/methods/push/
8 | ******************************************/
9 |
--------------------------------------------------------------------------------
/scope/reports.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Reports API Methods
5 | * Report problematic users to your moderators
6 | * https://docs.joinmastodon.org/methods/reports/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/reports/#post
10 | const PostReport = WriteReports
11 |
--------------------------------------------------------------------------------
/scope/scheduled-statuses.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Scheduled Statuses API Methods
5 | * Manage statuses that were scheduled to be published at a future date.
6 | * https://docs.joinmastodon.org/methods/scheduled_statuses/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#get
10 | const GetScheduledStatuses = ReadStatuses
11 |
12 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#get-one
13 | const GetScheduledStatus = ReadStatuses
14 |
15 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#update
16 | const PutScheduledStatus = WriteStatuses
17 |
18 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#cancel
19 | const DeleteScheduledStatus = WriteStatuses
20 |
--------------------------------------------------------------------------------
/scope/scope.go:
--------------------------------------------------------------------------------
1 | // Package scope contains scope definitions for every Mastodon API route.
2 | package scope
3 |
4 | /******************************************
5 | * OAuth Scopes
6 | * Defining what you have permission to do with the API
7 | * https://docs.joinmastodon.org/api/oauth-scopes/
8 | ******************************************/
9 |
10 | // Public is not defined by the Mastodon API, but is used by this library
11 | // to indicate a public route that does not require an App token.
12 | const Public = ""
13 |
14 | // Private is not defined by the Mastodon API, but is used by this library
15 | // to indicate a private route that requires an App token, but does not
16 | // require any specific scope.
17 | const Private = "*"
18 |
19 | // https://docs.joinmastodon.org/api/oauth-scopes/#read
20 | const Read = "read"
21 |
22 | const ReadAccounts = "read:accounts"
23 |
24 | const ReadBlocks = "read:blocks"
25 |
26 | const ReadBookmarks = "read:bookmarks"
27 |
28 | const ReadFavourites = "read:favourites"
29 |
30 | const ReadFilters = "read:filters"
31 |
32 | const ReadFollows = "read:follows"
33 |
34 | const ReadLists = "read:lists"
35 |
36 | const ReadMutes = "read:mutes"
37 |
38 | const ReadNotifications = "read:notifications"
39 |
40 | const ReadSearch = "read:search"
41 |
42 | const ReadStatuses = "read:statuses"
43 |
44 | // https://docs.joinmastodon.org/api/oauth-scopes/#write
45 | const Write = "write"
46 |
47 | const WriteAccounts = "write:accounts"
48 |
49 | const WriteBlocks = "write:blocks"
50 |
51 | const WriteBookmarks = "write:bookmarks"
52 |
53 | const WriteConversations = "write:conversations"
54 |
55 | const WriteFavourites = "write:favourites"
56 |
57 | const WriteFilters = "write:filters"
58 |
59 | const WriteFollows = "write:follows"
60 |
61 | const WriteLists = "write:lists"
62 |
63 | const WriteMedia = "write:media"
64 |
65 | const WriteMutes = "write:mutes"
66 |
67 | const WriteNotifications = "write:notifications"
68 |
69 | const WriteReports = "write:reports"
70 |
71 | const WriteStatuses = "write:statuses"
72 |
73 | // https://docs.joinmastodon.org/api/oauth-scopes/#push
74 | const Push = "push"
75 |
76 | // https://docs.joinmastodon.org/api/oauth-scopes/#admin
77 | const AdminRead = "admin:read"
78 |
79 | const AdminReadAccounts = "admin:read:accounts"
80 |
81 | const AdminReadReports = "admin:read:reports"
82 |
83 | const AdminReadDomainAllows = "admin:read:domain_allows"
84 |
85 | const AdminReadDomainBlocks = "admin:read:domain_blocks"
86 |
87 | const AdminReadIPBlocks = "admin:read:ip_blocks"
88 |
89 | const AdminReadEmailDomainBlocks = "admin:read:email_domain_blocks"
90 |
91 | const AdminReadCanonicalEmailBlocks = "admin:read:canonical_email_blocks"
92 |
93 | const AdminWrite = "admin:write"
94 |
95 | const AdminWriteAccounts = "admin:write:accounts"
96 |
97 | const AdminWriteReports = "admin:write:reports"
98 |
99 | const AdminWriteDomainAllows = "admin:write:domain_allows"
100 |
101 | const AdminWriteDomainBlocks = "admin:write:domain_blocks"
102 |
103 | const AdminWriteIPBlocks = "admin:write:ip_blocks"
104 |
105 | const AdminWriteEmailDomainBlocks = "admin:write:email_domain_blocks"
106 |
107 | const AdminWriteCanonicalEmailBlocks = "admin:write:canonical_email_blocks"
108 |
--------------------------------------------------------------------------------
/scope/search.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Search API Methods
5 | * Search for content in accounts, statuses and hashtags
6 | * https://docs.joinmastodon.org/methods/search/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/search/#v2
10 | const GetSearch = ReadSearch
11 |
--------------------------------------------------------------------------------
/scope/statuses.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Statuses API Methods
5 | * Publish, interact, and view information about statuses
6 | * https://docs.joinmastodon.org/methods/statuses/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/statuses/#create
10 | const PostStatus = WriteStatuses
11 |
12 | // https://docs.joinmastodon.org/methods/statuses/#get
13 | const GetStatus = ReadStatuses
14 |
15 | // https://docs.joinmastodon.org/methods/statuses/#delete
16 | const DeleteStatus = WriteStatuses
17 |
18 | // https://docs.joinmastodon.org/methods/statuses/#context
19 | const GetStatus_Context = ReadStatuses
20 |
21 | // https://docs.joinmastodon.org/methods/statuses/#translate
22 | const PostStatus_Translate = WriteStatuses
23 |
24 | // https://docs.joinmastodon.org/methods/statuses/#reblogged_by
25 | const GetStatus_RebloggedBy = ReadStatuses
26 |
27 | // https://docs.joinmastodon.org/methods/statuses/#favourited_by
28 | const GetStatus_FavouritedBy = ReadStatuses
29 |
30 | // https://docs.joinmastodon.org/methods/statuses/#favourite
31 | const PostStatus_Favourite = WriteStatuses
32 |
33 | // https://docs.joinmastodon.org/methods/statuses/#unfavourite
34 | const PostStatus_Unfavourite = WriteStatuses
35 |
36 | // https://docs.joinmastodon.org/methods/statuses/#reblog
37 | const PostStatus_Reblog = WriteStatuses
38 |
39 | // https://docs.joinmastodon.org/methods/statuses/#unreblog
40 | const PostStatus_Unreblog = WriteStatuses
41 |
42 | // https://docs.joinmastodon.org/methods/statuses/#bookmark
43 | const PostStatus_Bookmark = WriteStatuses
44 |
45 | // https://docs.joinmastodon.org/methods/statuses/#unbookmark
46 | const PostStatus_Unbookmark = WriteStatuses
47 |
48 | // https://docs.joinmastodon.org/methods/statuses/#mute
49 | const PostStatus_Mute = WriteStatuses
50 |
51 | // https://docs.joinmastodon.org/methods/statuses/#unmute
52 | const PostStatus_Unmute = WriteStatuses
53 |
54 | // https://docs.joinmastodon.org/methods/statuses/#pin
55 | const PostStatus_Pin = WriteStatuses
56 |
57 | // https://docs.joinmastodon.org/methods/statuses/#unpin
58 | const PostStatus_Unpin = WriteStatuses
59 |
60 | // https://docs.joinmastodon.org/methods/statuses/#edit
61 | const PutStatus = WriteStatuses
62 |
63 | // https://docs.joinmastodon.org/methods/statuses/#history
64 | const GetStatus_History = ReadStatuses
65 |
66 | // https://docs.joinmastodon.org/methods/statuses/#source
67 | const GetStatus_Source = ReadStatuses
68 |
--------------------------------------------------------------------------------
/scope/streaming.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Streaming API Methods
5 | * Subscribe to server-sent events for real-time updates
6 | * via long-lived HTTP connections or via WebSocket
7 | * https://docs.joinmastodon.org/methods/streaming/
8 | ******************************************/
9 |
--------------------------------------------------------------------------------
/scope/suggestions.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Suggestions API Methods
5 | * Server-generated suggestions on who to follow, based on previous
6 | * positive interactions
7 | * https://docs.joinmastodon.org/methods/suggestions/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/suggestions/#v2
11 | const GetSuggestions = Read
12 |
13 | // https://docs.joinmastodon.org/methods/suggestions/#remove
14 | const DeleteSuggestion = Read
15 |
--------------------------------------------------------------------------------
/scope/tags.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Tags API Methods
5 | * View information about or follow/unfollow hashtags
6 | * https://docs.joinmastodon.org/methods/tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/tags/#get
10 | const GetTag = Public
11 |
12 | // https://docs.joinmastodon.org/methods/tags/#follow
13 | const PostTag_Follow = WriteFollows
14 |
15 | // https://docs.joinmastodon.org/methods/tags/#unfollow
16 | const PostTag_Unfollow = WriteFollows
17 |
--------------------------------------------------------------------------------
/scope/timelines.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Timelines API Methods
5 | * Read and view timelines of statuses
6 | * https://docs.joinmastodon.org/methods/timelines/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/timelines/#public
10 | const GetTimeline_Public = ReadStatuses
11 |
12 | // https://docs.joinmastodon.org/methods/timelines/#tag
13 | const GetTimeline_Hashtag = ReadStatuses
14 |
15 | // https://docs.joinmastodon.org/methods/timelines/#home
16 | const GetTimeline_Home = ReadStatuses
17 |
18 | // https://docs.joinmastodon.org/methods/timelines/#list
19 | const GetTimeline_List = ReadStatuses
20 |
--------------------------------------------------------------------------------
/scope/trends.go:
--------------------------------------------------------------------------------
1 | package scope
2 |
3 | /******************************************
4 | * Trends API Methods
5 | * View hashtags that are currently being used more frequently than usual.
6 | * https://docs.joinmastodon.org/methods/trends/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/trends/#tags
10 | const GetTrends = Public
11 |
12 | // https://docs.joinmastodon.org/methods/trends/#statuses
13 | const GetTrends_Statuses = Public
14 |
15 | // https://docs.joinmastodon.org/methods/trends/#links
16 | const GetTrends_Links = Public
17 |
--------------------------------------------------------------------------------
/txn/accounts.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Accounts API Methods
5 | * Methods concerning accounts and profiles
6 | * https://docs.joinmastodon.org/methods/accounts/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/accounts/#create
10 | // POST /api/v1/accounts
11 | // Returns: Token
12 | // Register an account
13 | type PostAccount struct {
14 | Host string `header:"Host"`
15 | Username string `form:"username"`
16 | Email string `form:"email"`
17 | Password string `form:"password"`
18 | Agreement bool `form:"agreement"`
19 | Locale string `form:"locale"`
20 | Reason string `form:"reason"`
21 | }
22 |
23 | // https://docs.joinmastodon.org/methods/accounts/#verify_credentials
24 | // GET /api/v1/accounts/verify_credentials
25 | // Returns: CredentialAccount
26 | // Test to make sure that the user token works.
27 | type GetAccount_VerifyCredentials struct {
28 | Host string `header:"Host"`
29 | }
30 |
31 | // https://docs.joinmastodon.org/methods/accounts/#update_credentials
32 | // PATCH /api/v1/accounts/update_credentials
33 | type PatchAccount_UpdateCredentials struct {
34 | Host string `header:"Host"`
35 | DisplayName string `form:"display_name"`
36 | Note string `form:"note"`
37 | Avatar string `form:"avatar"`
38 | Header string `form:"header"`
39 | Locked bool `form:"locked"`
40 | Bot bool `form:"bot"`
41 | Discoverable bool `form:"discoverable"`
42 | }
43 |
44 | // https://docs.joinmastodon.org/methods/accounts/#get
45 | // GET /api/v1/accounts/:id
46 | type GetAccount struct {
47 | Host string `header:"Host"`
48 | ID string `param:"id"`
49 | }
50 |
51 | // https://docs.joinmastodon.org/methods/accounts/#statuses
52 | // GET /api/v1/accounts/:id/statuses
53 | type GetAccount_Statuses struct {
54 | Host string `header:"Host"`
55 | ID string `param:"id"`
56 | MaxID string `query:"max_id"`
57 | SinceID string `query:"since_id"`
58 | MinID string `query:"min_id"`
59 | Limit int64 `query:"limit"`
60 | OnlyMedia bool `query:"only_media"`
61 | ExcludeReplies bool `query:"exclude_replies"`
62 | ExcludeReblogs bool `query:"exclude_reblogs"`
63 | Pinned bool `query:"pinned"`
64 | Tagged string `query:"tagged"`
65 | }
66 |
67 | // QueryPage implements the QueryPager interface, returning
68 | // the QueryPage data embedded in this transaction
69 | func (t GetAccount_Statuses) QueryPage() QueryPage {
70 | return QueryPage{
71 | MaxID: t.MaxID,
72 | SinceID: t.SinceID,
73 | MinID: t.MinID,
74 | Limit: t.Limit,
75 | }
76 | }
77 |
78 | // https://docs.joinmastodon.org/methods/accounts/#followers
79 | // GET /api/v1/accounts/:id/followers
80 | type GetAccount_Followers struct {
81 | Host string `header:"Host"`
82 | ID string `param:"id"`
83 | MaxID string `query:"max_id"`
84 | SinceID string `query:"since_id"`
85 | MinID string `query:"min_id"`
86 | Limit int64 `query:"limit"`
87 | }
88 |
89 | // QueryPage implements the QueryPager interface, returning
90 | // the QueryPage data embedded in this transaction
91 | func (t GetAccount_Followers) QueryPage() QueryPage {
92 | return QueryPage{
93 | MaxID: t.MaxID,
94 | SinceID: t.SinceID,
95 | MinID: t.MinID,
96 | Limit: t.Limit,
97 | }
98 | }
99 |
100 | // https://docs.joinmastodon.org/methods/accounts/#following
101 | // GET /api/v1/accounts/:id/following
102 | type GetAccount_Following struct {
103 | Host string `header:"Host"`
104 | ID string `param:"id"`
105 | MaxID string `query:"max_id"`
106 | SinceID string `query:"since_id"`
107 | MinID string `query:"min_id"`
108 | Limit int64 `query:"limit"`
109 | }
110 |
111 | // QueryPage implements the QueryPager interface, returning
112 | // the QueryPage data embedded in this transaction
113 | func (t GetAccount_Following) QueryPage() QueryPage {
114 | return QueryPage{
115 | MaxID: t.MaxID,
116 | SinceID: t.SinceID,
117 | MinID: t.MinID,
118 | Limit: t.Limit,
119 | }
120 | }
121 |
122 | // https://docs.joinmastodon.org/methods/accounts/#featured_tags
123 | // GET /api/v1/accounts/:id/featured_tags
124 | type GetAccount_FeaturedTags struct {
125 | Host string `header:"Host"`
126 | ID string `param:"id"`
127 | }
128 |
129 | // https://docs.joinmastodon.org/methods/accounts/#lists
130 | // GET /api/v1/accounts/:id/lists
131 | type GetAccount_Lists struct {
132 | Host string `header:"Host"`
133 | ID string `param:"id"`
134 | }
135 |
136 | // https://docs.joinmastodon.org/methods/accounts/#follow
137 | // POST /api/v1/accounts/:id/follow
138 | type PostAccount_Follow struct {
139 | Host string `header:"Host"`
140 | ID string `param:"id"`
141 | Reblogs bool `form:"reblogs"`
142 | Notify bool `form:"notify"`
143 | Languages []string `form:"languages"`
144 | }
145 |
146 | // https://docs.joinmastodon.org/methods/accounts/#unfollow
147 | // POST /api/v1/accounts/:id/unfollow
148 | type PostAccount_Unfollow struct {
149 | Host string `header:"Host"`
150 | ID string `param:"id"`
151 | }
152 |
153 | // https://docs.joinmastodon.org/methods/accounts/#remove_from_followers
154 | // POST /api/v1/accounts/:id/remove_from_followers
155 | // Returns: Relationship
156 | type PostAccount_RemoveFromFollowers struct {
157 | Host string `header:"Host"`
158 | ID string `param:"id"`
159 | }
160 |
161 | // https://docs.joinmastodon.org/methods/accounts/#block
162 | // POST /api/v1/accounts/:id/block
163 | // Returns: Relationship
164 | type PostAccount_Block struct {
165 | Host string `header:"Host"`
166 | ID string `param:"id"`
167 | }
168 |
169 | // https://docs.joinmastodon.org/methods/accounts/#unblock
170 | // POST /api/v1/accounts/:id/unblock
171 | // Returns: Relationship
172 | type PostAccount_Unblock struct {
173 | Host string `header:"Host"`
174 | ID string `param:"id"`
175 | }
176 |
177 | // https://docs.joinmastodon.org/methods/accounts/#mute
178 | // POST /api/v1/accounts/:id/mute
179 | // Returns: Relationship
180 | type PostAccount_Mute struct {
181 | Host string `header:"Host"`
182 | ID string `param:"id"`
183 | Notifications bool `form:"notifications"`
184 | Duration bool `form:"duration"`
185 | }
186 |
187 | // https://docs.joinmastodon.org/methods/accounts/#unmute
188 | // POST /api/v1/accounts/:id/unmute
189 | // Returns: Relationship
190 | type PostAccount_Unmute struct {
191 | Host string `header:"Host"`
192 | ID string `param:"id"`
193 | }
194 |
195 | // https://docs.joinmastodon.org/methods/accounts/#pin
196 | // POST /api/v1/accounts/:id/pin
197 | // Returns: Relationship
198 | type PostAccount_Pin struct {
199 | Host string `header:"Host"`
200 | ID string `param:"id"`
201 | }
202 |
203 | // https://docs.joinmastodon.org/methods/accounts/#unpin
204 | // POST /api/v1/accounts/:id/unpin
205 | // Returns: Relationship
206 | type PostAccount_Unpin struct {
207 | Host string `header:"Host"`
208 | ID string `param:"id"`
209 | }
210 |
211 | // https://docs.joinmastodon.org/methods/accounts/#note
212 | // POST /api/v1/accounts/:id/note
213 | // Returns: Relationship
214 | type PostAccount_Note struct {
215 | Host string `header:"Host"`
216 | ID string `param:"id"`
217 | Comment string `form:"comment"`
218 | }
219 |
220 | // https://docs.joinmastodon.org/methods/accounts/#relationships
221 | // GET /api/v1/accounts/relationships
222 | // Returns: Array of Relationships
223 | type GetAccount_Relationships struct {
224 | Host string `header:"Host"`
225 | IDs []string `query:"id[]"`
226 | }
227 |
228 | // https://docs.joinmastodon.org/methods/accounts/#familiar_followers
229 | // GET /api/v1/accounts/:id/familiar_followers
230 | // Returns: Array of FamiliarFollower
231 | type GetAccount_FamiliarFollowers struct {
232 | Host string `header:"Host"`
233 | ID string `param:"id[]"`
234 | }
235 |
236 | // https://docs.joinmastodon.org/methods/accounts/#search
237 | // GET /api/v1/accounts/search
238 | // Returns: Array of Account
239 | type GetAccount_Search struct {
240 | Host string `header:"Host"`
241 | Q string `query:"q"`
242 | Limit int `query:"limit"`
243 | Offset int `query:"offset"`
244 | Resolve bool `query:"resolve"`
245 | Following bool `query:"following"`
246 | }
247 |
248 | // https://docs.joinmastodon.org/methods/accounts/#lookup
249 | // GET /api/v1/accounts/lookup
250 | // Returns: Account
251 | type GetAccount_Lookup struct {
252 | Host string `header:"Host"`
253 | Acct string `query:"acct"`
254 | }
255 |
--------------------------------------------------------------------------------
/txn/admin-.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/
4 |
--------------------------------------------------------------------------------
/txn/admin-accounts.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/accounts/
4 |
--------------------------------------------------------------------------------
/txn/admin-canonical-email-blocks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/canonical_email_blocks/
4 |
--------------------------------------------------------------------------------
/txn/admin-dimensions.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/dimensions/
4 |
--------------------------------------------------------------------------------
/txn/admin-domain-allows.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/domain_allows/
4 |
--------------------------------------------------------------------------------
/txn/admin-domain-blocks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/domain_blocks/
4 |
--------------------------------------------------------------------------------
/txn/admin-email-blocks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/email_domain_blocks/
4 |
--------------------------------------------------------------------------------
/txn/admin-ip-blocks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/ip_blocks/
4 |
--------------------------------------------------------------------------------
/txn/admin-measures.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/measures/
4 |
--------------------------------------------------------------------------------
/txn/admin-reports.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/reports/
4 |
--------------------------------------------------------------------------------
/txn/admin-retention.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/retention/
4 |
--------------------------------------------------------------------------------
/txn/admin-trends.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // https://docs.joinmastodon.org/methods/admin/trends/
4 |
--------------------------------------------------------------------------------
/txn/announcements.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Announcements API Methods
5 | * For announcements set by administration
6 | * https://docs.joinmastodon.org/methods/announcements/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/announcements/#get
10 | // GET /api/v1/announcements
11 | // Returns: Array of Announcement
12 | type GetAnnouncements struct {
13 | Host string `header:"Host"`
14 | Authorization string `header:"Authorization"`
15 | WithDismissed bool `query:"with_dismissed"`
16 | }
17 |
18 | // https://docs.joinmastodon.org/methods/announcements/#dismiss
19 | // POST /api/v1/announcements/:id/dismiss
20 | // Returns: Empty struct
21 | type PostAnnouncement_Dismiss struct {
22 | Host string `header:"Host"`
23 | Authorization string `header:"Authorization"`
24 | ID string `param:"id"`
25 | }
26 |
27 | // https://docs.joinmastodon.org/methods/announcements/#put-reactions
28 | // PUT /api/v1/announcements/:id/reactions/:name
29 | // Returns: Empty struct
30 | type PutAnnouncement_Reaction struct {
31 | Host string `header:"Host"`
32 | ID string `param:"id"`
33 | Name string `param:"name"`
34 | }
35 |
36 | // https://docs.joinmastodon.org/methods/announcements/#delete-reactions
37 | // DELETE /api/v1/announcements/:id/reactions/:name
38 | // Returns: Empty struct
39 | type DeleteAnnouncement_Reaction struct {
40 | Host string `header:"Host"`
41 | ID string `param:"id"`
42 | Name string `param:"name"`
43 | }
44 |
--------------------------------------------------------------------------------
/txn/apps.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Apps API Methods
5 | * Register client applications that can be used to obtain OAuth tokens
6 | * https://docs.joinmastodon.org/methods/apps/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/apps/#create
10 | // POST /api/v1/apps
11 | // Returns: Application
12 | type PostApplication struct {
13 | Host string `header:"Host"`
14 | ClientName string `form:"client_name" json:"client_name"`
15 | RedirectURIs string `form:"redirect_uris" json:"redirect_uris"`
16 | Scopes string `form:"scopes" json:"scopes"`
17 | Website string `form:"website" json:"website"`
18 | }
19 |
20 | // https://docs.joinmastodon.org/methods/apps/#verify_credentials
21 | // GET /api/v1/apps/verify_credentials
22 | // Returns: Application
23 | type GetApplication_VerifyCredentials struct {
24 | Host string `header:"Host"`
25 | }
26 |
--------------------------------------------------------------------------------
/txn/blocks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Blocks API Methods
5 | * View your blocks. See also accounts/:id/blocks
6 | * https://docs.joinmastodon.org/methods/blocks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/blocks/#get
10 | // GET /api/v1/blocks
11 | // Returns: Array of Account
12 | type GetBlocks struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | SinceID string `query:"since_id"`
16 | MinID string `query:"min_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetBlocks) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | SinceID: t.SinceID,
26 | MinID: t.MinID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/txn/bookmarks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Bookmarks API Methods
5 | * View your bookmarks. See also statuses/:id/(bookmark,unbookmark)
6 | * https://docs.joinmastodon.org/methods/bookmarks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/bookmarks/#get
10 | // GET /api/v1/bookmarks
11 | // Returns: Array of Status
12 | // Statuses the user has bookmarked.
13 | type GetBookmarks struct {
14 | Host string `header:"Host"`
15 | MaxID string `query:"max_id"`
16 | SinceID string `query:"since_id"`
17 | MinID string `query:"min_id"`
18 | Limit int64 `query:"limit"`
19 | }
20 |
21 | // QueryPage implements the QueryPager interface, returning
22 | // the QueryPage data embedded in this transaction
23 | func (t GetBookmarks) QueryPage() QueryPage {
24 | return QueryPage{
25 | MaxID: t.MaxID,
26 | SinceID: t.SinceID,
27 | MinID: t.MinID,
28 | Limit: t.Limit,
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/txn/conversations.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Conversations API Methods
5 | * Direct conversations with other participants.
6 | * (Currently, just threads containing a post with "direct" visibility.)
7 | * https://docs.joinmastodon.org/methods/conversations/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/conversations/#get
11 | // GET /api/v1/conversations
12 | // Returns: Array of Conversation
13 | type GetConversations struct {
14 | Host string `header:"Host"`
15 | MaxID string `query:"max_id"`
16 | SinceID string `query:"since_id"`
17 | MinID string `query:"min_id"`
18 | Limit int64 `query:"limit"`
19 | }
20 |
21 | // QueryPage implements the QueryPager interface, returning
22 | // the QueryPage data embedded in this transaction
23 | func (t GetConversations) QueryPage() QueryPage {
24 | return QueryPage{
25 | MaxID: t.MaxID,
26 | SinceID: t.SinceID,
27 | MinID: t.MinID,
28 | Limit: t.Limit,
29 | }
30 | }
31 |
32 | // https://docs.joinmastodon.org/methods/conversations/#delete
33 | // DELETE /api/v1/conversations/:id
34 | // Returns: Empty struct
35 | type DeleteConversation struct {
36 | Host string `header:"Host"`
37 | ID string `uri:"id"`
38 | }
39 |
40 | // https://docs.joinmastodon.org/methods/conversations/#read
41 | // POST /api/v1/conversations/:id/read
42 | // Returns: Conversation
43 | type PostConversationRead struct {
44 | Host string `header:"Host"`
45 | ID string `uri:"id"`
46 | }
47 |
--------------------------------------------------------------------------------
/txn/custom-emojis.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Custom Emoji API Methods
5 | * Each site can define and upload its own custom emoji to be attached to profiles or statuses.
6 | * https://docs.joinmastodon.org/methods/custom_emojis/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/custom_emojis/#get
10 | // GET /api/v1/custom_emojis
11 | // Returns: Array of CustomEmoji
12 | // Returns custom emojis that are available on the server.
13 | type GetCustomEmojis struct{}
14 |
--------------------------------------------------------------------------------
/txn/directory.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Directory API Methods
5 | * A directory of profiles that your website is aware of.
6 | * https://docs.joinmastodon.org/methods/directory/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/directory/#get
10 | // GET /api/v1/directory
11 | // Returns: Array of Account
12 | // List accounts visible in the directory.
13 | type GetDirectory struct {
14 | Host string `header:"Host"`
15 | Offset int `query:"offset"`
16 | Limit int `query:"limit"`
17 | Order string `query:"order"`
18 | Local bool `query:"local"`
19 | }
20 |
--------------------------------------------------------------------------------
/txn/domain-blocks.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Domain Blocks API Methods
5 | * Manage a User's blocked domains.
6 | * https://docs.joinmastodon.org/methods/domain_blocks/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/domain_blocks/#get
10 | // GET /api/v1/domain_blocks
11 | // Returns: Array of String
12 | type GetDomainBlocks struct {
13 | Host string `header:"Host"`
14 | Authorization string `header:"Authorization"`
15 | MaxID string `query:"max_id"`
16 | SinceID string `query:"since_id"`
17 | MinID string `query:"min_id"`
18 | Limit int64 `query:"limit"`
19 | }
20 |
21 | // QueryPage implements the QueryPager interface, returning
22 | // the QueryPage data embedded in this transaction
23 | func (t GetDomainBlocks) QueryPage() QueryPage {
24 | return QueryPage{
25 | MaxID: t.MaxID,
26 | SinceID: t.SinceID,
27 | MinID: t.MinID,
28 | Limit: t.Limit,
29 | }
30 | }
31 |
32 | // https://docs.joinmastodon.org/methods/domain_blocks/#block
33 | // POST /api/v1/domain_blocks
34 | // Returns: Empty struct
35 | type PostDomainBlock struct {
36 | Host string `header:"Host"`
37 | Domain string `form:"domain"`
38 | }
39 |
40 | // https://docs.joinmastodon.org/methods/domain_blocks/#unblock
41 | // DELETE /api/v1/domain_blocks
42 | // Returns: Empty struct
43 | type DeleteDomainBlock struct {
44 | Host string `header:"Host"`
45 | Domain string `form:"domain"`
46 | }
47 |
--------------------------------------------------------------------------------
/txn/emails.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Emails API Methods
5 | * Request a new confirmation email, potentially to a new email address
6 | * https://docs.joinmastodon.org/methods/emails/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/emails/#confirmation
10 | // POST /api/v1/email/confirmation
11 | // Returns: Empty object
12 | type PostEmailConfirmation struct {
13 | Host string `header:"Host"`
14 | }
15 |
--------------------------------------------------------------------------------
/txn/endorsements.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Endorsements API Methods
5 | * Feature other profiles on your own profile. See also accounts/:id/{pin,unpin}
6 | * https://docs.joinmastodon.org/methods/endorsements/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/endorsements/#get
10 | // GET /api/v1/endorsements
11 | // Returns: Array of Account
12 | type GetEndorsements struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | MinID string `query:"min_id"`
16 | SinceID string `query:"since_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetEndorsements) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | MinID: t.MinID,
26 | SinceID: t.SinceID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/txn/favourites.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Favourites API Methods
5 | * View your favourites. See also /statuses/:id/{favourite,unfavourite}
6 | * https://docs.joinmastodon.org/methods/favourites/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/favourites/#get
10 | // GET /api/v1/favourites
11 | // Returns: Array of Status
12 | type GetFavourites struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | SinceID string `query:"since_id"`
16 | MinID string `query:"min_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetFavourites) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | SinceID: t.SinceID,
26 | MinID: t.MinID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/txn/featured-tags.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Featured Tags API Methods
5 | * Feature tags that you use frequently on your profile
6 | * https://docs.joinmastodon.org/methods/featured_tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/featured_tags/#get
10 | // GET /api/v1/featured_tags
11 | // Returns: Array of FeaturedTag
12 | type GetFeaturedTags struct {
13 | Host string `header:"Host"`
14 | Authorization string `header:"Authorization"`
15 | }
16 |
17 | // https://docs.joinmastodon.org/methods/featured_tags/#feature
18 | // POST /api/v1/featured_tags
19 | // Returns: FeaturedTag
20 | type PostFeaturedTag struct {
21 | Host string `header:"Host"`
22 | Name string `form:"name"`
23 | }
24 |
25 | // https://docs.joinmastodon.org/methods/featured_tags/#unfeature
26 | // DELETE /api/v1/featured_tags/:id
27 | // Returns: Empty object
28 | type DeleteFeaturedTag struct {
29 | Host string `header:"Host"`
30 | ID string `param:"id"`
31 | }
32 |
33 | // https://docs.joinmastodon.org/methods/featured_tags/#suggestions
34 | // GET /api/v1/featured_tags/suggestions
35 | // Returns: Array of FeaturedTag
36 | type GetFeaturedTags_Suggestions struct {
37 | Host string `header:"Host"`
38 | }
39 |
--------------------------------------------------------------------------------
/txn/filters.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Filters API Methods
5 | * Create and manage filters
6 | * https://docs.joinmastodon.org/methods/filters/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/filters/#get
10 | // GET /api/v2/filters
11 | // Returns: Array of Filter
12 | type GetFilters struct {
13 | Host string `header:"Host"`
14 | }
15 |
16 | // https://docs.joinmastodon.org/methods/filters/#get-one
17 | // GET /api/v2/filters/:id
18 | // Returns: Filter
19 | type GetFilter struct {
20 | Host string `header:"Host"`
21 | ID string `param:"id"`
22 | }
23 |
24 | // https://docs.joinmastodon.org/methods/filters/#create
25 | // POST /api/v2/filters
26 | // Returns: Filter
27 | // Create a filter group with the given parameters.
28 | type PostFilter struct {
29 | Host string `header:"Host"`
30 | Title string `form:"title"`
31 | Context []string `form:"context"`
32 | FilterAction string `form:"filter_action"`
33 | ExpiresIn int `form:"expires_in"`
34 | KeywordsAttributes []struct {
35 | Host string `header:"Host"`
36 | Keyword string `form:"keyword"`
37 | WholeWord bool `form:"whole_word"`
38 | } `form:"keywords_attributes"`
39 | }
40 |
41 | // https://docs.joinmastodon.org/methods/filters/#update
42 | // PUT /api/v2/filters/:id
43 | // Returns: Filter
44 | // Update a filter group with the given parameters.
45 | type PutFilter struct {
46 | Host string `header:"Host"`
47 | ID string `param:"id"` // The ID of the Filter in the database.
48 | Title string `form:"title"` // The name of the filter group.
49 | Context []string `form:"context"` // Where the filter should be applied. Specify at least one of home, notifications, public, thread, account.
50 | FilterAction string `form:"filter_action"` // The policy to be applied when the filter is matched. Specify warn or hide.
51 | ExpiresIn int `form:"expires_in"` // How many seconds from now should the filter expire?
52 | KeywordsAttributes []struct {
53 | Host string `header:"Host"`
54 | Keyword string `form:"keyword"` // A keyword to be added to the newly-created filter group.
55 | WholeWord bool `form:"whole_word"` // Whether the keyword should consider word boundaries.
56 | ID string `form:"id"` // Provide the ID of an existing keyword to modify it, instead of creating a new keyword.
57 | Destroy bool `form:"_destroy"` // If true, will remove the keyword with the given ID.
58 | } `form:"keywords_attributes"`
59 | }
60 |
61 | // https://docs.joinmastodon.org/methods/filters/#delete
62 | // DELETE /api/v2/filters/:id
63 | // Returns: Empty object
64 | // Delete a filter group.
65 | type DeleteFilter struct {
66 | Host string `header:"Host"`
67 | ID string `param:"id"` // The ID of the Filter in the database.
68 | }
69 |
70 | // https://docs.joinmastodon.org/methods/filters/#keywords-get
71 | // GET /api/v2/filters/:filter_id/keywords
72 | // Returns: Array of FilterKeyword
73 | // List all keywords attached to the current filter group.
74 | type GetFilter_Keywords struct {
75 | Host string `header:"Host"`
76 | FilterID string `param:"filter_id"` // The ID of the Filter in the database.
77 | }
78 |
79 | // https://docs.joinmastodon.org/methods/filters/#keywords-create
80 | // POST /api/v2/filters/:filter_id/keywords
81 | // Returns: FilterKeyword
82 | // Add the given keyword to the specified filter group
83 | type PostFilter_Keyword struct {
84 | Host string `header:"Host"`
85 | FilterID string `param:"filter_id"` // The ID of the Filter in the database.
86 | Keyword string `form:"keyword"` // The keyword to be added to the filter group.
87 | WholeWord bool `form:"whole_word"` // Whether the keyword should consider word boundaries.
88 | }
89 |
90 | // https://docs.joinmastodon.org/methods/filters/#keywords-get-one
91 | // GET /api/v2/filters/keywords/:id
92 | // Returns: FilterKeyword
93 | // Get one filter keyword by the given id
94 | type GetFilter_Keyword struct {
95 | Host string `header:"Host"`
96 | ID string `param:"id"` // The ID of the FilterKeyword in the database.
97 | }
98 |
99 | // https://docs.joinmastodon.org/methods/filters/#keywords-update
100 | // PUT /api/v2/filters/keywords/:id
101 | // Returns: FilterKeyword
102 | // Update the given filter keyword.
103 | type PutFilter_Keyword struct {
104 | Host string `header:"Host"`
105 | ID string `param:"id"` // The ID of the FilterKeyword in the database.
106 | Keyword string `form:"keyword"` // The keyword to be added to the filter group.
107 | WholeWord bool `form:"whole_word"` // Whether the keyword should consider word boundaries.
108 | }
109 |
110 | // https://docs.joinmastodon.org/methods/filters/#keywords-delete
111 | // DELETE /api/v2/filters/keywords/:id
112 | // Returns: Empty object
113 | // Delete the given filter keyword.
114 | type DeleteFilter_Keyword struct {
115 | Host string `header:"Host"`
116 | ID string `param:"id"` // The ID of the FilterKeyword in the database.
117 | }
118 |
119 | // https://docs.joinmastodon.org/methods/filters/#statuses-get
120 | // GET /api/v2/filters/:filter_id/statuses
121 | // Returns: Array of FilterStatus
122 | // Obtain a list of all status filters within this filter group.
123 | type GetFilter_Statuses struct {
124 | Host string `header:"Host"`
125 | FilterID string `param:"filter_id"` // The ID of the Filter in the database.
126 | }
127 |
128 | // https://docs.joinmastodon.org/methods/filters/#statuses-add
129 | // POST /api/v2/filters/:filter_id/statuses
130 | // Returns: FilterStatus
131 | // Add a status filter to the current filter group.
132 | type PostFilter_Status struct {
133 | Host string `header:"Host"`
134 | FilterID string `param:"filter_id"` // The ID of the Filter in the database.
135 | }
136 |
137 | // https://docs.joinmastodon.org/methods/filters/#statuses-get-one
138 | // GET /api/v2/filters/statuses/:id
139 | // Returns: FilterStatus
140 | // Obtain a single status filter.
141 | type GetFilter_Status struct {
142 | Host string `header:"Host"`
143 | ID string `param:"id"` // The ID of the FilterStatus in the database.
144 | }
145 |
146 | // https://docs.joinmastodon.org/methods/filters/#statuses-remove
147 | // DELETE /api/v2/filters/statuses/:id
148 | // Returns: FilterStatus
149 | // Remove a status filter from the current filter group.
150 | type DeleteFilter_Status struct {
151 | Host string `header:"Host"`
152 | ID string `param:"id"` // The ID of the FilterStatus in the database.
153 | }
154 |
155 | // https://docs.joinmastodon.org/methods/filters/#get-v1
156 | // GET /api/v1/filters
157 | // Returns List of V1::"Filter"
158 | type GetFilters_V1 struct {
159 | Host string `header:"Host"`
160 | }
161 |
162 | // https://docs.joinmastodon.org/methods/filters/#get-one-v1
163 | // GET /api/v1/filters/:id
164 | // Returns V1::"Filter"
165 | type GetFilter_V1 struct {
166 | Host string `header:"Host"`
167 | ID string `param:"id"`
168 | }
169 |
170 | // https://docs.joinmastodon.org/methods/filters/#create-v1
171 | // POST /api/v1/filters
172 | // Returns V1::"Filter"
173 | type PostFilter_V1 struct {
174 | Host string `header:"Host"`
175 | Phrase string `form:"phrase"`
176 | Context []string `form:"context"`
177 | Irreversible bool `form:"irreversible"`
178 | WholeWord bool `form:"whole_word"`
179 | ExpiresIn int `form:"expires_in"`
180 | }
181 |
182 | // https://docs.joinmastodon.org/methods/filters/#update-v1
183 | // PUT /api/v1/filters/:id
184 | // Returns V1::"Filter"
185 | type PutFilter_V1 struct {
186 | Host string `header:"Host"`
187 | ID string `param:"id"`
188 | Phrase string `form:"phrase"`
189 | Context []string `form:"context"`
190 | Irreversible bool `form:"irreversible"`
191 | WholeWord bool `form:"whole_word"`
192 | ExpiresIn int `form:"expires_in"`
193 | }
194 |
195 | // https://docs.joinmastodon.org/methods/filters/#delete-v1
196 | // DELETE /api/v1/filters/:id
197 | // Returns Empty object
198 | type DeleteFilter_V1 struct {
199 | Host string `header:"Host"`
200 | ID string `param:"id"`
201 | }
202 |
--------------------------------------------------------------------------------
/txn/follow-requests.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Follow Requests API Methods
5 | * View and manage follow requests
6 | * https://docs.joinmastodon.org/methods/follow_requests/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/follow_requests/#get
10 | // GET /api/v1/follow_requests
11 | // Returns: Array of Account
12 | type GetFollowRequests struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | MinID string `query:"min_id"`
16 | SinceID string `query:"since_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetFollowRequests) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | SinceID: t.SinceID,
26 | MinID: t.MinID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
31 | // https://docs.joinmastodon.org/methods/follow_requests/#accept
32 | // POST /api/v1/follow_requests/:account_id/authorize
33 | // Returns: Relationship
34 | type PostFollowRequest_Authorize struct {
35 | Host string `header:"Host"`
36 | AccountID string `param:"account_id"`
37 | }
38 |
39 | // https://docs.joinmastodon.org/methods/follow_requests/#reject
40 | // POST /api/v1/follow_requests/:account_id/reject
41 | // Returns: Relationship
42 | type PostFollowRequest_Reject struct {
43 | Host string `header:"Host"`
44 | AccountID string `param:"account_id"`
45 | }
46 |
--------------------------------------------------------------------------------
/txn/followed-tags.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Followed Tags API Methods
5 | * View your followed hashtags
6 | * https://docs.joinmastodon.org/methods/followed_tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/followed_tags/#get
10 | // GET /api/v1/followed_tags
11 | // Returns: Array of Tag
12 | type GetFollowedTags struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | SinceID string `query:"since_id"`
16 | MinID string `query:"min_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetFollowedTags) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | SinceID: t.SinceID,
26 | MinID: t.MinID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/txn/instance.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Instance API Methods
5 | * Discover information about a Mastodon website
6 | * https://docs.joinmastodon.org/methods/instance/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/instance/#v2
10 | // GET /api/v2/instance
11 | // Returns: Instance
12 | type GetInstance struct {
13 | Host string `header:"Host"`
14 | }
15 |
16 | // https://docs.joinmastodon.org/methods/instance/#peers
17 | // GET /api/v1/instance/peers
18 | // Returns: []string
19 | // Domains that this instance is aware of.
20 | type GetInstance_Peers struct {
21 | Host string `header:"Host"`
22 | }
23 |
24 | // https://docs.joinmastodon.org/methods/instance/#activity
25 | // GET /api/v1/instance/activity
26 | // Returns: []map[string]any
27 | // Instance activity over the last 3 months, binned weekly.
28 | type GetInstance_Activity struct {
29 | Host string `header:"Host"`
30 | }
31 |
32 | // https://docs.joinmastodon.org/methods/instance/#rules
33 | // GET /api/v1/instance/rules
34 | // Returns: []Rule
35 | // Rules that the users of this service should follow.
36 | type GetInstance_Rules struct {
37 | Host string `header:"Host"`
38 | }
39 |
40 | // https://docs.joinmastodon.org/methods/instance/#domain_blocks
41 | // GET /api/v1/instance/domain_blocks
42 | // Returns: []DomainBlock
43 | // Obtain a list of domains that have been blocked.
44 | type GetInstance_DomainBlocks struct {
45 | Host string `header:"Host"`
46 | }
47 |
48 | // https://docs.joinmastodon.org/methods/instance/#extended_description
49 | // GET /api/v1/instance/extended_description
50 | // Returns: ExtendedDescription
51 | // Obtain an extended description of this server
52 | type GetInstance_ExtendedDescription struct {
53 | Host string `header:"Host"`
54 | }
55 |
56 | // https://docs.joinmastodon.org/methods/instance/#v1
57 | // GET /api/v1/instance
58 | // Returns: Instance_V1
59 | // Obtain general information about the server.
60 | type GetInstance_V1 struct {
61 | Host string `header:"Host"`
62 | }
63 |
--------------------------------------------------------------------------------
/txn/lists.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Lists API Methods
5 | * View and manage lists. See also /api/v1/timelines/list/:id for loading a list timeline
6 | * https://docs.joinmastodon.org/methods/lists/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/lists/#get
10 | // GET /api/v1/lists
11 | // Returns: Array of List
12 | type GetLists struct {
13 | Host string `header:"Host"`
14 | }
15 |
16 | // https://docs.joinmastodon.org/methods/lists/#get-one
17 | // GET /api/v1/lists/:id
18 | // Returns: List
19 | type GetList struct {
20 | Host string `header:"Host"`
21 | ID string `param:"id"`
22 | }
23 |
24 | // https://docs.joinmastodon.org/methods/lists/#create
25 | // POST /api/v1/lists
26 | // Returns: List
27 | type PostList struct {
28 | Host string `header:"Host"`
29 | Title string `form:"title"`
30 | RepliesPolicy string `form:"replies_policy"`
31 | Exclusive bool `form:"exclusive"`
32 | }
33 |
34 | // https://docs.joinmastodon.org/methods/lists/#update
35 | // PUT /api/v1/lists/:id
36 | // Returns: List
37 | type PutList struct {
38 | Host string `header:"Host"`
39 | ID string `param:"id"`
40 | Title string `form:"title"`
41 | RepliesPolicy string `form:"replies_policy"`
42 | }
43 |
44 | // https://docs.joinmastodon.org/methods/lists/#delete
45 | // DELETE /api/v1/lists/:id
46 | type DeleteList struct {
47 | Host string `header:"Host"`
48 | ID string `param:"id"`
49 | }
50 |
51 | // https://docs.joinmastodon.org/methods/lists/#accounts
52 | // GET /api/v1/lists/:id/accounts
53 | // Returns: Array of Account
54 | type GetList_Accounts struct {
55 | Host string `header:"Host"`
56 | ID string `param:"id"`
57 | MaxID string `query:"max_id"`
58 | SinceID string `query:"since_id"`
59 | MinID string `query:"min_id"`
60 | Limit int64 `query:"limit"`
61 | }
62 |
63 | // QueryPage implements the QueryPager interface, returning
64 | // the QueryPage data embedded in this transaction
65 | func (t GetList_Accounts) QueryPage() QueryPage {
66 | return QueryPage{
67 | MaxID: t.MaxID,
68 | SinceID: t.SinceID,
69 | MinID: t.MinID,
70 | Limit: t.Limit,
71 | }
72 | }
73 |
74 | // https://docs.joinmastodon.org/methods/lists/#accounts-add
75 | // POST /api/v1/lists/:id/accounts
76 | // Returns: Empty Struct
77 | // Add accounts to the given list. Note that the user must be following these accounts.
78 | type PostList_Accounts struct {
79 | Host string `header:"Host"`
80 | ID string `param:"id"`
81 | AccountIDs []string `form:"account_ids"`
82 | }
83 |
84 | // https://docs.joinmastodon.org/methods/lists/#accounts-remove
85 | // DELETE /api/v1/lists/:id/accounts
86 | // Returns: Empty Struct
87 | // Remove accounts from the given list.
88 | type DeleteList_Accounts struct {
89 | Host string `header:"Host"`
90 | ID string `param:"id"`
91 | AccountIDs []string `form:"account_ids"`
92 | }
93 |
--------------------------------------------------------------------------------
/txn/markers.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Markers API Methods
5 | * Save and restore your position in timelines
6 | * https://docs.joinmastodon.org/methods/markers/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/markers/#get
10 | // GET /api/v1/markers
11 | // Returns: Marker
12 | type GetMarkers struct {
13 | Host string `header:"Host"`
14 | Timeline []string `query:"timeline[]"`
15 | }
16 |
17 | // https://docs.joinmastodon.org/methods/markers/#create
18 | // POST /api/v1/markers
19 | // Returns: Marker
20 | type PostMarker struct {
21 | Host string `header:"Host"`
22 | Home struct {
23 | Host string `header:"Host"`
24 | LastReadID string `form:"last_read_id"`
25 | } `form:"home"`
26 | Notifications struct {
27 | Host string `header:"Host"`
28 | LastReadID string `form:"last_read_id"`
29 | } `form:"notifications"`
30 | }
31 |
--------------------------------------------------------------------------------
/txn/media.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Media API Methods
5 | * Attach media to authored statuses. See Using Mastodon > Posting toots > Attachments
6 | * for more information about size and format limits
7 | * https://docs.joinmastodon.org/methods/media/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/media/#v2
11 | // POST /api/v2/media
12 | // Returns: MediaAttachment
13 | type PostMedia struct {
14 | Host string `header:"Host"`
15 | File string `form:"file"`
16 | Thumbnail string `form:"thumbnail"`
17 | Description string `form:"description"`
18 | Focus string `form:"focus"`
19 | }
20 |
--------------------------------------------------------------------------------
/txn/mutes.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Mutes API Methods
5 | * View your mutes. See also /accounts/:id/{mute,unmute}
6 | * https://docs.joinmastodon.org/methods/mutes/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/mutes/#get
10 | // GET /api/v1/mutes
11 | // Returns: Array of Account
12 | type GetMutes struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | MinID string `query:"min_id"`
16 | SinceID string `query:"since_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetMutes) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | SinceID: t.SinceID,
26 | MinID: t.MinID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/txn/notifications.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Notifications API Methods
5 | * Receive notifications for activity on your account or statuses
6 | * https://docs.joinmastodon.org/methods/notifications/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/notifications/#get
10 | // GET /api/v1/notifications
11 | // Returns: []Notification
12 | type GetNotifications struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | SinceID string `query:"since_id"`
16 | MinID string `query:"min_id"`
17 | Limit int64 `query:"limit"`
18 | Types []string `query:"types"`
19 | ExcludeTypes []string `query:"exclude_types"`
20 | AccountID string `query:"account_id"`
21 | }
22 |
23 | // QueryPage implements the QueryPager interface, returning
24 | // the QueryPage data embedded in this transaction
25 | func (t GetNotifications) QueryPage() QueryPage {
26 | return QueryPage{
27 | MaxID: t.MaxID,
28 | SinceID: t.SinceID,
29 | MinID: t.MinID,
30 | Limit: t.Limit,
31 | }
32 | }
33 |
34 | // https://docs.joinmastodon.org/methods/notifications/#get-one
35 | // GET /api/v1/notifications/:id
36 | // Returns: Notification
37 | type GetNotification struct {
38 | Host string `header:"Host"`
39 | ID string `param:"id"`
40 | }
41 |
42 | // https://docs.joinmastodon.org/methods/notifications/#clear
43 | // POST /api/v1/notifications/clear
44 | // Returns: Empty Struct
45 | type PostNotifications_Clear struct {
46 | Host string `header:"Host"`
47 | }
48 |
49 | // https://docs.joinmastodon.org/methods/notifications/#dismiss
50 | // POST /api/v1/notifications/dismiss
51 | // Returns: Empty Struct
52 | type PostNotification_Dismiss struct {
53 | Host string `header:"Host"`
54 | ID string `form:"id"`
55 | }
56 |
--------------------------------------------------------------------------------
/txn/oauth.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * OAuth API Methods
5 | * Generate and manage OAuth tokens
6 | * https://docs.joinmastodon.org/methods/oauth/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/oauth/#authorize
10 | // GET /oauth/authorize
11 | // Returns: Authorization code
12 | type GetOAuth_Authorize struct {
13 | Host string `header:"Host"`
14 | ResponseType string `query:"response_type"`
15 | ClientID string `query:"client_id"`
16 | RedirectURI string `query:"redirect_uri"`
17 | Scope string `query:"scope"`
18 | ForceLogin bool `query:"force_login"`
19 | Language string `query:"language"`
20 | }
21 |
22 | // https://docs.joinmastodon.org/methods/oauth/#token
23 | // POST /oauth/token
24 | // Returns: Token
25 | // Obtain an access token, to be used during API calls that are not public
26 | type PostOAuth_Token struct {
27 | Host string `header:"Host"`
28 | GrantType string `form:"grant_type"`
29 | Code string `form:"code"`
30 | ClientID string `form:"client_id"`
31 | ClientSecret string `form:"client_secret"`
32 | RedirectURI string `form:"redirect_uri"`
33 | Scope string `form:"scope"`
34 | }
35 |
36 | // https://docs.joinmastodon.org/methods/oauth/#revoke
37 | // POST /oauth/revoke
38 | // Returns: Empty struct
39 | // Revoke an access token to make it no longer valid for use
40 | type PostOAuth_Revoke struct {
41 | Host string `header:"Host"`
42 | ClientID string `form:"client_id"`
43 | ClientSecret string `form:"client_secret"`
44 | Token string `form:"token"`
45 | }
46 |
--------------------------------------------------------------------------------
/txn/oembed.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * OEmbed API Methods
5 | * For generating OEmbed previews
6 | * https://docs.joinmastodon.org/methods/oembed/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/oembed/#get
10 | // GET /api/oembed
11 | // Returns: OEmbed metadata
12 | type GetOEmbed struct {
13 | Host string `header:"Host"`
14 | URL string `query:"url"`
15 | MaxWidth int `query:"maxwidth"`
16 | MaxHeight int `query:"maxheight"`
17 | }
18 |
--------------------------------------------------------------------------------
/txn/polls.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Polls API Methods
5 | * View and vode on polls attached to statuses. To discover pollID,
6 | * you will need to GET a Status first and then check for a `poll` property.
7 | * https://docs.joinmastodon.org/methods/polls/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/polls/#get
11 | // GET /api/v1/polls/:id
12 | // Returns: Poll
13 | // View a Poll
14 | type GetPoll struct {
15 | Host string `header:"Host"`
16 | ID string `param:"id"`
17 | }
18 |
19 | // https://docs.joinmastodon.org/methods/polls/#vote
20 | // POST /api/v1/polls/:id/votes
21 | // Returns: Poll
22 | // Vote on a Poll
23 | type PostPoll_Votes struct {
24 | Host string `header:"Host"`
25 | ID string `param:"id"`
26 | Choices []int `json:"choices"`
27 | }
28 |
--------------------------------------------------------------------------------
/txn/preferences.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Preferences API Methods
5 | * Preferred common behaviors to be shared across clients.
6 | * https://docs.joinmastodon.org/methods/preferences/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/preferences/#get
10 | // GET /api/v1/preferences
11 | // Returns: Preferences
12 | type GetPreferences struct {
13 | Host string `header:"Host"`
14 | }
15 |
--------------------------------------------------------------------------------
/txn/profile.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Profile API Methods
5 | * Methods concerning profiles
6 | * https://docs.joinmastodon.org/methods/profile/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/profile/#delete-profile-avatar
10 | // DELETE /api/v1/profile/avatar
11 | // Returns: CredentialAccount
12 | type DeleteProfile_Avatar struct {
13 | Host string `header:"Host"`
14 | }
15 |
16 | // https://docs.joinmastodon.org/methods/profile/#delete-profile-header
17 | // DELETE /api/v1/profile/header
18 | // Returns: CredentialAccount
19 | type DeleteProfile_Header struct {
20 | Host string `header:"Host"`
21 | }
22 |
--------------------------------------------------------------------------------
/txn/push.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Push API Methods
5 | * Subscribe to and receive push notifications when a server-side
6 | * notification is received, via the Web Push API
7 | * https://docs.joinmastodon.org/methods/push/
8 | ******************************************/
9 |
--------------------------------------------------------------------------------
/txn/queryPage.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | // QueryPager wraps the QueryPage method, and is implemented by all "query" transactions
4 | type QueryPager interface {
5 |
6 | // QueryPage extracts the query page data from an object
7 | QueryPage() QueryPage
8 | }
9 |
10 | // QueryPage represents the query parameters that are common to many Mastodon API calls.
11 | // Many API methods allow you to paginate for more information, using parameters such as limit, max_id, min_id, and since_id.
12 | // https://docs.joinmastodon.org/api/guidelines/#pagination
13 | type QueryPage struct {
14 | Limit int64 `query:"limit"` // The maximum number of results to return. Usually, there is a default limit and a maximum limit; these will vary according to the API method.
15 | MaxID string `query:"max_id"` // All results returned will be lesser than this ID. In effect, sets an upper bound on results.
16 | MinID string `query:"min_id"` // Returns results immediately newer than this ID. In effect, sets a cursor at this ID and paginates forward.
17 | SinceID string `query:"since_id"` // All results returned will be greater than this ID. In effect, sets a lower bound on results.
18 | }
19 |
--------------------------------------------------------------------------------
/txn/reports.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Reports API Methods
5 | * Report problematic users to your moderators
6 | * https://docs.joinmastodon.org/methods/reports/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/reports/#post
10 | // POST /api/v1/reports
11 | // Returns: Report
12 | type PostReport struct {
13 | Host string `header:"Host"`
14 | AccountID string `form:"account_id"`
15 | StatusIDs []string `form:"status_ids"`
16 | Comment string `form:"comment"`
17 | Forward bool `form:"forward"`
18 | Category string `form:"category"`
19 | RuleIDs []string `form:"rule_ids"`
20 | }
21 |
--------------------------------------------------------------------------------
/txn/scheduled-statuses.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Scheduled Statuses API Methods
5 | * Manage statuses that were scheduled to be published at a future date.
6 | * https://docs.joinmastodon.org/methods/scheduled_statuses/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#get
10 | // GET /api/v1/scheduled_statuses
11 | // Returns: []ScheduledStatus
12 | type GetScheduledStatuses struct {
13 | Host string `header:"Host"`
14 | MaxID string `query:"max_id"`
15 | SinceID string `query:"since_id"`
16 | MinID string `query:"min_id"`
17 | Limit int64 `query:"limit"`
18 | }
19 |
20 | // QueryPage implements the QueryPager interface, returning
21 | // the QueryPage data embedded in this transaction
22 | func (t GetScheduledStatuses) QueryPage() QueryPage {
23 | return QueryPage{
24 | MaxID: t.MaxID,
25 | SinceID: t.SinceID,
26 | MinID: t.MinID,
27 | Limit: t.Limit,
28 | }
29 | }
30 |
31 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#get-one
32 | // GET /api/v1/scheduled_statuses/:id
33 | // Returns: ScheduledStatus
34 | type GetScheduledStatus struct {
35 | Host string `header:"Host"`
36 | ID string `param:"id"`
37 | }
38 |
39 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#update
40 | // PUT /api/v1/scheduled_statuses/:id
41 | // Returns: ScheduledStatus
42 | type PutScheduledStatus struct {
43 | Host string `header:"Host"`
44 | ID string `param:"id"`
45 | ScheduledAt string `form:"scheduled_at"` // ISO 8601 Datetime
46 | }
47 |
48 | // https://docs.joinmastodon.org/methods/scheduled_statuses/#cancel
49 | // DELETE /api/v1/scheduled_statuses/:id
50 | // Returns: Empty struct
51 | type DeleteScheduledStatus struct {
52 | Host string `header:"Host"`
53 | ID string `param:"id"`
54 | }
55 |
--------------------------------------------------------------------------------
/txn/search.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Search API Methods
5 | * Search for content in accounts, statuses and hashtags
6 | * https://docs.joinmastodon.org/methods/search/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/search/#v2
10 | // GET /api/v2/search
11 | // Returns: Search
12 | type GetSearch struct {
13 | Host string `header:"Host"`
14 | Q string `query:"q"`
15 | Type string `query:"type"` // [accounts | hashtags | statuses]
16 | Resolve bool `query:"resolve"`
17 | Following bool `query:"following"`
18 | AccountID string `query:"account_id"`
19 | ExcludeUnreviewed bool `query:"exclude_unreviewed"`
20 | MaxID string `query:"max_id"`
21 | MinID string `query:"min_id"`
22 | SinceID string `query:"since_id"`
23 | Limit int64 `query:"limit"`
24 | Offset int `query:"offset"`
25 | }
26 |
27 | // QueryPage implements the QueryPager interface, returning
28 | // the QueryPage data embedded in this transaction
29 | func (t GetSearch) QueryPage() QueryPage {
30 | return QueryPage{
31 | MaxID: t.MaxID,
32 | SinceID: t.SinceID,
33 | MinID: t.MinID,
34 | Limit: t.Limit,
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/txn/statuses.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Statuses API Methods
5 | * Publish, interact, and view information about statuses
6 | * https://docs.joinmastodon.org/methods/statuses/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/statuses/#create
10 | // POST /api/v1/statuses
11 | // Returns: Status
12 | type PostStatus struct {
13 | Host string `header:"Host"`
14 | Status string `form:"status"`
15 | MediaIDs []string `form:"media_ids"`
16 | Poll struct {
17 | Host string `header:"Host"`
18 | Options []string `form:"options"`
19 | ExpiresIn int `form:"expires_in"`
20 | Multiple bool `form:"multiple"`
21 | HideTotals bool `form:"hide_totals"`
22 | } `form:"poll"`
23 | InReplyToID string `form:"in_reply_to_id"`
24 | Sensitive bool `form:"sensitive"`
25 | SpoilerText string `form:"spoiler_text"`
26 | Visibility string `form:"visibility"` // [public | unlisted | private | direct]
27 | Language string `form:"language"` // ISO 629 2-letter language code
28 | ScheduledAt string `form:"scheduled_at"` // ISO 8601 Datetime
29 | }
30 |
31 | // https://docs.joinmastodon.org/methods/statuses/#get
32 | // GET /api/v1/statuses/:id
33 | // Returns: Status
34 | type GetStatus struct {
35 | Host string `header:"Host"`
36 | ID string `param:"id"`
37 | }
38 |
39 | // https://docs.joinmastodon.org/methods/statuses/#delete
40 | // DELETE /api/v1/statuses/:id
41 | type DeleteStatus struct {
42 | Host string `header:"Host"`
43 | ID string `param:"id"`
44 | }
45 |
46 | // https://docs.joinmastodon.org/methods/statuses/#context
47 | // GET /api/v1/statuses/:id/context
48 | // Returns: Context
49 | type GetStatus_Context struct {
50 | Host string `header:"Host"`
51 | ID string `param:"id"`
52 | }
53 |
54 | // https://docs.joinmastodon.org/methods/statuses/#translate
55 | // POST /api/v1/statuses/:id/translate
56 | // Returns: Status
57 | type PostStatus_Translate struct {
58 | Host string `header:"Host"`
59 | ID string `param:"id"`
60 | Lang string `form:"lang"`
61 | }
62 |
63 | // https://docs.joinmastodon.org/methods/statuses/#reblogged_by
64 | // GET /api/v1/statuses/:id/reblogged_by
65 | // Returns: []Account
66 | type GetStatus_RebloggedBy struct {
67 | Host string `header:"Host"`
68 | ID string `param:"id"`
69 | MaxID string `query:"max_id"`
70 | MinID string `query:"min_id"`
71 | SinceID string `query:"since_id"`
72 | Limit int64 `query:"limit"`
73 | }
74 |
75 | // QueryPage implements the QueryPager interface, returning
76 | // the QueryPage data embedded in this transaction
77 | func (t GetStatus_RebloggedBy) QueryPage() QueryPage {
78 | return QueryPage{
79 | MaxID: t.MaxID,
80 | SinceID: t.SinceID,
81 | MinID: t.MinID,
82 | Limit: t.Limit,
83 | }
84 | }
85 |
86 | // https://docs.joinmastodon.org/methods/statuses/#favourited_by
87 | // GET /api/v1/statuses/:id/favourited_by
88 | // Returns: []Account
89 | type GetStatus_FavouritedBy struct {
90 | Host string `header:"Host"`
91 | ID string `param:"id"`
92 | MaxID string `query:"max_id"`
93 | MinID string `query:"min_id"`
94 | SinceID string `query:"since_id"`
95 | Limit int64 `query:"limit"`
96 | }
97 |
98 | // QueryPage implements the QueryPager interface, returning
99 | // the QueryPage data embedded in this transaction
100 | func (t GetStatus_FavouritedBy) QueryPage() QueryPage {
101 | return QueryPage{
102 | MaxID: t.MaxID,
103 | SinceID: t.SinceID,
104 | MinID: t.MinID,
105 | Limit: t.Limit,
106 | }
107 | }
108 |
109 | // https://docs.joinmastodon.org/methods/statuses/#favourite
110 | // POST /api/v1/statuses/:id/favourite
111 | // Returns: Status
112 | type PostStatus_Favourite struct {
113 | Host string `header:"Host"`
114 | ID string `param:"id"`
115 | }
116 |
117 | // https://docs.joinmastodon.org/methods/statuses/#unfavourite
118 | // POST /api/v1/statuses/:id/unfavourite
119 | // Returns: Status
120 | type PostStatus_Unfavourite struct {
121 | Host string `header:"Host"`
122 | ID string `param:"id"`
123 | }
124 |
125 | // https://docs.joinmastodon.org/methods/statuses/#reblog
126 | // POST /api/v1/statuses/:id/reblog
127 | // Returns: Status
128 | type PostStatus_Reblog struct {
129 | Host string `header:"Host"`
130 | ID string `param:"id"`
131 | Visibility string `form:"visibility"` // [public | unlisted | private]
132 | }
133 |
134 | // https://docs.joinmastodon.org/methods/statuses/#unreblog
135 | // POST /api/v1/statuses/:id/unreblog
136 | // Returns: Status
137 | type PostStatus_Unreblog struct {
138 | Host string `header:"Host"`
139 | ID string `param:"id"`
140 | }
141 |
142 | // https://docs.joinmastodon.org/methods/statuses/#bookmark
143 | // POST /api/v1/statuses/:id/bookmark
144 | // Returns: Status
145 | type PostStatus_Bookmark struct {
146 | Host string `header:"Host"`
147 | ID string `param:"id"`
148 | }
149 |
150 | // https://docs.joinmastodon.org/methods/statuses/#unbookmark
151 | // POST /api/v1/statuses/:id/unbookmark
152 | // Returns: Status
153 | type PostStatus_Unbookmark struct {
154 | Host string `header:"Host"`
155 | ID string `param:"id"`
156 | }
157 |
158 | // https://docs.joinmastodon.org/methods/statuses/#mute
159 | // POST /api/v1/statuses/:id/mute
160 | // Returns: Status
161 | type PostStatus_Mute struct {
162 | Host string `header:"Host"`
163 | ID string `param:"id"`
164 | }
165 |
166 | // https://docs.joinmastodon.org/methods/statuses/#unmute
167 | // POST /api/v1/statuses/:id/unmute
168 | // Returns: Status
169 | type PostStatus_Unmute struct {
170 | Host string `header:"Host"`
171 | ID string `param:"id"`
172 | }
173 |
174 | // https://docs.joinmastodon.org/methods/statuses/#pin
175 | // POST /api/v1/statuses/:id/pin
176 | // Returns: Status
177 | type PostStatus_Pin struct {
178 | Host string `header:"Host"`
179 | ID string `param:"id"`
180 | }
181 |
182 | // https://docs.joinmastodon.org/methods/statuses/#unpin
183 | // POST /api/v1/statuses/:id/unpin
184 | // Returns: Status
185 | type PostStatus_Unpin struct {
186 | Host string `header:"Host"`
187 | ID string `param:"id"`
188 | }
189 |
190 | // https://docs.joinmastodon.org/methods/statuses/#edit
191 | // PUT /api/v1/statuses/:id
192 | // Returns: Status
193 | type PutStatus struct {
194 | Host string `header:"Host"`
195 | ID string `param:"id"`
196 | Status string `form:"status"`
197 | SpoilerText string `form:"spoiler_text"`
198 | Sensitive bool `form:"sensitive"`
199 | Language string `form:"language"`
200 | MediaIDs []string `form:"media_ids[]"`
201 | Poll struct {
202 | Host string `header:"Host"`
203 | Options []string `form:"options[]"`
204 | ExpiresIn int `form:"expires_in"`
205 | Multiple bool `form:"multiple"`
206 | HideTotals bool `form:"hide_totals"`
207 | } `form:"poll"`
208 | }
209 |
210 | // https://docs.joinmastodon.org/methods/statuses/#history
211 | // GET /api/v1/statuses/:id/history
212 | // Returns: []StatusEdit
213 | type GetStatus_History struct {
214 | Host string `header:"Host"`
215 | ID string `param:"id"`
216 | }
217 |
218 | // https://docs.joinmastodon.org/methods/statuses/#source
219 | // GET /api/v1/statuses/:id/source
220 | // Returns: StatusSource
221 | type GetStatus_Source struct {
222 | Host string `header:"Host"`
223 | ID string `param:"id"`
224 | }
225 |
--------------------------------------------------------------------------------
/txn/streaming.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Streaming API Methods
5 | * Subscribe to server-sent events for real-time updates
6 | * via long-lived HTTP connections or via WebSocket
7 | * https://docs.joinmastodon.org/methods/streaming/
8 | ******************************************/
9 |
--------------------------------------------------------------------------------
/txn/suggestions.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Suggestions API Methods
5 | * Server-generated suggestions on who to follow, based on previous
6 | * positive interactions
7 | * https://docs.joinmastodon.org/methods/suggestions/
8 | ******************************************/
9 |
10 | // https://docs.joinmastodon.org/methods/suggestions/#v2
11 | // GET /api/v2/suggestions
12 | // Returns: []Suggestion
13 | type GetSuggestions struct {
14 | Host string `header:"Host"`
15 | Limit int `query:"limit"`
16 | }
17 |
18 | // https://docs.joinmastodon.org/methods/suggestions/#remove
19 | // DELETE /api/v1/suggestions/:account_id
20 | // Returns Empty Struct
21 | type DeleteSuggestion struct {
22 | Host string `header:"Host"`
23 | AccountID string `param:"account_id"`
24 | }
25 |
--------------------------------------------------------------------------------
/txn/tags.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Tags API Methods
5 | * View information about or follow/unfollow hashtags
6 | * https://docs.joinmastodon.org/methods/tags/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/tags/#get
10 | // GET /api/v1/tags/:id
11 | // Returns: Tag
12 | type GetTag struct {
13 | Host string `header:"Host"`
14 | ID string `param:"id"`
15 | }
16 |
17 | // https://docs.joinmastodon.org/methods/tags/#follow
18 | // POST /api/v1/tags/:id/follow
19 | // Returns: Tag
20 | type PostTag_Follow struct {
21 | Host string `header:"Host"`
22 | ID string `param:"id"`
23 | }
24 |
25 | // https://docs.joinmastodon.org/methods/tags/#unfollow
26 | // POST /api/v1/tags/:id/unfollow
27 | // Returns: Tag
28 | type PostTag_Unfollow struct {
29 | Host string `header:"Host"`
30 | ID string `param:"id"`
31 | }
32 |
--------------------------------------------------------------------------------
/txn/timelines.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Timelines API Methods
5 | * Read and view timelines of statuses
6 | * https://docs.joinmastodon.org/methods/timelines/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/timelines/#public
10 | // GET /api/v1/timelines/public
11 | // Returns: []Status
12 | type GetTimeline_Public struct {
13 | Host string `header:"Host"`
14 | Local bool `query:"local"`
15 | Remote bool `query:"remote"`
16 | OnlyMedia bool `query:"only_media"`
17 | MaxID string `query:"max_id"`
18 | SinceID string `query:"since_id"`
19 | MinID string `query:"min_id"`
20 | Limit int64 `query:"limit"`
21 | }
22 |
23 | // https://docs.joinmastodon.org/methods/timelines/#tag
24 | // GET /api/v1/timelines/tag/:hashtag
25 | // Returns: []Status
26 | type GetTimeline_Hashtag struct {
27 | Host string `header:"Host"`
28 | Hashtag string `param:"hashtag"`
29 | Any []string `query:"any"`
30 | All []string `query:"all"`
31 | None []string `query:"none"`
32 | Local bool `query:"local"`
33 | Remote bool `query:"remote"`
34 | OnlyMedia bool `query:"only_media"`
35 | MaxID string `query:"max_id"`
36 | SinceID string `query:"since_id"`
37 | MinID string `query:"min_id"`
38 | Limit int64 `query:"limit"`
39 | }
40 |
41 | // QueryPage implements the QueryPager interface, returning
42 | // the QueryPage data embedded in this transaction
43 | func (t GetTimeline_Hashtag) QueryPage() QueryPage {
44 | return QueryPage{
45 | MaxID: t.MaxID,
46 | SinceID: t.SinceID,
47 | MinID: t.MinID,
48 | Limit: t.Limit,
49 | }
50 | }
51 |
52 | // https://docs.joinmastodon.org/methods/timelines/#home
53 | // GET /api/v1/timelines/home
54 | // Returns: []Status
55 | type GetTimeline_Home struct {
56 | Host string `header:"Host"`
57 | MaxID string `query:"max_id"`
58 | SinceID string `query:"since_id"`
59 | MinID string `query:"min_id"`
60 | Limit int64 `query:"limit"`
61 | }
62 |
63 | // QueryPage implements the QueryPager interface, returning
64 | // the QueryPage data embedded in this transaction
65 | func (t GetTimeline_Home) QueryPage() QueryPage {
66 | return QueryPage{
67 | MaxID: t.MaxID,
68 | SinceID: t.SinceID,
69 | MinID: t.MinID,
70 | Limit: t.Limit,
71 | }
72 | }
73 |
74 | // https://docs.joinmastodon.org/methods/timelines/#list
75 | // GET /api/v1/timelines/list/:list_id
76 | // Returns: []Status
77 | type GetTimeline_List struct {
78 | Host string `header:"Host"`
79 | ListID string `param:"list_id"`
80 | MaxID string `query:"max_id"`
81 | SinceID string `query:"since_id"`
82 | MinID string `query:"min_id"`
83 | Limit int64 `query:"limit"`
84 | }
85 |
86 | // QueryPage implements the QueryPager interface, returning
87 | // the QueryPage data embedded in this transaction
88 | func (t GetTimeline_List) QueryPage() QueryPage {
89 | return QueryPage{
90 | MaxID: t.MaxID,
91 | SinceID: t.SinceID,
92 | MinID: t.MinID,
93 | Limit: t.Limit,
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/txn/trends.go:
--------------------------------------------------------------------------------
1 | package txn
2 |
3 | /******************************************
4 | * Trends API Methods
5 | * View hashtags that are currently being used more frequently than usual.
6 | * https://docs.joinmastodon.org/methods/trends/
7 | ******************************************/
8 |
9 | // https://docs.joinmastodon.org/methods/trends/#tags
10 | // GET /api/v1/trends
11 | // Returns: []Tag
12 | type GetTrends struct {
13 | Host string `header:"Host"`
14 | Limit int `query:"limit"` // Maximum number of results to return. Defaults to 10 tags. Max 20 tags.
15 | Offset int `query:"offset"` // Skip the first n results.
16 | }
17 |
18 | // https://docs.joinmastodon.org/methods/trends/#statuses
19 | // GET /api/v1/trends/statuses
20 | // Returns: []Status
21 | type GetTrends_Statuses struct {
22 | Host string `header:"Host"`
23 | Limit int `query:"limit"` // Maximum number of results to return. Defaults to 10 tags. Max 20 tags.
24 | Offset int `query:"offset"` // Skip the first n results.
25 | }
26 |
27 | // https://docs.joinmastodon.org/methods/trends/#links
28 | // GET /api/v1/trends/links
29 | // Returns: []Link
30 | type GetTrends_Links struct {
31 | Host string `header:"Host"`
32 | Limit int `query:"limit"` // Maximum number of results to return. Defaults to 10 tags. Max 20 tags.
33 | Offset int `query:"offset"` // Skip the first n results.
34 | }
35 |
--------------------------------------------------------------------------------