Some reordering of things

This commit is contained in:
Marius Orcsik 2017-09-16 19:53:11 +02:00
parent a52381dd15
commit eb4df3b38a
No known key found for this signature in database
GPG key ID: C36D1EBE93A6EEAE
11 changed files with 183 additions and 164 deletions

View file

@ -64,142 +64,6 @@ var validActivityTypes = [...]string{
// Actor Types
}
// An Activity is a subtype of Object that describes some form of action that may happen,
// is currently happening, or has already happened.
// The Activity type itself serves as an abstract base type for all types of activities.
// It is important to note that the Activity type itself does not carry any specific semantics
// about the kind of action being taken.
type Activity struct {
*IntransitiveActivity
// When used within an Activity, describes the direct object of the activity.
// For instance, in the activity "John added a movie to his wishlist",
// the object of the activity is the movie added.
// When used within a Relationship describes the entity to which the subject is related.
Object ObjectOrLink `jsonld:"object"`
}
// Indicates that the actor accepts the object. The target property can be used in certain circumstances to indicate
// the context into which the object has been accepted.
type Accept Activity
// Indicates that the actor has added the object to the target. If the target property is not explicitly specified,
// the target would need to be determined implicitly by context.
// The origin can be used to identify the context from which the object originated.
type Add Activity
// Indicates that the actor is calling the target's attention the object.
// The origin typically has no defined meaning.
type Announce Activity
// An IntransitiveActivity that indicates that the actor has arrived at the location.
// The origin can be used to identify the context from which the actor originated.
// The target typically has no defined meaning.
type Arrive IntransitiveActivity
// Indicates that the actor is blocking the object. Blocking is a stronger form of Ignore.
// The typical use is to support social systems that allow one user to block activities or content of other users.
// The target and origin typically have no defined meaning.
type Block Ignore
// Indicates that the actor has created the object.
type Create Activity
// Indicates that the actor has deleted the object.
// If specified, the origin indicates the context from which the object was deleted.
type Delete Activity
// Indicates that the actor dislikes the object.
type Dislike Activity
// Indicates that the actor is "flagging" the object.
// Flagging is defined in the sense common to many social platforms as reporting content as being
// inappropriate for any number of reasons.
type Flag Activity
// Indicates that the actor is "following" the object. Following is defined in the sense typically used within
// Social systems in which the actor is interested in any activity performed by or on the object.
// The target and origin typically have no defined meaning.
type Follow Activity
// Indicates that the actor is ignoring the object. The target and origin typically have no defined meaning.
type Ignore Activity
// A specialization of Offer in which the actor is extending an invitation for the object to the target.
type Invite Offer
// Indicates that the actor has joined the object. The target and origin typically have no defined meaning.
type Join Activity
// Indicates that the actor has left the object. The target and origin typically have no meaning.
type Leave Activity
// Indicates that the actor likes, recommends or endorses the object.
// The target and origin typically have no defined meaning.
type Like Activity
// Inherits all properties from Activity.
type Listen Activity
// Indicates that the actor has moved object from origin to target.
// If the origin or target are not specified, either can be determined by context.
type Move Activity
// Indicates that the actor is offering the object.
// If specified, the target indicates the entity to which the object is being offered.
type Offer Activity
// Indicates that the actor is rejecting the object. The target and origin typically have no defined meaning.
type Reject Activity
// Indicates that the actor has read the object.
type Read Activity
// Indicates that the actor is removing the object. If specified,
// the origin indicates the context from which the object is being removed.
type Remove Activity
// A specialization of Reject in which the rejection is considered tentative.
type TentativeReject Reject
// A specialization of Accept indicating that the acceptance is tentative.
type TentativeAccept Accept
// Indicates that the actor is traveling to target from origin.
// Travel is an IntransitiveObject whose actor specifies the direct object.
// If the target or origin are not specified, either can be determined by context.
type Travel IntransitiveActivity
// Indicates that the actor is undoing the object. In most cases, the object will be an Activity describing
// some previously performed action (for instance, a person may have previously "liked" an article but,
// for whatever reason, might choose to undo that like at some later point in time).
// The target and origin typically have no defined meaning.
type Undo Activity
// Indicates that the actor has updated the object. Note, however, that this vocabulary does not define a mechanism
// for describing the actual set of modifications made to object.
// The target and origin typically have no defined meaning.
type Update Activity
// Indicates that the actor has viewed the object.
type View Activity
// Represents a question being asked. Question objects are an extension of IntransitiveActivity.
// That is, the Question object is an Activity, but the direct object is the question
// itself and therefore it would not contain an object property.
// Either of the anyOf and oneOf properties may be used to express possible answers,
// but a Question object must not have both properties.
type Question struct {
*IntransitiveActivity
// Identifies an exclusive option for a Question. Use of oneOf implies that the Question
// can have only a single answer. To indicate that a Question can have multiple answers, use anyOf.
OneOf ObjectOrLink `jsonld:"oneOf"`
// Identifies an inclusive option for a Question. Use of anyOf implies that the Question can have multiple answers.
// To indicate that a Question can have only one answer, use oneOf.
AnyOf ObjectOrLink `jsonld:"anyOf"`
// Indicates that a question has been closed, and answers are no longer accepted.
Closed bool `jsonld:"closed"`
}
// Instances of IntransitiveActivity are a subtype of Activity representing intransitive actions.
// The object property is therefore inappropriate for these activities.
type IntransitiveActivity struct {
@ -225,6 +89,144 @@ type IntransitiveActivity struct {
Source Source
}
// An Activity is a subtype of Object that describes some form of action that may happen,
// is currently happening, or has already happened.
// The Activity type itself serves as an abstract base type for all types of activities.
// It is important to note that the Activity type itself does not carry any specific semantics
// about the kind of action being taken.
type Activity struct {
*IntransitiveActivity
// When used within an Activity, describes the direct object of the activity.
// For instance, in the activity "John added a movie to his wishlist",
// the object of the activity is the movie added.
// When used within a Relationship describes the entity to which the subject is related.
Object ObjectOrLink `jsonld:"object"`
}
type (
// Indicates that the actor accepts the object. The target property can be used in certain circumstances to indicate
// the context into which the object has been accepted.
Accept Activity
// Indicates that the actor has added the object to the target. If the target property is not explicitly specified,
// the target would need to be determined implicitly by context.
// The origin can be used to identify the context from which the object originated.
Add Activity
// Indicates that the actor is calling the target's attention the object.
// The origin typically has no defined meaning.
Announce Activity
// An IntransitiveActivity that indicates that the actor has arrived at the location.
// The origin can be used to identify the context from which the actor originated.
// The target typically has no defined meaning.
Arrive IntransitiveActivity
// Indicates that the actor is blocking the object. Blocking is a stronger form of Ignore.
// The typical use is to support social systems that allow one user to block activities or content of other users.
// The target and origin typically have no defined meaning.
Block Ignore
// Indicates that the actor has created the object.
Create Activity
// Indicates that the actor has deleted the object.
// If specified, the origin indicates the context from which the object was deleted.
Delete Activity
// Indicates that the actor dislikes the object.
Dislike Activity
// Indicates that the actor is "flagging" the object.
// Flagging is defined in the sense common to many social platforms as reporting content as being
// inappropriate for any number of reasons.
Flag Activity
// Indicates that the actor is "following" the object. Following is defined in the sense typically used within
// Social systems in which the actor is interested in any activity performed by or on the object.
// The target and origin typically have no defined meaning.
Follow Activity
// Indicates that the actor is ignoring the object. The target and origin typically have no defined meaning.
Ignore Activity
// A specialization of Offer in which the actor is extending an invitation for the object to the target.
Invite Offer
// Indicates that the actor has joined the object. The target and origin typically have no defined meaning.
Join Activity
// Indicates that the actor has left the object. The target and origin typically have no meaning.
Leave Activity
// Indicates that the actor likes, recommends or endorses the object.
// The target and origin typically have no defined meaning.
Like Activity
// Inherits all properties from Activity.
Listen Activity
// Indicates that the actor has moved object from origin to target.
// If the origin or target are not specified, either can be determined by context.
Move Activity
// Indicates that the actor is offering the object.
// If specified, the target indicates the entity to which the object is being offered.
Offer Activity
// Indicates that the actor is rejecting the object. The target and origin typically have no defined meaning.
Reject Activity
// Indicates that the actor has read the object.
Read Activity
// Indicates that the actor is removing the object. If specified,
// the origin indicates the context from which the object is being removed.
Remove Activity
// A specialization of Reject in which the rejection is considered tentative.
TentativeReject Reject
// A specialization of Accept indicating that the acceptance is tentative.
TentativeAccept Accept
// Indicates that the actor is traveling to target from origin.
// Travel is an IntransitiveObject whose actor specifies the direct object.
// If the target or origin are not specified, either can be determined by context.
Travel IntransitiveActivity
// Indicates that the actor is undoing the object. In most cases, the object will be an Activity describing
// some previously performed action (for instance, a person may have previously "liked" an article but,
// for whatever reason, might choose to undo that like at some later point in time).
// The target and origin typically have no defined meaning.
Undo Activity
// Indicates that the actor has updated the object. Note, however, that this vocabulary does not define a mechanism
// for describing the actual set of modifications made to object.
// The target and origin typically have no defined meaning.
Update Activity
// Indicates that the actor has viewed the object.
View Activity
)
// Represents a question being asked. Question objects are an extension of IntransitiveActivity.
// That is, the Question object is an Activity, but the direct object is the question
// itself and therefore it would not contain an object property.
// Either of the anyOf and oneOf properties may be used to express possible answers,
// but a Question object must not have both properties.
type Question struct {
*IntransitiveActivity
// Identifies an exclusive option for a Question. Use of oneOf implies that the Question
// can have only a single answer. To indicate that a Question can have multiple answers, use anyOf.
OneOf ObjectOrLink `jsonld:"oneOf"`
// Identifies an inclusive option for a Question. Use of anyOf implies that the Question can have multiple answers.
// To indicate that a Question can have only one answer, use oneOf.
AnyOf ObjectOrLink `jsonld:"anyOf"`
// Indicates that a question has been closed, and answers are no longer accepted.
Closed bool `jsonld:"closed"`
}
func AcceptNew(id ObjectId) *Accept {
a := ActivityNew(id, AcceptType)
o := Accept(*a)

View file

@ -69,20 +69,22 @@ type Actor struct {
Streams []Collection `jsonld:"streams"`
}
// Describes a software application.
type Application Actor
type (
// Describes a software application.
Application Actor
// Represents a formal or informal collective of Actors.
type Group Actor
// Represents a formal or informal collective of Actors.
Group Actor
// Represents an organization.
type Organization Actor
// Represents an organization.
Organization Actor
// Represents an individual person.
type Person Actor
// Represents an individual person.
Person Actor
// Represents a service of any kind.
type Service Actor
// Represents a service of any kind.
Service Actor
)
func ValidActorType(_type string) bool {
for _, v := range validActorTypes {

View file

@ -18,8 +18,6 @@ type OrderedCollection struct {
OrderedItems ItemCollection `jsonld:"orderedItems"`
}
type Page ObjectOrLink
type CollectionPage struct {
PartOf *Collection
// In a paged Collection, indicates the page that contains the most recently updated member items.

View file

@ -1,5 +1,7 @@
package activitypub
type FollowersCollection Followers
type (
FollowersCollection Followers
type Followers Collection
Followers Collection
)

View file

@ -1,5 +1,7 @@
package activitypub
type FollowingCollection Following
type (
FollowingCollection Following
type Following Collection
Following Collection
)

View file

@ -1,5 +1,7 @@
package activitypub
type InboxStream Inbox
type (
InboxStream Inbox
type Inbox OrderedCollection
Inbox OrderedCollection
)

View file

@ -1,5 +1,7 @@
package activitypub
type LikedCollection Liked
type (
LikedCollection Liked
type Liked OrderedCollection
Liked OrderedCollection
)

View file

@ -1,5 +1,7 @@
package activitypub
type LikesCollection Likes
type (
LikesCollection Likes
type Likes OrderedCollection
Likes OrderedCollection
)

View file

@ -1,5 +1,7 @@
package activitypub
type OutboxStream Outbox
type (
OutboxStream Outbox
type Outbox OrderedCollection
Outbox OrderedCollection
)

View file

@ -1,5 +1,7 @@
package activitypub
type SharesCollection Shares
type (
SharesCollection Shares
type Shares OrderedCollection
Shares OrderedCollection
)

View file

@ -1,4 +1,7 @@
package activitypub
type Iri URI
type URI string
type (
IRI URI
URI string
)