Documentation
¶
Index ¶
- Constants
- type Module
- func (m *Module) AcceptGETHandler(c *gin.Context)
- func (m *Module) AuthorizationGETHandler(c *gin.Context)
- func (m *Module) FeaturedCollectionGETHandler(c *gin.Context)
- func (m *Module) FollowersGETHandler(c *gin.Context)
- func (m *Module) FollowingGETHandler(c *gin.Context)
- func (m *Module) InboxPOSTHandler(c *gin.Context)
- func (m *Module) OutboxGETHandler(c *gin.Context)
- func (m *Module) Route(...)
- func (m *Module) StatusGETHandler(c *gin.Context)
- func (m *Module) StatusRepliesGETHandler(c *gin.Context)
- func (m *Module) UsersGETHandler(c *gin.Context)
- type SwaggerCollection
- type SwaggerCollectionPage
- type SwaggerFeaturedCollection
Constants ¶
const ( OnlyOtherAccountsKey = "only_other_accounts" BasePath = "/:" + apiutil.UsernameKey InboxPath = BasePath + "/" + uris.InboxPath OutboxPath = BasePath + "/" + uris.OutboxPath FollowersPath = BasePath + "/" + uris.FollowersPath FollowingPath = BasePath + "/" + uris.FollowingPath FeaturedCollectionPath = BasePath + "/" + uris.CollectionsPath + "/" + uris.FeaturedPath StatusPath = BasePath + "/" + uris.StatusesPath + "/:" + apiutil.IDKey StatusRepliesPath = StatusPath + "/replies" AcceptPath = BasePath + "/" + uris.AcceptsPath + "/:" + apiutil.IDKey AuthorizationsPath = BasePath + "/" + uris.AuthorizationsPath + "/:" + apiutil.IDKey )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New(processor *processing.Processor) *Module
func (*Module) AcceptGETHandler ¶
AcceptGETHandler serves an interaction request as an ActivityStreams Accept.
func (*Module) AuthorizationGETHandler ¶ added in v0.20.0
AuthorizationGETHandler serves an accepted interaction request as a LikeAuthorization, ReplyAuthorization, or AnnounceAuthorization type.
func (*Module) FeaturedCollectionGETHandler ¶
FeaturedCollectionGETHandler swagger:operation GET /users/{username}/collections/featured s2sFeaturedCollectionGet
Get the featured collection (pinned posts) for a user.
The response will contain an ordered collection of Note URIs in the `items` property.
It is up to the caller to dereference the provided Note URIs (or not, if they already have them cached).
HTTP signature is required on the request.
--- tags: - s2s/federation produces: - application/activity+json parameters: - name: username type: string description: Account name of the user in: path required: true responses: '200': in: body schema: "$ref": "#/definitions/swaggerFeaturedCollection" '400': description: bad request '401': description: unauthorized '403': description: forbidden '404': description: not found
func (*Module) FollowersGETHandler ¶
FollowersGETHandler returns a collection of URIs for followers of the target user, formatted so that other AP servers can understand it.
func (*Module) FollowingGETHandler ¶
FollowingGETHandler returns a collection of URIs for accounts that the target user follows, formatted so that other AP servers can understand it.
func (*Module) InboxPOSTHandler ¶
InboxPOSTHandler deals with incoming POST requests to an actor's inbox. Eg., POST to https://example.org/users/whatever/inbox.
func (*Module) OutboxGETHandler ¶
OutboxGETHandler swagger:operation GET /users/{username}/outbox s2sOutboxGet
Get the public outbox collection for an actor.
Note that the response will be a Collection with a page as `first`, as shown below, if `page` is `false`.
If `page` is `true`, then the response will be a single `CollectionPage` without the wrapping `Collection`.
HTTP signature is required on the request.
--- tags: - s2s/federation produces: - application/activity+json parameters: - name: username type: string description: Username of the account. in: path required: true - name: page type: boolean description: Return response as a CollectionPage. in: query default: false - name: min_id type: string description: Minimum ID of the next status, used for paging. in: query - name: max_id type: string description: Maximum ID of the next status, used for paging. in: query responses: '200': in: body schema: "$ref": "#/definitions/swaggerCollection" '400': description: bad request '401': description: unauthorized '403': description: forbidden '404': description: not found
func (*Module) StatusGETHandler ¶
StatusGETHandler serves the target status as an activitystreams NOTE so that other AP servers can parse it.
func (*Module) StatusRepliesGETHandler ¶
StatusRepliesGETHandler swagger:operation GET /users/{username}/statuses/{status}/replies s2sRepliesGet
Get the replies collection for a status.
Note that the response will be a Collection with a page as `first`, as shown below, if `page` is `false`.
If `page` is `true`, then the response will be a single `CollectionPage` without the wrapping `Collection`.
HTTP signature is required on the request.
--- tags: - s2s/federation produces: - application/activity+json parameters: - name: username type: string description: Username of the account. in: path required: true - name: status type: string description: ID of the status. in: path required: true - name: page type: boolean description: Return response as a CollectionPage. in: query default: false - name: only_other_accounts type: boolean description: Return replies only from accounts other than the status owner. in: query default: false - name: min_id type: string description: Minimum ID of the next status, used for paging. in: query responses: '200': in: body schema: "$ref": "#/definitions/swaggerCollection" '400': description: bad request '401': description: unauthorized '403': description: forbidden '404': description: not found
func (*Module) UsersGETHandler ¶
UsersGETHandler should be served at https://example.org/users/:username.
The goal here is to return the activitypub representation of an account in the form of a vocab.ActivityStreamsPerson. This should only be served to REMOTE SERVERS that present a valid signature on the GET request, on behalf of a user, otherwise we risk leaking information about users publicly.
And of course, the request should be refused if the account or server making the request is blocked.
type SwaggerCollection ¶
type SwaggerCollection struct {
// ActivityStreams JSON-LD context.
// A string or an array of strings, or more
// complex nested items.
// example: https://www.w3.org/ns/activitystreams
Context interface{} `json:"@context"`
// ActivityStreams ID.
// example: https://example.org/users/some_user/statuses/106717595988259568/replies
ID string `json:"id"`
// ActivityStreams type.
// example: Collection
Type string `json:"type"`
// ActivityStreams first property.
First SwaggerCollectionPage `json:"first"`
// ActivityStreams last property.
Last SwaggerCollectionPage `json:"last,omitempty"`
}
SwaggerCollection represents an ActivityPub Collection. swagger:model swaggerCollection
type SwaggerCollectionPage ¶
type SwaggerCollectionPage struct {
// ActivityStreams ID.
// example: https://example.org/users/some_user/statuses/106717595988259568/replies?page=true
ID string `json:"id"`
// ActivityStreams type.
// example: CollectionPage
Type string `json:"type"`
// Link to the next page.
// example: https://example.org/users/some_user/statuses/106717595988259568/replies?only_other_accounts=true&page=true
Next string `json:"next"`
// Collection this page belongs to.
// example: https://example.org/users/some_user/statuses/106717595988259568/replies
PartOf string `json:"partOf"`
// Items on this page.
// example: ["https://example.org/users/some_other_user/statuses/086417595981111564", "https://another.example.com/users/another_user/statuses/01FCN8XDV3YG7B4R42QA6YQZ9R"]
Items []string `json:"items"`
}
SwaggerCollectionPage represents one page of a collection. swagger:model swaggerCollectionPage
type SwaggerFeaturedCollection ¶
type SwaggerFeaturedCollection struct {
// ActivityStreams JSON-LD context.
// A string or an array of strings, or more
// complex nested items.
// example: https://www.w3.org/ns/activitystreams
Context interface{} `json:"@context"`
// ActivityStreams ID.
// example: https://example.org/users/some_user/collections/featured
ID string `json:"id"`
// ActivityStreams type.
// example: OrderedCollection
Type string `json:"type"`
// List of status URIs.
// example: ["https://example.org/users/some_user/statuses/01GSZ0F7Q8SJKNRF777GJD271R", "https://example.org/users/some_user/statuses/01GSZ0G012CBQ7TEKX689S3QRE"]
Items []string `json:"items"`
// Number of items in this collection.
// example: 2
TotalItems int
}
SwaggerFeaturedCollection represents an ActivityPub OrderedCollection. swagger:model swaggerFeaturedCollection