2018-01-24 08:00:59 +09:00
package vocab
import (
"time"
)
const example1 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Object" ,
"id" : "http://www.test.example/object/1" ,
"name" : "A Simple, non-specific object"
} `
var example1Type = & Object { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example1Type . AppendType ( "Object" )
2018-01-24 08:00:59 +09:00
example1Type . SetId ( MustParseURL ( "http://www.test.example/object/1" ) )
2018-05-28 00:07:40 +09:00
example1Type . AppendNameString ( "A Simple, non-specific object" )
2018-01-24 08:00:59 +09:00
}
const example2 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/abc" ,
"hreflang" : "en" ,
"mediaType" : "text/html" ,
"name" : "An example link"
} `
var example2Type = & Link { }
func init ( ) {
href := MustParseURL ( "http://example.org/abc" )
2018-05-28 00:07:40 +09:00
example2Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example2Type . SetHref ( href )
example2Type . SetHreflang ( "en" )
example2Type . SetMediaType ( "text/html" )
2018-05-28 00:07:40 +09:00
example2Type . AppendNameString ( "An example link" )
2018-01-24 08:00:59 +09:00
}
const example3 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Activity" ,
"summary" : "Sally did something to a note" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Note" ,
"name" : "A Note"
}
} `
var example3Type = & Activity { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Note { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Note" )
object . AppendNameString ( "A Note" )
example3Type . AppendType ( "Activity" )
example3Type . AppendSummaryString ( "Sally did something to a note" )
example3Type . AppendActorObject ( actor )
example3Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example4 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Travel" ,
"summary" : "Sally went to work" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"target" : {
"type" : "Place" ,
"name" : "Work"
}
} `
var example4Type = & Travel { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
place := & Place { }
2018-05-28 00:07:40 +09:00
place . AppendType ( "Place" )
place . AppendNameString ( "Work" )
example4Type . AppendType ( "Travel" )
example4Type . AppendSummaryString ( "Sally went to work" )
example4Type . AppendActorObject ( person )
example4Type . AppendTargetObject ( place )
2018-01-24 08:00:59 +09:00
}
const example5 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's notes" ,
"type" : "Collection" ,
"totalItems" : 2 ,
"items" : [
{
"type" : "Note" ,
"name" : "A Simple Note"
} ,
{
"type" : "Note" ,
"name" : "Another Simple Note"
}
]
} `
var example5Type = & Collection { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "A Simple Note" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Another Simple Note" )
example5Type . AppendType ( "Collection" )
example5Type . AppendSummaryString ( "Sally's notes" )
2018-01-24 08:00:59 +09:00
example5Type . SetTotalItems ( 2 )
2018-05-28 00:07:40 +09:00
example5Type . AppendItemsObject ( note1 )
example5Type . AppendItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example6 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's notes" ,
"type" : "OrderedCollection" ,
"totalItems" : 2 ,
"orderedItems" : [
{
"type" : "Note" ,
"name" : "A Simple Note"
} ,
{
"type" : "Note" ,
"name" : "Another Simple Note"
}
]
} `
var example6Type = & OrderedCollection { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "A Simple Note" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Another Simple Note" )
example6Type . AppendType ( "OrderedCollection" )
example6Type . AppendSummaryString ( "Sally's notes" )
2018-01-24 08:00:59 +09:00
example6Type . SetTotalItems ( 2 )
2018-05-28 00:07:40 +09:00
example6Type . AppendOrderedItemsObject ( note1 )
example6Type . AppendOrderedItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example7 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 1 of Sally's notes" ,
"type" : "CollectionPage" ,
"id" : "http://example.org/foo?page=1" ,
"partOf" : "http://example.org/foo" ,
"items" : [
{
"type" : "Note" ,
"name" : "A Simple Note"
} ,
{
"type" : "Note" ,
"name" : "Another Simple Note"
}
]
} `
var example7Type = & CollectionPage { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "A Simple Note" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Another Simple Note" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/foo" )
2018-05-28 00:07:40 +09:00
example7Type . AppendType ( "CollectionPage" )
example7Type . AppendSummaryString ( "Page 1 of Sally's notes" )
2018-01-24 08:00:59 +09:00
example7Type . SetId ( MustParseURL ( "http://example.org/foo?page=1" ) )
example7Type . SetPartOfIRI ( link )
2018-05-28 00:07:40 +09:00
example7Type . AppendItemsObject ( note1 )
example7Type . AppendItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example8 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 1 of Sally's notes" ,
"type" : "OrderedCollectionPage" ,
"id" : "http://example.org/foo?page=1" ,
"partOf" : "http://example.org/foo" ,
"orderedItems" : [
{
"type" : "Note" ,
"name" : "A Simple Note"
} ,
{
"type" : "Note" ,
"name" : "Another Simple Note"
}
]
} `
var example8Type = & OrderedCollectionPage { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "A Simple Note" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Another Simple Note" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/foo" )
2018-05-28 00:07:40 +09:00
example8Type . AppendType ( "OrderedCollectionPage" )
example8Type . AppendSummaryString ( "Page 1 of Sally's notes" )
2018-01-24 08:00:59 +09:00
example8Type . SetId ( MustParseURL ( "http://example.org/foo?page=1" ) )
example8Type . SetPartOfIRI ( link )
2018-05-28 00:07:40 +09:00
example8Type . AppendOrderedItemsObject ( note1 )
example8Type . AppendOrderedItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example9 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally accepted an invitation to a party" ,
"type" : "Accept" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Invite" ,
"actor" : "http://john.example.org" ,
"object" : {
"type" : "Event" ,
"name" : "Going-Away Party for Jim"
}
}
} `
var example9Type = & Accept { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
event := & Event { }
2018-05-28 00:07:40 +09:00
event . AppendType ( "Event" )
event . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://john.example.org" )
invite := & Invite { }
2018-05-28 00:07:40 +09:00
invite . AppendType ( "Invite" )
invite . AppendActorIRI ( link )
invite . AppendObject ( event )
example9Type . AppendType ( "Accept" )
example9Type . AppendSummaryString ( "Sally accepted an invitation to a party" )
example9Type . AppendActorObject ( person )
example9Type . AppendObject ( invite )
2018-01-24 08:00:59 +09:00
}
const example10 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally accepted Joe into the club" ,
"type" : "Accept" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Person" ,
"name" : "Joe"
} ,
"target" : {
"type" : "Group" ,
"name" : "The Club"
}
} `
var example10Type = & Accept { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Person { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Person" )
object . AppendNameString ( "Joe" )
2018-01-24 08:00:59 +09:00
target := & Group { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Group" )
target . AppendNameString ( "The Club" )
example10Type . AppendType ( "Accept" )
example10Type . AppendSummaryString ( "Sally accepted Joe into the club" )
example10Type . AppendActorObject ( person )
example10Type . AppendObject ( object )
example10Type . AppendTargetObject ( target )
2018-01-24 08:00:59 +09:00
}
const example11 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally tentatively accepted an invitation to a party" ,
"type" : "TentativeAccept" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Invite" ,
"actor" : "http://john.example.org" ,
"object" : {
"type" : "Event" ,
"name" : "Going-Away Party for Jim"
}
}
} `
var example11Type = & TentativeAccept { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
event := & Event { }
2018-05-28 00:07:40 +09:00
event . AppendType ( "Event" )
event . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://john.example.org" )
invite := & Invite { }
2018-05-28 00:07:40 +09:00
invite . AppendType ( "Invite" )
invite . AppendActorIRI ( link )
invite . AppendObject ( event )
example11Type . AppendType ( "TentativeAccept" )
example11Type . AppendSummaryString ( "Sally tentatively accepted an invitation to a party" )
example11Type . AppendActorObject ( person )
example11Type . AppendObject ( invite )
2018-01-24 08:00:59 +09:00
}
const example12 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally added an object" ,
"type" : "Add" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/abc"
} `
var example12Type = & Add { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/abc" )
2018-05-28 00:07:40 +09:00
example12Type . AppendType ( "Add" )
example12Type . AppendSummaryString ( "Sally added an object" )
example12Type . AppendActorObject ( person )
example12Type . AppendObjectIRI ( link )
2018-01-24 08:00:59 +09:00
}
const example13 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally added a picture of her cat to her cat picture collection" ,
"type" : "Add" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Image" ,
"name" : "A picture of my cat" ,
"url" : "http://example.org/img/cat.png"
} ,
"origin" : {
"type" : "Collection" ,
"name" : "Camera Roll"
} ,
"target" : {
"type" : "Collection" ,
"name" : "My Cat Pictures"
}
} `
var example13Type = & Add { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/img/cat.png" )
object := & Image { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Image" )
object . AppendNameString ( "A picture of my cat" )
object . AppendUrlAnyURI ( link )
2018-01-24 08:00:59 +09:00
origin := & Collection { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Collection" )
origin . AppendNameString ( "Camera Roll" )
2018-01-24 08:00:59 +09:00
target := & Collection { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Collection" )
target . AppendNameString ( "My Cat Pictures" )
example13Type . AppendType ( "Add" )
example13Type . AppendSummaryString ( "Sally added a picture of her cat to her cat picture collection" )
example13Type . AppendActorObject ( person )
example13Type . AppendObject ( object )
example13Type . AppendOriginObject ( origin )
example13Type . AppendTargetObject ( target )
2018-01-24 08:00:59 +09:00
}
const example14 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally arrived at work" ,
"type" : "Arrive" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"location" : {
"type" : "Place" ,
"name" : "Work"
} ,
"origin" : {
"type" : "Place" ,
"name" : "Home"
}
} `
var example14Type = & Arrive { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
location := & Place { }
2018-05-28 00:07:40 +09:00
location . AppendType ( "Place" )
location . AppendNameString ( "Work" )
2018-01-24 08:00:59 +09:00
origin := & Place { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Place" )
origin . AppendNameString ( "Home" )
example14Type . AppendType ( "Arrive" )
example14Type . AppendSummaryString ( "Sally arrived at work" )
example14Type . AppendActorObject ( person )
example14Type . AppendLocationObject ( location )
example14Type . AppendOriginObject ( origin )
2018-01-24 08:00:59 +09:00
}
const example15 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally created a note" ,
"type" : "Create" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Note" ,
"name" : "A Simple Note" ,
"content" : "This is a simple note"
}
} `
var example15Type = & Create { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Note { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Note" )
object . AppendNameString ( "A Simple Note" )
object . AppendContentString ( "This is a simple note" )
example15Type . AppendType ( "Create" )
example15Type . AppendSummaryString ( "Sally created a note" )
example15Type . AppendActorObject ( actor )
example15Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example16 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally deleted a note" ,
"type" : "Delete" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/notes/1" ,
"origin" : {
"type" : "Collection" ,
"name" : "Sally's Notes"
}
} `
var example16Type = & Delete { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
origin := & Collection { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Collection" )
origin . AppendNameString ( "Sally's Notes" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/notes/1" )
2018-05-28 00:07:40 +09:00
example16Type . AppendType ( "Delete" )
example16Type . AppendSummaryString ( "Sally deleted a note" )
example16Type . AppendActorObject ( actor )
example16Type . AppendObjectIRI ( link )
example16Type . AppendOriginObject ( origin )
2018-01-24 08:00:59 +09:00
}
const example17 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally followed John" ,
"type" : "Follow" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Person" ,
"name" : "John"
}
} `
var example17Type = & Follow { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Person { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Person" )
object . AppendNameString ( "John" )
example17Type . AppendType ( "Follow" )
example17Type . AppendSummaryString ( "Sally followed John" )
example17Type . AppendActorObject ( actor )
example17Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example18 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally ignored a note" ,
"type" : "Ignore" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/notes/1"
} `
var example18Type = & Ignore { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/notes/1" )
2018-05-28 00:07:40 +09:00
example18Type . AppendType ( "Ignore" )
example18Type . AppendSummaryString ( "Sally ignored a note" )
example18Type . AppendActorObject ( actor )
example18Type . AppendObjectIRI ( link )
2018-01-24 08:00:59 +09:00
}
const example19 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally joined a group" ,
"type" : "Join" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Group" ,
"name" : "A Simple Group"
}
} `
var example19Type = & Join { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Group { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Group" )
object . AppendNameString ( "A Simple Group" )
example19Type . AppendType ( "Join" )
example19Type . AppendSummaryString ( "Sally joined a group" )
example19Type . AppendActorObject ( actor )
example19Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example20 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally left work" ,
"type" : "Leave" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Place" ,
"name" : "Work"
}
} `
var example20Type = & Leave { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Place { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Place" )
object . AppendNameString ( "Work" )
example20Type . AppendType ( "Leave" )
example20Type . AppendSummaryString ( "Sally left work" )
example20Type . AppendActorObject ( actor )
example20Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example21 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally left a group" ,
"type" : "Leave" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Group" ,
"name" : "A Simple Group"
}
} `
var example21Type = & Leave { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Group { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Group" )
object . AppendNameString ( "A Simple Group" )
example21Type . AppendType ( "Leave" )
example21Type . AppendSummaryString ( "Sally left a group" )
example21Type . AppendActorObject ( actor )
example21Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example22 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally liked a note" ,
"type" : "Like" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/notes/1"
} `
var example22Type = & Like { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/notes/1" )
2018-05-28 00:07:40 +09:00
example22Type . AppendType ( "Like" )
example22Type . AppendSummaryString ( "Sally liked a note" )
example22Type . AppendActorObject ( actor )
example22Type . AppendObjectIRI ( link )
2018-01-24 08:00:59 +09:00
}
const example23 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered 50% off to Lewis" ,
"type" : "Offer" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "http://www.types.example/ProductOffer" ,
"name" : "50% Off!"
} ,
"target" : {
"type" : "Person" ,
"name" : "Lewis"
}
} `
var example23Type = & Offer { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := make ( map [ string ] interface { } )
object [ "type" ] = "http://www.types.example/ProductOffer"
object [ "name" ] = "50% Off!"
target := & Person { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Person" )
target . AppendNameString ( "Lewis" )
example23Type . AppendType ( "Offer" )
example23Type . AppendSummaryString ( "Sally offered 50% off to Lewis" )
example23Type . AppendActorObject ( actor )
2018-01-24 08:00:59 +09:00
example23Type . SetUnknownObject ( object )
2018-05-28 00:07:40 +09:00
example23Type . AppendTargetObject ( target )
2018-01-24 08:00:59 +09:00
}
const example24 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally invited John and Lisa to a party" ,
"type" : "Invite" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Event" ,
"name" : "A Party"
} ,
"target" : [
{
"type" : "Person" ,
"name" : "John"
} ,
{
"type" : "Person" ,
"name" : "Lisa"
}
]
} `
var example24Type = & Invite { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Event { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Event" )
object . AppendNameString ( "A Party" )
2018-01-24 08:00:59 +09:00
target1 := & Person { }
2018-05-28 00:07:40 +09:00
target1 . AppendType ( "Person" )
target1 . AppendNameString ( "John" )
2018-01-24 08:00:59 +09:00
target2 := & Person { }
2018-05-28 00:07:40 +09:00
target2 . AppendType ( "Person" )
target2 . AppendNameString ( "Lisa" )
example24Type . AppendType ( "Invite" )
example24Type . AppendSummaryString ( "Sally invited John and Lisa to a party" )
example24Type . AppendActorObject ( actor )
example24Type . AppendObject ( object )
example24Type . AppendTargetObject ( target1 )
example24Type . AppendTargetObject ( target2 )
2018-01-24 08:00:59 +09:00
}
const example25 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally rejected an invitation to a party" ,
"type" : "Reject" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Invite" ,
"actor" : "http://john.example.org" ,
"object" : {
"type" : "Event" ,
"name" : "Going-Away Party for Jim"
}
}
} `
var example25Type = & Reject { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://john.example.org" )
inviteObject := & Event { }
2018-05-28 00:07:40 +09:00
inviteObject . AppendType ( "Event" )
inviteObject . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
object := & Invite { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Invite" )
object . AppendActorIRI ( link )
object . AppendObject ( inviteObject )
example25Type . AppendType ( "Reject" )
example25Type . AppendSummaryString ( "Sally rejected an invitation to a party" )
example25Type . AppendActorObject ( actor )
example25Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example26 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally tentatively rejected an invitation to a party" ,
"type" : "TentativeReject" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Invite" ,
"actor" : "http://john.example.org" ,
"object" : {
"type" : "Event" ,
"name" : "Going-Away Party for Jim"
}
}
} `
var example26Type = & TentativeReject { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://john.example.org" )
inviteObject := & Event { }
2018-05-28 00:07:40 +09:00
inviteObject . AppendType ( "Event" )
inviteObject . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
object := & Invite { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Invite" )
object . AppendActorIRI ( link )
object . AppendObject ( inviteObject )
example26Type . AppendType ( "TentativeReject" )
example26Type . AppendSummaryString ( "Sally tentatively rejected an invitation to a party" )
example26Type . AppendActorObject ( actor )
example26Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example27 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally removed a note from her notes folder" ,
"type" : "Remove" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/notes/1" ,
"target" : {
"type" : "Collection" ,
"name" : "Notes Folder"
}
} `
var example27Type = & Remove { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/notes/1" )
target := & Collection { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Collection" )
target . AppendNameString ( "Notes Folder" )
example27Type . AppendType ( "Remove" )
example27Type . AppendSummaryString ( "Sally removed a note from her notes folder" )
example27Type . AppendActorObject ( actor )
example27Type . AppendObjectIRI ( link )
example27Type . AppendTargetObject ( target )
2018-01-24 08:00:59 +09:00
}
const example28 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "The moderator removed Sally from a group" ,
"type" : "Remove" ,
"actor" : {
"type" : "http://example.org/Role" ,
"name" : "The Moderator"
} ,
"object" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"origin" : {
"type" : "Group" ,
"name" : "A Simple Group"
}
} `
var example28Type = & Remove { }
func init ( ) {
actor := make ( map [ string ] interface { } )
actor [ "type" ] = "http://example.org/Role"
actor [ "name" ] = "The Moderator"
object := & Person { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Person" )
object . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
origin := & Group { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Group" )
origin . AppendNameString ( "A Simple Group" )
example28Type . AppendType ( "Remove" )
example28Type . AppendSummaryString ( "The moderator removed Sally from a group" )
2018-01-24 08:00:59 +09:00
example28Type . SetUnknownActor ( actor )
2018-05-28 00:07:40 +09:00
example28Type . AppendObject ( object )
example28Type . AppendOriginObject ( origin )
2018-01-24 08:00:59 +09:00
}
const example29 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally retracted her offer to John" ,
"type" : "Undo" ,
"actor" : "http://sally.example.org" ,
"object" : {
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org"
}
} `
var example29Type = & Undo { }
func init ( ) {
link := MustParseURL ( "http://sally.example.org" )
objectLink := MustParseURL ( "http://example.org/posts/1" )
targetLink := MustParseURL ( "http://john.example.org" )
object := & Offer { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Offer" )
object . AppendActorIRI ( link )
object . AppendObjectIRI ( objectLink )
object . AppendTargetIRI ( targetLink )
example29Type . AppendType ( "Undo" )
example29Type . AppendSummaryString ( "Sally retracted her offer to John" )
example29Type . AppendActorIRI ( link )
example29Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example30 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally updated her note" ,
"type" : "Update" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/notes/1"
} `
var example30Type = & Update { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/notes/1" )
2018-05-28 00:07:40 +09:00
example30Type . AppendType ( "Update" )
example30Type . AppendSummaryString ( "Sally updated her note" )
example30Type . AppendActorObject ( actor )
example30Type . AppendObjectIRI ( link )
2018-01-24 08:00:59 +09:00
}
const example31 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally read an article" ,
"type" : "View" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Article" ,
"name" : "What You Should Know About Activity Streams"
}
} `
var example31Type = & View { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Article { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Article" )
object . AppendNameString ( "What You Should Know About Activity Streams" )
example31Type . AppendType ( "View" )
example31Type . AppendSummaryString ( "Sally read an article" )
example31Type . AppendActorObject ( actor )
example31Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example32 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally listened to a piece of music" ,
"type" : "Listen" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/music.mp3"
} `
var example32Type = & Listen { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/music.mp3" )
2018-05-28 00:07:40 +09:00
example32Type . AppendType ( "Listen" )
example32Type . AppendSummaryString ( "Sally listened to a piece of music" )
example32Type . AppendActorObject ( actor )
example32Type . AppendObjectIRI ( link )
2018-01-24 08:00:59 +09:00
}
const example33 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally read a blog post" ,
"type" : "Read" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/posts/1"
} `
var example33Type = & Read { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/posts/1" )
2018-05-28 00:07:40 +09:00
example33Type . AppendType ( "Read" )
example33Type . AppendSummaryString ( "Sally read a blog post" )
example33Type . AppendActorObject ( actor )
example33Type . AppendObjectIRI ( link )
2018-01-24 08:00:59 +09:00
}
const example34 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally moved a post from List A to List B" ,
"type" : "Move" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/posts/1" ,
"target" : {
"type" : "Collection" ,
"name" : "List B"
} ,
"origin" : {
"type" : "Collection" ,
"name" : "List A"
}
} `
var example34Type = & Move { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
link := MustParseURL ( "http://example.org/posts/1" )
target := & Collection { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Collection" )
target . AppendNameString ( "List B" )
2018-01-24 08:00:59 +09:00
origin := & Collection { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Collection" )
origin . AppendNameString ( "List A" )
example34Type . AppendType ( "Move" )
example34Type . AppendSummaryString ( "Sally moved a post from List A to List B" )
example34Type . AppendActorObject ( actor )
example34Type . AppendObjectIRI ( link )
example34Type . AppendTargetObject ( target )
example34Type . AppendOriginObject ( origin )
2018-01-24 08:00:59 +09:00
}
const example35 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally went home from work" ,
"type" : "Travel" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"target" : {
"type" : "Place" ,
"name" : "Home"
} ,
"origin" : {
"type" : "Place" ,
"name" : "Work"
}
} `
var example35Type = & Travel { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
target := & Place { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Place" )
target . AppendNameString ( "Home" )
2018-01-24 08:00:59 +09:00
origin := & Place { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Place" )
origin . AppendNameString ( "Work" )
example35Type . AppendType ( "Travel" )
example35Type . AppendSummaryString ( "Sally went home from work" )
example35Type . AppendActorObject ( actor )
example35Type . AppendTargetObject ( target )
example35Type . AppendOriginObject ( origin )
2018-01-24 08:00:59 +09:00
}
const example36 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally announced that she had arrived at work" ,
"type" : "Announce" ,
"actor" : {
"type" : "Person" ,
"id" : "http://sally.example.org" ,
"name" : "Sally"
} ,
"object" : {
"type" : "Arrive" ,
"actor" : "http://sally.example.org" ,
"location" : {
"type" : "Place" ,
"name" : "Work"
}
}
} `
var example36Type = & Announce { }
func init ( ) {
link := MustParseURL ( "http://sally.example.org" )
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
actor . SetId ( link )
loc := & Place { }
2018-05-28 00:07:40 +09:00
loc . AppendType ( "Place" )
loc . AppendNameString ( "Work" )
2018-01-24 08:00:59 +09:00
object := & Arrive { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Arrive" )
object . AppendActorIRI ( link )
object . AppendLocationObject ( loc )
example36Type . AppendType ( "Announce" )
example36Type . AppendSummaryString ( "Sally announced that she had arrived at work" )
example36Type . AppendActorObject ( actor )
example36Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example37 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally blocked Joe" ,
"type" : "Block" ,
"actor" : "http://sally.example.org" ,
"object" : "http://joe.example.org"
} `
var example37Type = & Block { }
func init ( ) {
link := MustParseURL ( "http://sally.example.org" )
objLink := MustParseURL ( "http://joe.example.org" )
2018-05-28 00:07:40 +09:00
example37Type . AppendType ( "Block" )
example37Type . AppendSummaryString ( "Sally blocked Joe" )
example37Type . AppendActorIRI ( link )
example37Type . AppendObjectIRI ( objLink )
2018-01-24 08:00:59 +09:00
}
const example38 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally flagged an inappropriate note" ,
"type" : "Flag" ,
"actor" : "http://sally.example.org" ,
"object" : {
"type" : "Note" ,
"content" : "An inappropriate note"
}
} `
var example38Type = & Flag { }
func init ( ) {
link := MustParseURL ( "http://sally.example.org" )
object := & Note { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Note" )
object . AppendContentString ( "An inappropriate note" )
example38Type . AppendType ( "Flag" )
example38Type . AppendSummaryString ( "Sally flagged an inappropriate note" )
example38Type . AppendActorIRI ( link )
example38Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
}
const example39 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally disliked a post" ,
"type" : "Dislike" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1"
} `
var example39Type = & Dislike { }
func init ( ) {
link := MustParseURL ( "http://sally.example.org" )
objLink := MustParseURL ( "http://example.org/posts/1" )
2018-05-28 00:07:40 +09:00
example39Type . AppendType ( "Dislike" )
example39Type . AppendSummaryString ( "Sally disliked a post" )
example39Type . AppendActorIRI ( link )
example39Type . AppendObjectIRI ( objLink )
2018-01-24 08:00:59 +09:00
}
const example40 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Question" ,
"name" : "What is the answer?" ,
"oneOf" : [
{
"type" : "Note" ,
"name" : "Option A"
} ,
{
"type" : "Note" ,
"name" : "Option B"
}
]
} `
var example40Type = & Question { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Option A" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Option B" )
example40Type . AppendType ( "Question" )
example40Type . AppendNameString ( "What is the answer?" )
example40Type . AppendOneOfObject ( note1 )
example40Type . AppendOneOfObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example41 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Question" ,
"name" : "What is the answer?" ,
"closed" : "2016-05-10T00:00:00Z"
} `
var example41Type = & Question { }
func init ( ) {
t , err := time . Parse ( time . RFC3339 , "2016-05-10T00:00:00Z" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example41Type . AppendType ( "Question" )
example41Type . AppendNameString ( "What is the answer?" )
example41Type . AppendClosedDateTime ( t )
2018-01-24 08:00:59 +09:00
}
const example42 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Application" ,
"name" : "Exampletron 3000"
} `
var example42Type = & Application { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example42Type . AppendType ( "Application" )
example42Type . AppendNameString ( "Exampletron 3000" )
2018-01-24 08:00:59 +09:00
}
const example43 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Group" ,
"name" : "Big Beards of Austin"
} `
var example43Type = & Group { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example43Type . AppendType ( "Group" )
example43Type . AppendNameString ( "Big Beards of Austin" )
2018-01-24 08:00:59 +09:00
}
const example44 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Organization" ,
"name" : "Example Co."
} `
var example44Type = & Organization { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example44Type . AppendType ( "Organization" )
example44Type . AppendNameString ( "Example Co." )
2018-01-24 08:00:59 +09:00
}
const example45 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Person" ,
"name" : "Sally Smith"
} `
var example45Type = & Person { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example45Type . AppendType ( "Person" )
example45Type . AppendNameString ( "Sally Smith" )
2018-01-24 08:00:59 +09:00
}
const example46 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Service" ,
"name" : "Acme Web Service"
} `
var example46Type = & Service { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example46Type . AppendType ( "Service" )
example46Type . AppendNameString ( "Acme Web Service" )
2018-01-24 08:00:59 +09:00
}
const example47 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally is an acquaintance of John" ,
"type" : "Relationship" ,
"subject" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"relationship" : "http://purl.org/vocab/relationship/acquaintanceOf" ,
"object" : {
"type" : "Person" ,
"name" : "John"
}
} `
var example47Type = & Relationship { }
func init ( ) {
subject := & Person { }
2018-05-28 00:07:40 +09:00
subject . AppendType ( "Person" )
subject . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Person { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Person" )
object . AppendNameString ( "John" )
2018-01-24 08:00:59 +09:00
rel := MustParseURL ( "http://purl.org/vocab/relationship/acquaintanceOf" )
2018-05-28 00:07:40 +09:00
example47Type . AppendType ( "Relationship" )
example47Type . AppendSummaryString ( "Sally is an acquaintance of John" )
2018-01-24 08:00:59 +09:00
example47Type . SetSubjectObject ( subject )
2018-05-28 00:07:40 +09:00
example47Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
example47Type . SetRelationshipIRI ( rel )
}
const example48 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Article" ,
"name" : "What a Crazy Day I Had" ,
"content" : "<div>... you will never believe ...</div>" ,
"attributedTo" : "http://sally.example.org"
} `
var example48Type = & Article { }
func init ( ) {
att := MustParseURL ( "http://sally.example.org" )
2018-05-28 00:07:40 +09:00
example48Type . AppendType ( "Article" )
example48Type . AppendNameString ( "What a Crazy Day I Had" )
example48Type . AppendAttributedToIRI ( att )
example48Type . AppendContentString ( "<div>... you will never believe ...</div>" )
2018-01-24 08:00:59 +09:00
}
const example49 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Document" ,
"name" : "4Q Sales Forecast" ,
"url" : "http://example.org/4q-sales-forecast.pdf"
} `
var example49Type = & Document { }
func init ( ) {
l := MustParseURL ( "http://example.org/4q-sales-forecast.pdf" )
2018-05-28 00:07:40 +09:00
example49Type . AppendType ( "Document" )
example49Type . AppendNameString ( "4Q Sales Forecast" )
example49Type . AppendUrlAnyURI ( l )
2018-01-24 08:00:59 +09:00
}
const example50 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Audio" ,
"name" : "Interview With A Famous Technologist" ,
"url" : {
"type" : "Link" ,
"href" : "http://example.org/podcast.mp3" ,
"mediaType" : "audio/mp3"
}
} `
var example50Type = & Audio { }
func init ( ) {
l := MustParseURL ( "http://example.org/podcast.mp3" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link . SetHref ( l )
link . SetMediaType ( "audio/mp3" )
2018-05-28 00:07:40 +09:00
example50Type . AppendType ( "Audio" )
example50Type . AppendNameString ( "Interview With A Famous Technologist" )
example50Type . AppendUrlLink ( link )
2018-01-24 08:00:59 +09:00
}
const example51 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Image" ,
"name" : "Cat Jumping on Wagon" ,
"url" : [
{
"type" : "Link" ,
"href" : "http://example.org/image.jpeg" ,
"mediaType" : "image/jpeg"
} ,
{
"type" : "Link" ,
"href" : "http://example.org/image.png" ,
"mediaType" : "image/png"
}
]
} `
var example51Type = & Image { }
func init ( ) {
l1 := MustParseURL ( "http://example.org/image.jpeg" )
l2 := MustParseURL ( "http://example.org/image.png" )
link1 := & Link { }
2018-05-28 00:07:40 +09:00
link1 . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link1 . SetHref ( l1 )
link1 . SetMediaType ( "image/jpeg" )
link2 := & Link { }
2018-05-28 00:07:40 +09:00
link2 . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link2 . SetHref ( l2 )
link2 . SetMediaType ( "image/png" )
2018-05-28 00:07:40 +09:00
example51Type . AppendType ( "Image" )
example51Type . AppendNameString ( "Cat Jumping on Wagon" )
example51Type . AppendUrlLink ( link1 )
example51Type . AppendUrlLink ( link2 )
2018-01-24 08:00:59 +09:00
}
const example52 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Video" ,
"name" : "Puppy Plays With Ball" ,
"url" : "http://example.org/video.mkv" ,
"duration" : "PT2H"
} `
var example52Type = & Video { }
func init ( ) {
l := MustParseURL ( "http://example.org/video.mkv" )
2018-05-28 00:07:40 +09:00
example52Type . AppendType ( "Video" )
example52Type . AppendNameString ( "Puppy Plays With Ball" )
example52Type . AppendUrlAnyURI ( l )
2018-01-24 08:00:59 +09:00
example52Type . SetDuration ( time . Hour * 2 )
}
const example53 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Note" ,
"name" : "A Word of Warning" ,
"content" : "Looks like it is going to rain today. Bring an umbrella!"
} `
var example53Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example53Type . AppendType ( "Note" )
example53Type . AppendNameString ( "A Word of Warning" )
example53Type . AppendContentString ( "Looks like it is going to rain today. Bring an umbrella!" )
2018-01-24 08:00:59 +09:00
}
const example54 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Page" ,
"name" : "Omaha Weather Report" ,
"url" : "http://example.org/weather-in-omaha.html"
} `
var example54Type = & Page { }
func init ( ) {
l := MustParseURL ( "http://example.org/weather-in-omaha.html" )
2018-05-28 00:07:40 +09:00
example54Type . AppendType ( "Page" )
example54Type . AppendNameString ( "Omaha Weather Report" )
example54Type . AppendUrlAnyURI ( l )
2018-01-24 08:00:59 +09:00
}
const example55 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Event" ,
"name" : "Going-Away Party for Jim" ,
"startTime" : "2014-12-31T23:00:00-08:00" ,
"endTime" : "2015-01-01T06:00:00-08:00"
} `
var example55Type = & Event { }
func init ( ) {
t1 , err := time . Parse ( time . RFC3339 , "2014-12-31T23:00:00-08:00" )
if err != nil {
panic ( err )
}
t2 , err := time . Parse ( time . RFC3339 , "2015-01-01T06:00:00-08:00" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example55Type . AppendType ( "Event" )
example55Type . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
example55Type . SetStartTime ( t1 )
example55Type . SetEndTime ( t2 )
}
const example56 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Work"
} `
var example56Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example56Type . AppendType ( "Place" )
example56Type . AppendNameString ( "Work" )
2018-01-24 08:00:59 +09:00
}
const example57 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Fresno Area" ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"radius" : 15 ,
"units" : "miles"
} `
var example57Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example57Type . AppendType ( "Place" )
example57Type . AppendNameString ( "Fresno Area" )
2018-01-24 08:00:59 +09:00
example57Type . SetLatitude ( 36.75 )
example57Type . SetLongitude ( 119.7667 )
example57Type . SetRadius ( 15 )
example57Type . SetUnitsUnitsValue ( "miles" )
}
const example58 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Mention of Joe by Carrie in her note" ,
"type" : "Mention" ,
"href" : "http://example.org/joe" ,
"name" : "Joe"
} `
var example58Type = & Mention { }
func init ( ) {
l := MustParseURL ( "http://example.org/joe" )
2018-05-28 00:07:40 +09:00
example58Type . AppendType ( "Mention" )
example58Type . AppendSummaryString ( "Mention of Joe by Carrie in her note" )
2018-01-24 08:00:59 +09:00
example58Type . SetHref ( l )
2018-05-28 00:07:40 +09:00
example58Type . AppendNameString ( "Joe" )
2018-01-24 08:00:59 +09:00
}
const example59 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Profile" ,
"summary" : "Sally's Profile" ,
"describes" : {
"type" : "Person" ,
"name" : "Sally Smith"
}
} `
var example59Type = & Profile { }
func init ( ) {
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally Smith" )
example59Type . AppendType ( "Profile" )
example59Type . AppendSummaryString ( "Sally's Profile" )
2018-01-24 08:00:59 +09:00
example59Type . SetDescribes ( person )
}
// Note that the @context is missing from the spec!
const example60 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "OrderedCollection" ,
"totalItems" : 3 ,
"name" : "Vacation photos 2016" ,
"orderedItems" : [
{
"type" : "Image" ,
"id" : "http://image.example/1"
} ,
{
"type" : "Tombstone" ,
"formerType" : "Image" ,
"id" : "http://image.example/2" ,
"deleted" : "2016-03-17T00:00:00Z"
} ,
{
"type" : "Image" ,
"id" : "http://image.example/3"
}
]
} `
var example60Type = & OrderedCollection { }
func init ( ) {
t , err := time . Parse ( time . RFC3339 , "2016-03-17T00:00:00Z" )
if err != nil {
panic ( err )
}
image1 := & Image { }
2018-05-28 00:07:40 +09:00
image1 . AppendType ( "Image" )
2018-01-24 08:00:59 +09:00
image1 . SetId ( MustParseURL ( "http://image.example/1" ) )
tombstone := & Tombstone { }
2018-05-28 00:07:40 +09:00
tombstone . AppendType ( "Tombstone" )
tombstone . AppendFormerTypeString ( "Image" )
2018-01-24 08:00:59 +09:00
tombstone . SetId ( MustParseURL ( "http://image.example/2" ) )
tombstone . SetDeleted ( t )
image2 := & Image { }
2018-05-28 00:07:40 +09:00
image2 . AppendType ( "Image" )
2018-01-24 08:00:59 +09:00
image2 . SetId ( MustParseURL ( "http://image.example/3" ) )
2018-05-28 00:07:40 +09:00
example60Type . AppendType ( "OrderedCollection" )
2018-01-24 08:00:59 +09:00
example60Type . SetTotalItems ( 3 )
2018-05-28 00:07:40 +09:00
example60Type . AppendNameString ( "Vacation photos 2016" )
example60Type . AppendOrderedItemsObject ( image1 )
example60Type . AppendOrderedItemsObject ( tombstone )
example60Type . AppendOrderedItemsObject ( image2 )
2018-01-24 08:00:59 +09:00
}
const example61 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "Foo" ,
"id" : "http://example.org/foo"
} `
var example61Type = & Unknown { }
func init ( ) {
example61Type . SetField ( "id" , "http://example.org/foo" )
example61Type . SetField ( "name" , "Foo" )
}
const example62 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A foo" ,
"type" : "http://example.org/Foo"
} `
var example62Type = & Unknown { }
func init ( ) {
example62Type . SetField ( "type" , "http://example.org/Foo" )
example62Type . SetField ( "summary" , "A foo" )
}
const example63 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered the Foo object" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/foo"
} `
var example63Type = & Offer { }
func init ( ) {
l := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/foo" )
2018-05-28 00:07:40 +09:00
example63Type . AppendType ( "Offer" )
example63Type . AppendSummaryString ( "Sally offered the Foo object" )
example63Type . AppendActorIRI ( l )
example63Type . AppendObjectIRI ( o )
2018-01-24 08:00:59 +09:00
}
const example64 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered the Foo object" ,
"type" : "Offer" ,
"actor" : {
"type" : "Person" ,
"id" : "http://sally.example.org" ,
"summary" : "Sally"
} ,
"object" : "http://example.org/foo"
} `
var example64Type = & Offer { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
2018-01-24 08:00:59 +09:00
actor . SetId ( MustParseURL ( "http://sally.example.org" ) )
2018-05-28 00:07:40 +09:00
actor . AppendSummaryString ( "Sally" )
2018-01-24 08:00:59 +09:00
o := MustParseURL ( "http://example.org/foo" )
2018-05-28 00:07:40 +09:00
example64Type . AppendType ( "Offer" )
example64Type . AppendSummaryString ( "Sally offered the Foo object" )
example64Type . AppendActorObject ( actor )
example64Type . AppendObjectIRI ( o )
2018-01-24 08:00:59 +09:00
}
const example65 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally and Joe offered the Foo object" ,
"type" : "Offer" ,
"actor" : [
"http://joe.example.org" ,
{
"type" : "Person" ,
"id" : "http://sally.example.org" ,
"name" : "Sally"
}
] ,
"object" : "http://example.org/foo"
} `
var example65Type = & Offer { }
func init ( ) {
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
2018-01-24 08:00:59 +09:00
actor . SetId ( MustParseURL ( "http://sally.example.org" ) )
2018-05-28 00:07:40 +09:00
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
o := MustParseURL ( "http://example.org/foo" )
l := MustParseURL ( "http://joe.example.org" )
2018-05-28 00:07:40 +09:00
example65Type . AppendType ( "Offer" )
example65Type . AppendSummaryString ( "Sally and Joe offered the Foo object" )
example65Type . AppendObjectIRI ( o )
example65Type . AppendActorIRI ( l )
example65Type . AppendActorObject ( actor )
2018-01-24 08:00:59 +09:00
}
// NOTE: Changed to not be an array value for "attachment" to keep in line with other examples in spec!
const example66 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Note" ,
"name" : "Have you seen my cat?" ,
"attachment" : {
"type" : "Image" ,
"content" : "This is what he looks like." ,
"url" : "http://example.org/cat.jpeg"
}
} `
var example66Type = & Note { }
func init ( ) {
l := MustParseURL ( "http://example.org/cat.jpeg" )
image := & Image { }
2018-05-28 00:07:40 +09:00
image . AppendType ( "Image" )
image . AppendContentString ( "This is what he looks like." )
image . AppendUrlAnyURI ( l )
example66Type . AppendType ( "Note" )
example66Type . AppendNameString ( "Have you seen my cat?" )
example66Type . AppendAttachmentObject ( image )
2018-01-24 08:00:59 +09:00
}
// NOTE: Changed to not be an array value for "attributedTo" to keep in line with other examples in spec!
const example67 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Image" ,
"name" : "My cat taking a nap" ,
"url" : "http://example.org/cat.jpeg" ,
"attributedTo" : {
"type" : "Person" ,
"name" : "Sally"
}
} `
var example67Type = & Image { }
func init ( ) {
l := MustParseURL ( "http://example.org/cat.jpeg" )
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
example67Type . AppendType ( "Image" )
example67Type . AppendNameString ( "My cat taking a nap" )
example67Type . AppendUrlAnyURI ( l )
example67Type . AppendAttributedToObject ( person )
2018-01-24 08:00:59 +09:00
}
const example68 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Image" ,
"name" : "My cat taking a nap" ,
"url" : "http://example.org/cat.jpeg" ,
"attributedTo" : [
"http://joe.example.org" ,
{
"type" : "Person" ,
"name" : "Sally"
}
]
} `
var example68Type = & Image { }
func init ( ) {
l := MustParseURL ( "http://example.org/cat.jpeg" )
a := MustParseURL ( "http://joe.example.org" )
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
example68Type . AppendType ( "Image" )
example68Type . AppendNameString ( "My cat taking a nap" )
example68Type . AppendUrlAnyURI ( l )
example68Type . AppendAttributedToIRI ( a )
example68Type . AppendAttributedToObject ( person )
2018-01-24 08:00:59 +09:00
}
const example69 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "Holiday announcement" ,
"type" : "Note" ,
"content" : "Thursday will be a company-wide holiday. Enjoy your day off!" ,
"audience" : {
"type" : "http://example.org/Organization" ,
"name" : "ExampleCo LLC"
}
} `
var example69Type = & Note { }
func init ( ) {
audience := make ( map [ string ] interface { } )
audience [ "type" ] = "http://example.org/Organization"
audience [ "name" ] = "ExampleCo LLC"
2018-05-28 00:07:40 +09:00
example69Type . AppendType ( "Note" )
example69Type . AppendNameString ( "Holiday announcement" )
example69Type . AppendContentString ( "Thursday will be a company-wide holiday. Enjoy your day off!" )
2018-01-24 08:00:59 +09:00
example69Type . AddUnknown ( "audience" , audience )
}
// NOTE: Changed to not be an array value for "bcc" to keep in line with other examples in spec!
const example70 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered a post to John" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org" ,
"bcc" : "http://joe.example.org"
} `
var example70Type = & Offer { }
func init ( ) {
o := MustParseURL ( "http://example.org/posts/1" )
a := MustParseURL ( "http://sally.example.org" )
t := MustParseURL ( "http://john.example.org" )
b := MustParseURL ( "http://joe.example.org" )
2018-05-28 00:07:40 +09:00
example70Type . AppendType ( "Offer" )
example70Type . AppendSummaryString ( "Sally offered a post to John" )
example70Type . AppendActorIRI ( a )
example70Type . AppendObjectIRI ( o )
example70Type . AppendTargetIRI ( t )
example70Type . AppendBccIRI ( b )
2018-01-24 08:00:59 +09:00
}
// NOTE: Changed to not be an array value for "bto" to keep in line with other examples in spec!
const example71 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered a post to John" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org" ,
"bto" : "http://joe.example.org"
} `
var example71Type = & Offer { }
func init ( ) {
o := MustParseURL ( "http://example.org/posts/1" )
a := MustParseURL ( "http://sally.example.org" )
t := MustParseURL ( "http://john.example.org" )
b := MustParseURL ( "http://joe.example.org" )
2018-05-28 00:07:40 +09:00
example71Type . AppendType ( "Offer" )
example71Type . AppendSummaryString ( "Sally offered a post to John" )
example71Type . AppendActorIRI ( a )
example71Type . AppendObjectIRI ( o )
example71Type . AppendTargetIRI ( t )
example71Type . AppendBtoIRI ( b )
2018-01-24 08:00:59 +09:00
}
// NOTE: Changed to not be an array value for "cc" to keep in line with other examples in spec!
const example72 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered a post to John" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org" ,
"cc" : "http://joe.example.org"
} `
var example72Type = & Offer { }
func init ( ) {
o := MustParseURL ( "http://example.org/posts/1" )
a := MustParseURL ( "http://sally.example.org" )
t := MustParseURL ( "http://john.example.org" )
b := MustParseURL ( "http://joe.example.org" )
2018-05-28 00:07:40 +09:00
example72Type . AppendType ( "Offer" )
example72Type . AppendSummaryString ( "Sally offered a post to John" )
example72Type . AppendActorIRI ( a )
example72Type . AppendObjectIRI ( o )
example72Type . AppendTargetIRI ( t )
example72Type . AppendCcIRI ( b )
2018-01-24 08:00:59 +09:00
}
const example73 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Activities in context 1" ,
"type" : "Collection" ,
"items" : [
{
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org" ,
"context" : "http://example.org/contexts/1"
} ,
{
"type" : "Like" ,
"actor" : "http://joe.example.org" ,
"object" : "http://example.org/posts/2" ,
"context" : "http://example.org/contexts/1"
}
]
} `
var example73Type = & Collection { }
func init ( ) {
oa := MustParseURL ( "http://sally.example.org" )
oo := MustParseURL ( "http://example.org/posts/1" )
ot := MustParseURL ( "http://john.example.org" )
oc := MustParseURL ( "http://example.org/contexts/1" )
offer := & Offer { }
2018-05-28 00:07:40 +09:00
offer . AppendType ( "Offer" )
offer . AppendActorIRI ( oa )
offer . AppendObjectIRI ( oo )
offer . AppendTargetIRI ( ot )
offer . AppendContextIRI ( oc )
2018-01-24 08:00:59 +09:00
la := MustParseURL ( "http://joe.example.org" )
lo := MustParseURL ( "http://example.org/posts/2" )
lc := MustParseURL ( "http://example.org/contexts/1" )
like := & Like { }
2018-05-28 00:07:40 +09:00
like . AppendType ( "Like" )
like . AppendActorIRI ( la )
like . AppendObjectIRI ( lo )
like . AppendContextIRI ( lc )
example73Type . AppendType ( "Collection" )
example73Type . AppendSummaryString ( "Activities in context 1" )
example73Type . AppendItemsObject ( offer )
example73Type . AppendItemsObject ( like )
2018-01-24 08:00:59 +09:00
}
const example74 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's blog posts" ,
"type" : "Collection" ,
"totalItems" : 3 ,
"current" : "http://example.org/collection" ,
"items" : [
"http://example.org/posts/1" ,
"http://example.org/posts/2" ,
"http://example.org/posts/3"
]
} `
var example74Type = & Collection { }
func init ( ) {
c := MustParseURL ( "http://example.org/collection" )
i1 := MustParseURL ( "http://example.org/posts/1" )
i2 := MustParseURL ( "http://example.org/posts/2" )
i3 := MustParseURL ( "http://example.org/posts/3" )
2018-05-28 00:07:40 +09:00
example74Type . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
example74Type . SetTotalItems ( 3 )
2018-05-28 00:07:40 +09:00
example74Type . AppendSummaryString ( "Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example74Type . SetCurrentIRI ( c )
2018-05-28 00:07:40 +09:00
example74Type . AppendItemsIRI ( i1 )
example74Type . AppendItemsIRI ( i2 )
example74Type . AppendItemsIRI ( i3 )
2018-01-24 08:00:59 +09:00
}
const example75 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's blog posts" ,
"type" : "Collection" ,
"totalItems" : 3 ,
"current" : {
"type" : "Link" ,
"summary" : "Most Recent Items" ,
"href" : "http://example.org/collection"
} ,
"items" : [
"http://example.org/posts/1" ,
"http://example.org/posts/2" ,
"http://example.org/posts/3"
]
} `
var example75Type = & Collection { }
func init ( ) {
i1 := MustParseURL ( "http://example.org/posts/1" )
i2 := MustParseURL ( "http://example.org/posts/2" )
i3 := MustParseURL ( "http://example.org/posts/3" )
href := MustParseURL ( "http://example.org/collection" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
link . AppendSummaryString ( "Most Recent Items" )
2018-01-24 08:00:59 +09:00
link . SetHref ( href )
2018-05-28 00:07:40 +09:00
example75Type . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
example75Type . SetTotalItems ( 3 )
2018-05-28 00:07:40 +09:00
example75Type . AppendSummaryString ( "Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example75Type . SetCurrentLink ( link )
2018-05-28 00:07:40 +09:00
example75Type . AppendItemsIRI ( i1 )
example75Type . AppendItemsIRI ( i2 )
example75Type . AppendItemsIRI ( i3 )
2018-01-24 08:00:59 +09:00
}
const example76 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's blog posts" ,
"type" : "Collection" ,
"totalItems" : 3 ,
"first" : "http://example.org/collection?page=0"
} `
var example76Type = & Collection { }
func init ( ) {
f := MustParseURL ( "http://example.org/collection?page=0" )
2018-05-28 00:07:40 +09:00
example76Type . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
example76Type . SetTotalItems ( 3 )
2018-05-28 00:07:40 +09:00
example76Type . AppendSummaryString ( "Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example76Type . SetFirstIRI ( f )
}
const example77 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's blog posts" ,
"type" : "Collection" ,
"totalItems" : 3 ,
"first" : {
"type" : "Link" ,
"summary" : "First Page" ,
"href" : "http://example.org/collection?page=0"
}
} `
var example77Type = & Collection { }
func init ( ) {
href := MustParseURL ( "http://example.org/collection?page=0" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
link . AppendSummaryString ( "First Page" )
2018-01-24 08:00:59 +09:00
link . SetHref ( href )
2018-05-28 00:07:40 +09:00
example77Type . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
example77Type . SetTotalItems ( 3 )
2018-05-28 00:07:40 +09:00
example77Type . AppendSummaryString ( "Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example77Type . SetFirstLink ( link )
}
const example78 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "This is all there is." ,
"generator" : {
"type" : "Application" ,
"name" : "Exampletron 3000"
}
} `
var example78Type = & Note { }
func init ( ) {
app := & Application { }
2018-05-28 00:07:40 +09:00
app . AppendType ( "Application" )
app . AppendNameString ( "Exampletron 3000" )
example78Type . AppendType ( "Note" )
example78Type . AppendSummaryString ( "A simple note" )
example78Type . AppendContentString ( "This is all there is." )
example78Type . AppendGeneratorObject ( app )
2018-01-24 08:00:59 +09:00
}
const example79 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "This is all there is." ,
"icon" : {
"type" : "Image" ,
"name" : "Note icon" ,
"url" : "http://example.org/note.png" ,
"width" : 16 ,
"height" : 16
}
} `
var example79Type = & Note { }
func init ( ) {
u := MustParseURL ( "http://example.org/note.png" )
image := & Image { }
2018-05-28 00:07:40 +09:00
image . AppendType ( "Image" )
image . AppendNameString ( "Note icon" )
image . AppendUrlAnyURI ( u )
2018-01-24 08:00:59 +09:00
image . SetWidth ( 16 )
image . SetHeight ( 16 )
2018-05-28 00:07:40 +09:00
example79Type . AppendType ( "Note" )
example79Type . AppendSummaryString ( "A simple note" )
example79Type . AppendContentString ( "This is all there is." )
example79Type . AppendIconImage ( image )
2018-01-24 08:00:59 +09:00
}
const example80 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "A simple note" ,
"icon" : [
{
"type" : "Image" ,
"summary" : "Note (16x16)" ,
"url" : "http://example.org/note1.png" ,
"width" : 16 ,
"height" : 16
} ,
{
"type" : "Image" ,
"summary" : "Note (32x32)" ,
"url" : "http://example.org/note2.png" ,
"width" : 32 ,
"height" : 32
}
]
} `
var example80Type = & Note { }
func init ( ) {
u1 := MustParseURL ( "http://example.org/note1.png" )
u2 := MustParseURL ( "http://example.org/note2.png" )
image1 := & Image { }
2018-05-28 00:07:40 +09:00
image1 . AppendType ( "Image" )
image1 . AppendSummaryString ( "Note (16x16)" )
image1 . AppendUrlAnyURI ( u1 )
2018-01-24 08:00:59 +09:00
image1 . SetWidth ( 16 )
image1 . SetHeight ( 16 )
image2 := & Image { }
2018-05-28 00:07:40 +09:00
image2 . AppendType ( "Image" )
image2 . AppendSummaryString ( "Note (32x32)" )
image2 . AppendUrlAnyURI ( u2 )
2018-01-24 08:00:59 +09:00
image2 . SetWidth ( 32 )
image2 . SetHeight ( 32 )
2018-05-28 00:07:40 +09:00
example80Type . AppendType ( "Note" )
example80Type . AppendSummaryString ( "A simple note" )
example80Type . AppendContentString ( "A simple note" )
example80Type . AppendIconImage ( image1 )
example80Type . AppendIconImage ( image2 )
2018-01-24 08:00:59 +09:00
}
const example81 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "A simple note" ,
"type" : "Note" ,
"content" : "This is all there is." ,
"image" : {
"type" : "Image" ,
"name" : "A Cat" ,
"url" : "http://example.org/cat.png"
}
} `
var example81Type = & Note { }
func init ( ) {
u := MustParseURL ( "http://example.org/cat.png" )
image := & Image { }
2018-05-28 00:07:40 +09:00
image . AppendType ( "Image" )
image . AppendNameString ( "A Cat" )
image . AppendUrlAnyURI ( u )
example81Type . AppendType ( "Note" )
example81Type . AppendNameString ( "A simple note" )
example81Type . AppendContentString ( "This is all there is." )
example81Type . AppendImageImage ( image )
2018-01-24 08:00:59 +09:00
}
const example82 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "A simple note" ,
"type" : "Note" ,
"content" : "This is all there is." ,
"image" : [
{
"type" : "Image" ,
"name" : "Cat 1" ,
"url" : "http://example.org/cat1.png"
} ,
{
"type" : "Image" ,
"name" : "Cat 2" ,
"url" : "http://example.org/cat2.png"
}
]
} `
var example82Type = & Note { }
func init ( ) {
u1 := MustParseURL ( "http://example.org/cat1.png" )
u2 := MustParseURL ( "http://example.org/cat2.png" )
image1 := & Image { }
2018-05-28 00:07:40 +09:00
image1 . AppendType ( "Image" )
image1 . AppendNameString ( "Cat 1" )
image1 . AppendUrlAnyURI ( u1 )
2018-01-24 08:00:59 +09:00
image2 := & Image { }
2018-05-28 00:07:40 +09:00
image2 . AppendType ( "Image" )
image2 . AppendNameString ( "Cat 2" )
image2 . AppendUrlAnyURI ( u2 )
example82Type . AppendType ( "Note" )
example82Type . AppendNameString ( "A simple note" )
example82Type . AppendContentString ( "This is all there is." )
example82Type . AppendImageImage ( image1 )
example82Type . AppendImageImage ( image2 )
2018-01-24 08:00:59 +09:00
}
const example83 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "This is all there is." ,
"inReplyTo" : {
"summary" : "Previous note" ,
"type" : "Note" ,
"content" : "What else is there?"
}
} `
var example83Type = & Note { }
func init ( ) {
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendSummaryString ( "Previous note" )
note . AppendContentString ( "What else is there?" )
example83Type . AppendType ( "Note" )
example83Type . AppendSummaryString ( "A simple note" )
example83Type . AppendContentString ( "This is all there is." )
example83Type . AppendInReplyToObject ( note )
2018-01-24 08:00:59 +09:00
}
const example84 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "This is all there is." ,
"inReplyTo" : "http://example.org/posts/1"
} `
var example84Type = & Note { }
func init ( ) {
u := MustParseURL ( "http://example.org/posts/1" )
2018-05-28 00:07:40 +09:00
example84Type . AppendType ( "Note" )
example84Type . AppendSummaryString ( "A simple note" )
example84Type . AppendContentString ( "This is all there is." )
example84Type . AppendInReplyToIRI ( u )
2018-01-24 08:00:59 +09:00
}
const example85 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally listened to a piece of music on the Acme Music Service" ,
"type" : "Listen" ,
"actor" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"object" : "http://example.org/foo.mp3" ,
"instrument" : {
"type" : "Service" ,
"name" : "Acme Music Service"
}
} `
var example85Type = & Listen { }
func init ( ) {
u := MustParseURL ( "http://example.org/foo.mp3" )
actor := & Person { }
2018-05-28 00:07:40 +09:00
actor . AppendType ( "Person" )
actor . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
service := & Service { }
2018-05-28 00:07:40 +09:00
service . AppendType ( "Service" )
service . AppendNameString ( "Acme Music Service" )
example85Type . AppendType ( "Listen" )
example85Type . AppendSummaryString ( "Sally listened to a piece of music on the Acme Music Service" )
example85Type . AppendActorObject ( actor )
example85Type . AppendObjectIRI ( u )
example85Type . AppendInstrumentObject ( service )
2018-01-24 08:00:59 +09:00
}
const example86 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A collection" ,
"type" : "Collection" ,
"totalItems" : 3 ,
"last" : "http://example.org/collection?page=1"
} `
var example86Type = & Collection { }
func init ( ) {
u := MustParseURL ( "http://example.org/collection?page=1" )
2018-05-28 00:07:40 +09:00
example86Type . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
example86Type . SetTotalItems ( 3 )
2018-05-28 00:07:40 +09:00
example86Type . AppendSummaryString ( "A collection" )
2018-01-24 08:00:59 +09:00
example86Type . SetLastIRI ( u )
}
const example87 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A collection" ,
"type" : "Collection" ,
"totalItems" : 5 ,
"last" : {
"type" : "Link" ,
"summary" : "Last Page" ,
"href" : "http://example.org/collection?page=1"
}
} `
var example87Type = & Collection { }
func init ( ) {
u := MustParseURL ( "http://example.org/collection?page=1" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
link . AppendSummaryString ( "Last Page" )
2018-01-24 08:00:59 +09:00
link . SetHref ( u )
2018-05-28 00:07:40 +09:00
example87Type . AppendType ( "Collection" )
example87Type . AppendSummaryString ( "A collection" )
2018-01-24 08:00:59 +09:00
example87Type . SetTotalItems ( 5 )
example87Type . SetLastLink ( link )
}
const example88 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Person" ,
"name" : "Sally" ,
"location" : {
"name" : "Over the Arabian Sea, east of Socotra Island Nature Sanctuary" ,
"type" : "Place" ,
"longitude" : 12.34 ,
"latitude" : 56.78 ,
"altitude" : 90 ,
"units" : "m"
}
} `
var example88Type = & Person { }
func init ( ) {
place := & Place { }
2018-05-28 00:07:40 +09:00
place . AppendType ( "Place" )
place . AppendNameString ( "Over the Arabian Sea, east of Socotra Island Nature Sanctuary" )
2018-01-24 08:00:59 +09:00
place . SetLongitude ( 12.34 )
place . SetLatitude ( 56.78 )
place . SetAltitude ( 90 )
place . SetUnitsUnitsValue ( "m" )
2018-05-28 00:07:40 +09:00
example88Type . AppendType ( "Person" )
example88Type . AppendNameString ( "Sally" )
example88Type . AppendLocationObject ( place )
2018-01-24 08:00:59 +09:00
}
const example89 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's notes" ,
"type" : "Collection" ,
"totalItems" : 2 ,
"items" : [
{
"type" : "Note" ,
"name" : "Reminder for Going-Away Party"
} ,
{
"type" : "Note" ,
"name" : "Meeting 2016-11-17"
}
]
} `
var example89Type = & Collection { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Reminder for Going-Away Party" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Meeting 2016-11-17" )
example89Type . AppendType ( "Collection" )
example89Type . AppendSummaryString ( "Sally's notes" )
2018-01-24 08:00:59 +09:00
example89Type . SetTotalItems ( 2 )
2018-05-28 00:07:40 +09:00
example89Type . AppendItemsObject ( note1 )
example89Type . AppendItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example90 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's notes" ,
"type" : "OrderedCollection" ,
"totalItems" : 2 ,
"orderedItems" : [
{
"type" : "Note" ,
"name" : "Meeting 2016-11-17"
} ,
{
"type" : "Note" ,
"name" : "Reminder for Going-Away Party"
}
]
} `
var example90Type = & OrderedCollection { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Meeting 2016-11-17" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Reminder for Going-Away Party" )
example90Type . AppendType ( "OrderedCollection" )
example90Type . AppendSummaryString ( "Sally's notes" )
2018-01-24 08:00:59 +09:00
example90Type . SetTotalItems ( 2 )
2018-05-28 00:07:40 +09:00
example90Type . AppendOrderedItemsObject ( note1 )
example90Type . AppendOrderedItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example91 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Question" ,
"name" : "What is the answer?" ,
"oneOf" : [
{
"type" : "Note" ,
"name" : "Option A"
} ,
{
"type" : "Note" ,
"name" : "Option B"
}
]
} `
var example91Type = & Question { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Option A" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Option B" )
example91Type . AppendType ( "Question" )
example91Type . AppendNameString ( "What is the answer?" )
example91Type . AppendOneOfObject ( note1 )
example91Type . AppendOneOfObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example92 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Question" ,
"name" : "What is the answer?" ,
"anyOf" : [
{
"type" : "Note" ,
"name" : "Option A"
} ,
{
"type" : "Note" ,
"name" : "Option B"
}
]
} `
var example92Type = & Question { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Option A" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Option B" )
example92Type . AppendType ( "Question" )
example92Type . AppendNameString ( "What is the answer?" )
example92Type . AppendAnyOfObject ( note1 )
example92Type . AppendAnyOfObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example93 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Question" ,
"name" : "What is the answer?" ,
"closed" : "2016-05-10T00:00:00Z"
} `
var example93Type = & Question { }
func init ( ) {
t , err := time . Parse ( time . RFC3339 , "2016-05-10T00:00:00Z" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example93Type . AppendType ( "Question" )
example93Type . AppendNameString ( "What is the answer?" )
example93Type . AppendClosedDateTime ( t )
2018-01-24 08:00:59 +09:00
}
const example94 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally moved a post from List A to List B" ,
"type" : "Move" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : {
"type" : "Collection" ,
"name" : "List B"
} ,
"origin" : {
"type" : "Collection" ,
"name" : "List A"
}
} `
var example94Type = & Move { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/posts/1" )
target := & Collection { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Collection" )
target . AppendNameString ( "List B" )
2018-01-24 08:00:59 +09:00
origin := & Collection { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Collection" )
origin . AppendNameString ( "List A" )
example94Type . AppendType ( "Move" )
example94Type . AppendSummaryString ( "Sally moved a post from List A to List B" )
example94Type . AppendActorIRI ( a )
example94Type . AppendObjectIRI ( o )
example94Type . AppendTargetObject ( target )
example94Type . AppendOriginObject ( origin )
2018-01-24 08:00:59 +09:00
}
const example95 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 2 of Sally's blog posts" ,
"type" : "CollectionPage" ,
"next" : "http://example.org/collection?page=2" ,
"items" : [
"http://example.org/posts/1" ,
"http://example.org/posts/2" ,
"http://example.org/posts/3"
]
} `
var example95Type = & CollectionPage { }
func init ( ) {
i := MustParseURL ( "http://example.org/collection?page=2" )
u1 := MustParseURL ( "http://example.org/posts/1" )
u2 := MustParseURL ( "http://example.org/posts/2" )
u3 := MustParseURL ( "http://example.org/posts/3" )
2018-05-28 00:07:40 +09:00
example95Type . AppendType ( "CollectionPage" )
example95Type . AppendSummaryString ( "Page 2 of Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example95Type . SetNextIRI ( i )
2018-05-28 00:07:40 +09:00
example95Type . AppendItemsIRI ( u1 )
example95Type . AppendItemsIRI ( u2 )
example95Type . AppendItemsIRI ( u3 )
2018-01-24 08:00:59 +09:00
}
const example96 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 2 of Sally's blog posts" ,
"type" : "CollectionPage" ,
"next" : {
"type" : "Link" ,
"name" : "Next Page" ,
"href" : "http://example.org/collection?page=2"
} ,
"items" : [
"http://example.org/posts/1" ,
"http://example.org/posts/2" ,
"http://example.org/posts/3"
]
} `
var example96Type = & CollectionPage { }
func init ( ) {
href := MustParseURL ( "http://example.org/collection?page=2" )
u1 := MustParseURL ( "http://example.org/posts/1" )
u2 := MustParseURL ( "http://example.org/posts/2" )
u3 := MustParseURL ( "http://example.org/posts/3" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
link . AppendNameString ( "Next Page" )
2018-01-24 08:00:59 +09:00
link . SetHref ( href )
2018-05-28 00:07:40 +09:00
example96Type . AppendType ( "CollectionPage" )
example96Type . AppendSummaryString ( "Page 2 of Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example96Type . SetNextLink ( link )
2018-05-28 00:07:40 +09:00
example96Type . AppendItemsIRI ( u1 )
example96Type . AppendItemsIRI ( u2 )
example96Type . AppendItemsIRI ( u3 )
2018-01-24 08:00:59 +09:00
}
const example97 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally liked a post" ,
"type" : "Like" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1"
} `
var example97Type = & Like { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/posts/1" )
2018-05-28 00:07:40 +09:00
example97Type . AppendType ( "Like" )
example97Type . AppendSummaryString ( "Sally liked a post" )
example97Type . AppendActorIRI ( a )
example97Type . AppendObjectIRI ( o )
2018-01-24 08:00:59 +09:00
}
const example98 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Like" ,
"actor" : "http://sally.example.org" ,
"object" : {
"type" : "Note" ,
"content" : "A simple note"
}
} `
var example98Type = & Like { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendContentString ( "A simple note" )
example98Type . AppendType ( "Like" )
example98Type . AppendActorIRI ( a )
example98Type . AppendObject ( note )
2018-01-24 08:00:59 +09:00
}
const example99 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally liked a note" ,
"type" : "Like" ,
"actor" : "http://sally.example.org" ,
"object" : [
"http://example.org/posts/1" ,
{
"type" : "Note" ,
"summary" : "A simple note" ,
"content" : "That is a tree."
}
]
} `
var example99Type = & Like { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/posts/1" )
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendSummaryString ( "A simple note" )
note . AppendContentString ( "That is a tree." )
example99Type . AppendType ( "Like" )
example99Type . AppendSummaryString ( "Sally liked a note" )
example99Type . AppendActorIRI ( a )
example99Type . AppendObjectIRI ( o )
example99Type . AppendObject ( note )
2018-01-24 08:00:59 +09:00
}
const example100 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 1 of Sally's blog posts" ,
"type" : "CollectionPage" ,
"prev" : "http://example.org/collection?page=1" ,
"items" : [
"http://example.org/posts/1" ,
"http://example.org/posts/2" ,
"http://example.org/posts/3"
]
} `
var example100Type = & CollectionPage { }
func init ( ) {
p := MustParseURL ( "http://example.org/collection?page=1" )
u1 := MustParseURL ( "http://example.org/posts/1" )
u2 := MustParseURL ( "http://example.org/posts/2" )
u3 := MustParseURL ( "http://example.org/posts/3" )
2018-05-28 00:07:40 +09:00
example100Type . AppendType ( "CollectionPage" )
example100Type . AppendSummaryString ( "Page 1 of Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example100Type . SetPrevIRI ( p )
2018-05-28 00:07:40 +09:00
example100Type . AppendItemsIRI ( u1 )
example100Type . AppendItemsIRI ( u2 )
example100Type . AppendItemsIRI ( u3 )
2018-01-24 08:00:59 +09:00
}
const example101 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 1 of Sally's blog posts" ,
"type" : "CollectionPage" ,
"prev" : {
"type" : "Link" ,
"name" : "Previous Page" ,
"href" : "http://example.org/collection?page=1"
} ,
"items" : [
"http://example.org/posts/1" ,
"http://example.org/posts/2" ,
"http://example.org/posts/3"
]
} `
var example101Type = & CollectionPage { }
func init ( ) {
p := MustParseURL ( "http://example.org/collection?page=1" )
u1 := MustParseURL ( "http://example.org/posts/1" )
u2 := MustParseURL ( "http://example.org/posts/2" )
u3 := MustParseURL ( "http://example.org/posts/3" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
link . AppendNameString ( "Previous Page" )
2018-01-24 08:00:59 +09:00
link . SetHref ( p )
2018-05-28 00:07:40 +09:00
example101Type . AppendType ( "CollectionPage" )
example101Type . AppendSummaryString ( "Page 1 of Sally's blog posts" )
2018-01-24 08:00:59 +09:00
example101Type . SetPrevLink ( link )
2018-05-28 00:07:40 +09:00
example101Type . AppendItemsIRI ( u1 )
example101Type . AppendItemsIRI ( u2 )
example101Type . AppendItemsIRI ( u3 )
2018-01-24 08:00:59 +09:00
}
// NOTE: The 'url' field has added the 'type' property
const example102 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Video" ,
"name" : "Cool New Movie" ,
"duration" : "PT2H30M" ,
"preview" : {
"type" : "Video" ,
"name" : "Trailer" ,
"duration" : "PT1M" ,
"url" : {
"type" : "Link" ,
"href" : "http://example.org/trailer.mkv" ,
"mediaType" : "video/mkv"
}
}
} `
var example102Type = & Video { }
func init ( ) {
u := MustParseURL ( "http://example.org/trailer.mkv" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link . SetMediaType ( "video/mkv" )
link . SetHref ( u )
video := & Video { }
2018-05-28 00:07:40 +09:00
video . AppendType ( "Video" )
video . AppendNameString ( "Trailer" )
2018-01-24 08:00:59 +09:00
video . SetDuration ( time . Minute )
2018-05-28 00:07:40 +09:00
video . AppendUrlLink ( link )
example102Type . AppendType ( "Video" )
example102Type . AppendNameString ( "Cool New Movie" )
2018-01-24 08:00:59 +09:00
example102Type . SetDuration ( time . Hour * 2 + time . Minute * 30 )
2018-05-28 00:07:40 +09:00
example102Type . AppendPreviewObject ( video )
2018-01-24 08:00:59 +09:00
}
const example103 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally checked that her flight was on time" ,
"type" : [ "Activity" , "http://www.verbs.example/Check" ] ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/flights/1" ,
"result" : {
"type" : "http://www.types.example/flightstatus" ,
"name" : "On Time"
}
} `
var example103Type = & Activity { }
func init ( ) {
o := MustParseURL ( "http://example.org/flights/1" )
a := MustParseURL ( "http://sally.example.org" )
status := make ( map [ string ] interface { } )
status [ "type" ] = "http://www.types.example/flightstatus"
status [ "name" ] = "On Time"
2018-05-28 00:07:40 +09:00
example103Type . AppendType ( "Activity" )
example103Type . AppendType ( "http://www.verbs.example/Check" )
example103Type . AppendSummaryString ( "Sally checked that her flight was on time" )
example103Type . AppendActorIRI ( a )
example103Type . AppendObjectIRI ( o )
2018-01-24 08:00:59 +09:00
example103Type . AddUnknown ( "result" , status )
}
// NOTE: Changed to not be an array value for "items" to keep in line with other examples in spec!
const example104 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"id" : "http://www.test.example/notes/1" ,
"content" : "I am fine." ,
"replies" : {
"type" : "Collection" ,
"totalItems" : 1 ,
"items" : {
"summary" : "A response to the note" ,
"type" : "Note" ,
"content" : "I am glad to hear it." ,
"inReplyTo" : "http://www.test.example/notes/1"
}
}
} `
var example104Type = & Note { }
func init ( ) {
i := MustParseURL ( "http://www.test.example/notes/1" )
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendSummaryString ( "A response to the note" )
note . AppendContentString ( "I am glad to hear it." )
note . AppendInReplyToIRI ( i )
2018-01-24 08:00:59 +09:00
replies := & Collection { }
2018-05-28 00:07:40 +09:00
replies . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
replies . SetTotalItems ( 1 )
2018-05-28 00:07:40 +09:00
replies . AppendItemsObject ( note )
example104Type . AppendType ( "Note" )
example104Type . AppendSummaryString ( "A simple note" )
2018-01-24 08:00:59 +09:00
example104Type . SetId ( MustParseURL ( "http://www.test.example/notes/1" ) )
2018-05-28 00:07:40 +09:00
example104Type . AppendContentString ( "I am fine." )
2018-01-24 08:00:59 +09:00
example104Type . SetReplies ( replies )
}
// NOTE: Changed to not be an array value for "tag" to keep in line with other examples in spec!
const example105 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Image" ,
"summary" : "Picture of Sally" ,
"url" : "http://example.org/sally.jpg" ,
"tag" : {
"type" : "Person" ,
"id" : "http://sally.example.org" ,
"name" : "Sally"
}
} `
var example105Type = & Image { }
func init ( ) {
u := MustParseURL ( "http://example.org/sally.jpg" )
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
2018-01-24 08:00:59 +09:00
person . SetId ( MustParseURL ( "http://sally.example.org" ) )
2018-05-28 00:07:40 +09:00
person . AppendNameString ( "Sally" )
example105Type . AppendType ( "Image" )
example105Type . AppendSummaryString ( "Picture of Sally" )
example105Type . AppendUrlAnyURI ( u )
example105Type . AppendTagObject ( person )
2018-01-24 08:00:59 +09:00
}
const example106 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered the post to John" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org"
} `
var example106Type = & Offer { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/posts/1" )
t := MustParseURL ( "http://john.example.org" )
2018-05-28 00:07:40 +09:00
example106Type . AppendType ( "Offer" )
example106Type . AppendSummaryString ( "Sally offered the post to John" )
example106Type . AppendActorIRI ( a )
example106Type . AppendObjectIRI ( o )
example106Type . AppendTargetIRI ( t )
2018-01-24 08:00:59 +09:00
}
const example107 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered the post to John" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : {
"type" : "Person" ,
"name" : "John"
}
} `
var example107Type = & Offer { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/posts/1" )
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "John" )
example107Type . AppendType ( "Offer" )
example107Type . AppendSummaryString ( "Sally offered the post to John" )
example107Type . AppendActorIRI ( a )
example107Type . AppendObjectIRI ( o )
example107Type . AppendTargetObject ( person )
2018-01-24 08:00:59 +09:00
}
// NOTE: Changed to not be an array value for "to" to keep in line with other examples in spec!
const example108 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally offered the post to John" ,
"type" : "Offer" ,
"actor" : "http://sally.example.org" ,
"object" : "http://example.org/posts/1" ,
"target" : "http://john.example.org" ,
"to" : "http://joe.example.org"
} `
var example108Type = & Offer { }
func init ( ) {
a := MustParseURL ( "http://sally.example.org" )
o := MustParseURL ( "http://example.org/posts/1" )
t := MustParseURL ( "http://john.example.org" )
z := MustParseURL ( "http://joe.example.org" )
2018-05-28 00:07:40 +09:00
example108Type . AppendType ( "Offer" )
example108Type . AppendSummaryString ( "Sally offered the post to John" )
example108Type . AppendActorIRI ( a )
example108Type . AppendObjectIRI ( o )
example108Type . AppendTargetIRI ( t )
example108Type . AppendToIRI ( z )
2018-01-24 08:00:59 +09:00
}
const example109 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Document" ,
"name" : "4Q Sales Forecast" ,
"url" : "http://example.org/4q-sales-forecast.pdf"
} `
var example109Type = & Document { }
func init ( ) {
u := MustParseURL ( "http://example.org/4q-sales-forecast.pdf" )
2018-05-28 00:07:40 +09:00
example109Type . AppendType ( "Document" )
example109Type . AppendNameString ( "4Q Sales Forecast" )
example109Type . AppendUrlAnyURI ( u )
2018-01-24 08:00:59 +09:00
}
const example110 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Document" ,
"name" : "4Q Sales Forecast" ,
"url" : {
"type" : "Link" ,
"href" : "http://example.org/4q-sales-forecast.pdf"
}
} `
var example110Type = & Document { }
func init ( ) {
u := MustParseURL ( "http://example.org/4q-sales-forecast.pdf" )
link := & Link { }
2018-05-28 00:07:40 +09:00
link . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link . SetHref ( u )
2018-05-28 00:07:40 +09:00
example110Type . AppendType ( "Document" )
example110Type . AppendNameString ( "4Q Sales Forecast" )
example110Type . AppendUrlLink ( link )
2018-01-24 08:00:59 +09:00
}
const example111 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Document" ,
"name" : "4Q Sales Forecast" ,
"url" : [
{
"type" : "Link" ,
"href" : "http://example.org/4q-sales-forecast.pdf" ,
"mediaType" : "application/pdf"
} ,
{
"type" : "Link" ,
"href" : "http://example.org/4q-sales-forecast.html" ,
"mediaType" : "text/html"
}
]
} `
var example111Type = & Document { }
func init ( ) {
u1 := MustParseURL ( "http://example.org/4q-sales-forecast.pdf" )
u2 := MustParseURL ( "http://example.org/4q-sales-forecast.html" )
link1 := & Link { }
2018-05-28 00:07:40 +09:00
link1 . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link1 . SetHref ( u1 )
link1 . SetMediaType ( "application/pdf" )
link2 := & Link { }
2018-05-28 00:07:40 +09:00
link2 . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
link2 . SetHref ( u2 )
link2 . SetMediaType ( "text/html" )
2018-05-28 00:07:40 +09:00
example111Type . AppendType ( "Document" )
example111Type . AppendNameString ( "4Q Sales Forecast" )
example111Type . AppendUrlLink ( link1 )
example111Type . AppendUrlLink ( link2 )
2018-01-24 08:00:59 +09:00
}
const example112 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "Liu Gu Lu Cun, Pingdu, Qingdao, Shandong, China" ,
"type" : "Place" ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"accuracy" : 94.5
} `
var example112Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example112Type . AppendType ( "Place" )
example112Type . AppendNameString ( "Liu Gu Lu Cun, Pingdu, Qingdao, Shandong, China" )
2018-01-24 08:00:59 +09:00
example112Type . SetLatitude ( 36.75 )
example112Type . SetLongitude ( 119.7667 )
example112Type . SetAccuracy ( 94.5 )
}
const example113 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Fresno Area" ,
"altitude" : 15.0 ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"units" : "miles"
} `
var example113Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example113Type . AppendType ( "Place" )
example113Type . AppendNameString ( "Fresno Area" )
2018-01-24 08:00:59 +09:00
example113Type . SetAltitude ( 15.0 )
example113Type . SetLatitude ( 36.75 )
example113Type . SetLongitude ( 119.7667 )
example113Type . SetUnitsUnitsValue ( "miles" )
}
const example114 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "A <em>simple</em> note"
} `
var example114Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example114Type . AppendType ( "Note" )
example114Type . AppendSummaryString ( "A simple note" )
example114Type . AppendContentString ( "A <em>simple</em> note" )
2018-01-24 08:00:59 +09:00
}
const example115 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"contentMap" : {
"en" : "A <em>simple</em> note" ,
"es" : "Una nota <em>sencilla</em>" ,
"zh-Hans" : "一段<em>简单的</em>笔记"
}
} `
var example115Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example115Type . AppendType ( "Note" )
example115Type . AppendSummaryString ( "A simple note" )
2018-01-24 08:00:59 +09:00
example115Type . SetContentMap ( "en" , "A <em>simple</em> note" )
example115Type . SetContentMap ( "es" , "Una nota <em>sencilla</em>" )
example115Type . SetContentMap ( "zh-Hans" , "一段<em>简单的</em>笔记" )
}
const example116 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"mediaType" : "text/markdown" ,
"content" : "## A simple note\nA simple markdown ` + " ` note ` " + `"
} `
var example116Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example116Type . AppendType ( "Note" )
example116Type . AppendSummaryString ( "A simple note" )
2018-01-24 08:00:59 +09:00
example116Type . SetMediaType ( "text/markdown" )
2018-05-28 00:07:40 +09:00
example116Type . AppendContentString ( "## A simple note\nA simple markdown `note`" )
2018-01-24 08:00:59 +09:00
}
const example117 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Note" ,
"name" : "A simple note"
} `
var example117Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example117Type . AppendType ( "Note" )
example117Type . AppendNameString ( "A simple note" )
2018-01-24 08:00:59 +09:00
}
const example118 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Note" ,
"nameMap" : {
"en" : "A simple note" ,
"es" : "Una nota sencilla" ,
"zh-Hans" : "一段简单的笔记"
}
} `
var example118Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example118Type . AppendType ( "Note" )
2018-01-24 08:00:59 +09:00
example118Type . SetNameMap ( "en" , "A simple note" )
example118Type . SetNameMap ( "es" , "Una nota sencilla" )
example118Type . SetNameMap ( "zh-Hans" , "一段简单的笔记" )
}
const example119 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Video" ,
"name" : "Birds Flying" ,
"url" : "http://example.org/video.mkv" ,
"duration" : "PT2H"
} `
var example119Type = & Video { }
func init ( ) {
u := MustParseURL ( "http://example.org/video.mkv" )
2018-05-28 00:07:40 +09:00
example119Type . AppendType ( "Video" )
example119Type . AppendNameString ( "Birds Flying" )
example119Type . AppendUrlAnyURI ( u )
2018-01-24 08:00:59 +09:00
example119Type . SetDuration ( time . Hour * 2 )
}
const example120 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/image.png" ,
"height" : 100 ,
"width" : 100
} `
var example120Type = & Link { }
func init ( ) {
u := MustParseURL ( "http://example.org/image.png" )
2018-05-28 00:07:40 +09:00
example120Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example120Type . SetHref ( u )
example120Type . SetHeight ( 100 )
example120Type . SetWidth ( 100 )
}
const example121 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/abc" ,
"mediaType" : "text/html" ,
"name" : "Previous"
} `
var example121Type = & Link { }
func init ( ) {
u := MustParseURL ( "http://example.org/abc" )
2018-05-28 00:07:40 +09:00
example121Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example121Type . SetHref ( u )
example121Type . SetMediaType ( "text/html" )
2018-05-28 00:07:40 +09:00
example121Type . AppendNameString ( "Previous" )
2018-01-24 08:00:59 +09:00
}
const example122 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/abc" ,
"hreflang" : "en" ,
"mediaType" : "text/html" ,
"name" : "Previous"
} `
var example122Type = & Link { }
func init ( ) {
u := MustParseURL ( "http://example.org/abc" )
2018-05-28 00:07:40 +09:00
example122Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example122Type . SetHref ( u )
example122Type . SetMediaType ( "text/html" )
2018-05-28 00:07:40 +09:00
example122Type . AppendNameString ( "Previous" )
2018-01-24 08:00:59 +09:00
example122Type . SetHreflang ( "en" )
}
const example123 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 1 of Sally's notes" ,
"type" : "CollectionPage" ,
"id" : "http://example.org/collection?page=1" ,
"partOf" : "http://example.org/collection" ,
"items" : [
{
"type" : "Note" ,
"name" : "Pizza Toppings to Try"
} ,
{
"type" : "Note" ,
"name" : "Thought about California"
}
]
} `
var example123Type = & CollectionPage { }
func init ( ) {
u := MustParseURL ( "http://example.org/collection" )
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Pizza Toppings to Try" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Thought about California" )
example123Type . AppendType ( "CollectionPage" )
example123Type . AppendSummaryString ( "Page 1 of Sally's notes" )
2018-01-24 08:00:59 +09:00
example123Type . SetId ( MustParseURL ( "http://example.org/collection?page=1" ) )
example123Type . SetPartOfIRI ( u )
2018-05-28 00:07:40 +09:00
example123Type . AppendItemsObject ( note1 )
example123Type . AppendItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example124 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Fresno Area" ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"radius" : 15 ,
"units" : "miles"
} `
var example124Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example124Type . AppendType ( "Place" )
example124Type . AppendNameString ( "Fresno Area" )
2018-01-24 08:00:59 +09:00
example124Type . SetLatitude ( 36.75 )
example124Type . SetLongitude ( 119.7667 )
example124Type . SetRadius ( 15 )
example124Type . SetUnitsUnitsValue ( "miles" )
}
const example125 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Fresno Area" ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"radius" : 15 ,
"units" : "miles"
} `
var example125Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example125Type . AppendType ( "Place" )
example125Type . AppendNameString ( "Fresno Area" )
2018-01-24 08:00:59 +09:00
example125Type . SetLatitude ( 36.75 )
example125Type . SetLongitude ( 119.7667 )
example125Type . SetRadius ( 15 )
example125Type . SetUnitsUnitsValue ( "miles" )
}
const example126 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/abc" ,
"hreflang" : "en" ,
"mediaType" : "text/html" ,
"name" : "Next"
} `
var example126Type = & Link { }
func init ( ) {
u := MustParseURL ( "http://example.org/abc" )
2018-05-28 00:07:40 +09:00
example126Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example126Type . SetHref ( u )
example126Type . SetHreflang ( "en" )
example126Type . SetMediaType ( "text/html" )
2018-05-28 00:07:40 +09:00
example126Type . AppendNameString ( "Next" )
2018-01-24 08:00:59 +09:00
}
const example127 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Event" ,
"name" : "Going-Away Party for Jim" ,
"startTime" : "2014-12-31T23:00:00-08:00" ,
"endTime" : "2015-01-01T06:00:00-08:00"
} `
var example127Type = & Event { }
func init ( ) {
t1 , err := time . Parse ( time . RFC3339 , "2014-12-31T23:00:00-08:00" )
if err != nil {
panic ( err )
}
t2 , err := time . Parse ( time . RFC3339 , "2015-01-01T06:00:00-08:00" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example127Type . AppendType ( "Event" )
example127Type . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
example127Type . SetStartTime ( t1 )
example127Type . SetEndTime ( t2 )
}
const example128 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "A simple note" ,
"type" : "Note" ,
"content" : "Fish swim." ,
"published" : "2014-12-12T12:12:12Z"
} `
var example128Type = & Note { }
func init ( ) {
t , err := time . Parse ( time . RFC3339 , "2014-12-12T12:12:12Z" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example128Type . AppendType ( "Note" )
example128Type . AppendSummaryString ( "A simple note" )
example128Type . AppendContentString ( "Fish swim." )
2018-01-24 08:00:59 +09:00
example128Type . SetPublished ( t )
}
const example129 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Event" ,
"name" : "Going-Away Party for Jim" ,
"startTime" : "2014-12-31T23:00:00-08:00" ,
"endTime" : "2015-01-01T06:00:00-08:00"
} `
var example129Type = & Event { }
func init ( ) {
t1 , err := time . Parse ( time . RFC3339 , "2014-12-31T23:00:00-08:00" )
if err != nil {
panic ( err )
}
t2 , err := time . Parse ( time . RFC3339 , "2015-01-01T06:00:00-08:00" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example129Type . AppendType ( "Event" )
example129Type . AppendNameString ( "Going-Away Party for Jim" )
2018-01-24 08:00:59 +09:00
example129Type . SetStartTime ( t1 )
example129Type . SetEndTime ( t2 )
}
const example130 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Fresno Area" ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"radius" : 15 ,
"units" : "miles"
} `
var example130Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example130Type . AppendType ( "Place" )
example130Type . AppendNameString ( "Fresno Area" )
2018-01-24 08:00:59 +09:00
example130Type . SetLatitude ( 36.75 )
example130Type . SetLongitude ( 119.7667 )
example130Type . SetRadius ( 15 )
example130Type . SetUnitsUnitsValue ( "miles" )
}
const example131 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/abc" ,
"hreflang" : "en" ,
"mediaType" : "text/html" ,
"name" : "Preview" ,
"rel" : [ "canonical" , "preview" ]
} `
var example131Type = & Link { }
func init ( ) {
u := MustParseURL ( "http://example.org/abc" )
2018-05-28 00:07:40 +09:00
example131Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example131Type . SetHref ( u )
example131Type . SetHreflang ( "en" )
example131Type . SetMediaType ( "text/html" )
2018-05-28 00:07:40 +09:00
example131Type . AppendNameString ( "Preview" )
example131Type . AppendRel ( "canonical" )
example131Type . AppendRel ( "preview" )
2018-01-24 08:00:59 +09:00
}
const example132 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Page 1 of Sally's notes" ,
"type" : "OrderedCollectionPage" ,
"startIndex" : 0 ,
"orderedItems" : [
{
"type" : "Note" ,
"name" : "Density of Water"
} ,
{
"type" : "Note" ,
"name" : "Air Mattress Idea"
}
]
} `
var example132Type = & OrderedCollectionPage { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Density of Water" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Air Mattress Idea" )
example132Type . AppendType ( "OrderedCollectionPage" )
example132Type . AppendSummaryString ( "Page 1 of Sally's notes" )
2018-01-24 08:00:59 +09:00
example132Type . SetStartIndex ( 0 )
2018-05-28 00:07:40 +09:00
example132Type . AppendOrderedItemsObject ( note1 )
example132Type . AppendOrderedItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example133 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "Cane Sugar Processing" ,
"type" : "Note" ,
"summary" : "A simple <em>note</em>"
} `
var example133Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example133Type . AppendType ( "Note" )
example133Type . AppendNameString ( "Cane Sugar Processing" )
example133Type . AppendSummaryString ( "A simple <em>note</em>" )
2018-01-24 08:00:59 +09:00
}
const example134 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "Cane Sugar Processing" ,
"type" : "Note" ,
"summaryMap" : {
"en" : "A simple <em>note</em>" ,
"es" : "Una <em>nota</em> sencilla" ,
"zh-Hans" : "一段<em>简单的</em>笔记"
}
} `
var example134Type = & Note { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example134Type . AppendType ( "Note" )
example134Type . AppendNameString ( "Cane Sugar Processing" )
2018-01-24 08:00:59 +09:00
example134Type . SetSummaryMap ( "en" , "A simple <em>note</em>" )
example134Type . SetSummaryMap ( "es" , "Una <em>nota</em> sencilla" )
example134Type . SetSummaryMap ( "zh-Hans" , "一段<em>简单的</em>笔记" )
}
const example135 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's notes" ,
"type" : "Collection" ,
"totalItems" : 2 ,
"items" : [
{
"type" : "Note" ,
"name" : "Which Staircase Should I Use"
} ,
{
"type" : "Note" ,
"name" : "Something to Remember"
}
]
} `
var example135Type = & Collection { }
func init ( ) {
note1 := & Note { }
2018-05-28 00:07:40 +09:00
note1 . AppendType ( "Note" )
note1 . AppendNameString ( "Which Staircase Should I Use" )
2018-01-24 08:00:59 +09:00
note2 := & Note { }
2018-05-28 00:07:40 +09:00
note2 . AppendType ( "Note" )
note2 . AppendNameString ( "Something to Remember" )
example135Type . AppendType ( "Collection" )
example135Type . AppendSummaryString ( "Sally's notes" )
2018-01-24 08:00:59 +09:00
example135Type . SetTotalItems ( 2 )
2018-05-28 00:07:40 +09:00
example135Type . AppendItemsObject ( note1 )
example135Type . AppendItemsObject ( note2 )
2018-01-24 08:00:59 +09:00
}
const example136 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "Fresno Area" ,
"latitude" : 36.75 ,
"longitude" : 119.7667 ,
"radius" : 15 ,
"units" : "miles"
} `
var example136Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example136Type . AppendType ( "Place" )
example136Type . AppendNameString ( "Fresno Area" )
2018-01-24 08:00:59 +09:00
example136Type . SetLatitude ( 36.75 )
example136Type . SetLongitude ( 119.7667 )
example136Type . SetRadius ( 15 )
example136Type . SetUnitsUnitsValue ( "miles" )
}
const example137 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "Cranberry Sauce Idea" ,
"type" : "Note" ,
"content" : "Mush it up so it does not have the same shape as the can." ,
"updated" : "2014-12-12T12:12:12Z"
} `
var example137Type = & Note { }
func init ( ) {
t , err := time . Parse ( time . RFC3339 , "2014-12-12T12:12:12Z" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example137Type . AppendType ( "Note" )
example137Type . AppendNameString ( "Cranberry Sauce Idea" )
example137Type . AppendContentString ( "Mush it up so it does not have the same shape as the can." )
2018-01-24 08:00:59 +09:00
example137Type . SetUpdated ( t )
}
const example138 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Link" ,
"href" : "http://example.org/image.png" ,
"height" : 100 ,
"width" : 100
} `
var example138Type = & Link { }
func init ( ) {
u := MustParseURL ( "http://example.org/image.png" )
2018-05-28 00:07:40 +09:00
example138Type . AppendType ( "Link" )
2018-01-24 08:00:59 +09:00
example138Type . SetHref ( u )
example138Type . SetHeight ( 100 )
example138Type . SetWidth ( 100 )
}
const example139 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally is an acquaintance of John's" ,
"type" : "Relationship" ,
"subject" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"relationship" : "http://purl.org/vocab/relationship/acquaintanceOf" ,
"object" : {
"type" : "Person" ,
"name" : "John"
}
} `
var example139Type = & Relationship { }
func init ( ) {
u := MustParseURL ( "http://purl.org/vocab/relationship/acquaintanceOf" )
subject := & Person { }
2018-05-28 00:07:40 +09:00
subject . AppendType ( "Person" )
subject . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Person { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Person" )
object . AppendNameString ( "John" )
example139Type . AppendType ( "Relationship" )
example139Type . AppendSummaryString ( "Sally is an acquaintance of John's" )
2018-01-24 08:00:59 +09:00
example139Type . SetSubjectObject ( subject )
2018-05-28 00:07:40 +09:00
example139Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
example139Type . SetRelationshipIRI ( u )
}
const example140 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally is an acquaintance of John's" ,
"type" : "Relationship" ,
"subject" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"relationship" : "http://purl.org/vocab/relationship/acquaintanceOf" ,
"object" : {
"type" : "Person" ,
"name" : "John"
}
} `
var example140Type = & Relationship { }
func init ( ) {
u := MustParseURL ( "http://purl.org/vocab/relationship/acquaintanceOf" )
subject := & Person { }
2018-05-28 00:07:40 +09:00
subject . AppendType ( "Person" )
subject . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
object := & Person { }
2018-05-28 00:07:40 +09:00
object . AppendType ( "Person" )
object . AppendNameString ( "John" )
example140Type . AppendType ( "Relationship" )
example140Type . AppendSummaryString ( "Sally is an acquaintance of John's" )
2018-01-24 08:00:59 +09:00
example140Type . SetSubjectObject ( subject )
2018-05-28 00:07:40 +09:00
example140Type . AppendObject ( object )
2018-01-24 08:00:59 +09:00
example140Type . SetRelationshipIRI ( u )
}
const example141 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's profile" ,
"type" : "Profile" ,
"describes" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"url" : "http://sally.example.org"
} `
var example141Type = & Profile { }
func init ( ) {
u := MustParseURL ( "http://sally.example.org" )
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
example141Type . AppendType ( "Profile" )
example141Type . AppendSummaryString ( "Sally's profile" )
example141Type . AppendUrlAnyURI ( u )
2018-01-24 08:00:59 +09:00
example141Type . SetDescribes ( person )
}
const example142 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "This image has been deleted" ,
"type" : "Tombstone" ,
"formerType" : "Image" ,
"url" : "http://example.org/image/2"
} `
var example142Type = & Tombstone { }
func init ( ) {
u := MustParseURL ( "http://example.org/image/2" )
2018-05-28 00:07:40 +09:00
example142Type . AppendType ( "Tombstone" )
example142Type . AppendSummaryString ( "This image has been deleted" )
example142Type . AppendFormerTypeString ( "Image" )
example142Type . AppendUrlAnyURI ( u )
2018-01-24 08:00:59 +09:00
}
const example143 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "This image has been deleted" ,
"type" : "Tombstone" ,
"deleted" : "2016-05-03T00:00:00Z"
} `
var example143Type = & Tombstone { }
func init ( ) {
t , err := time . Parse ( time . RFC3339 , "2016-05-03T00:00:00Z" )
if err != nil {
panic ( err )
}
2018-05-28 00:07:40 +09:00
example143Type . AppendType ( "Tombstone" )
example143Type . AppendSummaryString ( "This image has been deleted" )
2018-01-24 08:00:59 +09:00
example143Type . SetDeleted ( t )
}
const example144 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Activities in Project XYZ" ,
"type" : "Collection" ,
"items" : [
{
"summary" : "Sally created a note" ,
"type" : "Create" ,
"id" : "http://activities.example.com/1" ,
"actor" : "http://sally.example.org" ,
"object" : {
"summary" : "A note" ,
"type" : "Note" ,
"id" : "http://notes.example.com/1" ,
"content" : "A note"
} ,
"context" : {
"type" : "http://example.org/Project" ,
"name" : "Project XYZ"
} ,
"audience" : {
"type" : "Group" ,
"name" : "Project XYZ Working Group"
} ,
"to" : "http://john.example.org"
} ,
{
"summary" : "John liked Sally's note" ,
"type" : "Like" ,
"id" : "http://activities.example.com/1" ,
"actor" : "http://john.example.org" ,
"object" : "http://notes.example.com/1" ,
"context" : {
"type" : "http://example.org/Project" ,
"name" : "Project XYZ"
} ,
"audience" : {
"type" : "Group" ,
"name" : "Project XYZ Working Group"
} ,
"to" : "http://sally.example.org"
}
]
} `
var example144Type = & Collection { }
func init ( ) {
sally := MustParseURL ( "http://sally.example.org" )
john := MustParseURL ( "http://john.example.org" )
o := MustParseURL ( "http://notes.example.com/1" )
context := make ( map [ string ] interface { } )
context [ "type" ] = "http://example.org/Project"
context [ "name" ] = "Project XYZ"
audience := & Group { }
2018-05-28 00:07:40 +09:00
audience . AppendType ( "Group" )
audience . AppendNameString ( "Project XYZ Working Group" )
2018-01-24 08:00:59 +09:00
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendSummaryString ( "A note" )
2018-01-24 08:00:59 +09:00
note . SetId ( MustParseURL ( "http://notes.example.com/1" ) )
2018-05-28 00:07:40 +09:00
note . AppendContentString ( "A note" )
2018-01-24 08:00:59 +09:00
create := & Create { }
2018-05-28 00:07:40 +09:00
create . AppendType ( "Create" )
create . AppendSummaryString ( "Sally created a note" )
2018-01-24 08:00:59 +09:00
create . SetId ( MustParseURL ( "http://activities.example.com/1" ) )
2018-05-28 00:07:40 +09:00
create . AppendActorIRI ( sally )
create . AppendObject ( note )
2018-01-24 08:00:59 +09:00
create . SetUnknownContext ( context )
2018-05-28 00:07:40 +09:00
create . AppendAudienceObject ( audience )
create . AppendToIRI ( john )
2018-01-24 08:00:59 +09:00
like := & Like { }
2018-05-28 00:07:40 +09:00
like . AppendType ( "Like" )
like . AppendSummaryString ( "John liked Sally's note" )
2018-01-24 08:00:59 +09:00
like . SetId ( MustParseURL ( "http://activities.example.com/1" ) )
2018-05-28 00:07:40 +09:00
like . AppendActorIRI ( john )
like . AppendObjectIRI ( o )
2018-01-24 08:00:59 +09:00
like . SetUnknownContext ( context )
2018-05-28 00:07:40 +09:00
like . AppendAudienceObject ( audience )
like . AppendToIRI ( sally )
example144Type . AppendType ( "Collection" )
example144Type . AppendSummaryString ( "Activities in Project XYZ" )
example144Type . AppendItemsObject ( create )
example144Type . AppendItemsObject ( like )
2018-01-24 08:00:59 +09:00
}
const example145 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally's friends list" ,
"type" : "Collection" ,
"items" : [
{
"summary" : "Sally is influenced by Joe" ,
"type" : "Relationship" ,
"subject" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"relationship" : "http://purl.org/vocab/relationship/influencedBy" ,
"object" : {
"type" : "Person" ,
"name" : "Joe"
}
} ,
{
"summary" : "Sally is a friend of Jane" ,
"type" : "Relationship" ,
"subject" : {
"type" : "Person" ,
"name" : "Sally"
} ,
"relationship" : "http://purl.org/vocab/relationship/friendOf" ,
"object" : {
"type" : "Person" ,
"name" : "Jane"
}
}
]
} `
var example145Type = & Collection { }
func init ( ) {
friend := MustParseURL ( "http://purl.org/vocab/relationship/friendOf" )
influenced := MustParseURL ( "http://purl.org/vocab/relationship/influencedBy" )
sally := & Person { }
2018-05-28 00:07:40 +09:00
sally . AppendType ( "Person" )
sally . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
jane := & Person { }
2018-05-28 00:07:40 +09:00
jane . AppendType ( "Person" )
jane . AppendNameString ( "Jane" )
2018-01-24 08:00:59 +09:00
joe := & Person { }
2018-05-28 00:07:40 +09:00
joe . AppendType ( "Person" )
joe . AppendNameString ( "Joe" )
2018-01-24 08:00:59 +09:00
joeRel := & Relationship { }
2018-05-28 00:07:40 +09:00
joeRel . AppendType ( "Relationship" )
joeRel . AppendSummaryString ( "Sally is influenced by Joe" )
2018-01-24 08:00:59 +09:00
joeRel . SetSubjectObject ( sally )
2018-05-28 00:07:40 +09:00
joeRel . AppendObject ( joe )
2018-01-24 08:00:59 +09:00
joeRel . SetRelationshipIRI ( influenced )
janeRel := & Relationship { }
2018-05-28 00:07:40 +09:00
janeRel . AppendType ( "Relationship" )
janeRel . AppendSummaryString ( "Sally is a friend of Jane" )
2018-01-24 08:00:59 +09:00
janeRel . SetSubjectObject ( sally )
2018-05-28 00:07:40 +09:00
janeRel . AppendObject ( jane )
2018-01-24 08:00:59 +09:00
janeRel . SetRelationshipIRI ( friend )
2018-05-28 00:07:40 +09:00
example145Type . AppendType ( "Collection" )
example145Type . AppendSummaryString ( "Sally's friends list" )
example145Type . AppendItemsObject ( joeRel )
example145Type . AppendItemsObject ( janeRel )
2018-01-24 08:00:59 +09:00
}
// NOTE: Added `Z` to `startTime` to make align to spec!
const example146 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally became a friend of Matt" ,
"type" : "Create" ,
"actor" : "http://sally.example.org" ,
"object" : {
"type" : "Relationship" ,
"subject" : "http://sally.example.org" ,
"relationship" : "http://purl.org/vocab/relationship/friendOf" ,
"object" : "http://matt.example.org" ,
"startTime" : "2015-04-21T12:34:56Z"
}
} `
var example146Type = & Create { }
func init ( ) {
friend := MustParseURL ( "http://purl.org/vocab/relationship/friendOf" )
m := MustParseURL ( "http://matt.example.org" )
s := MustParseURL ( "http://sally.example.org" )
t , err := time . Parse ( time . RFC3339 , "2015-04-21T12:34:56Z" )
if err != nil {
panic ( err )
}
relationship := & Relationship { }
2018-05-28 00:07:40 +09:00
relationship . AppendType ( "Relationship" )
2018-01-24 08:00:59 +09:00
relationship . SetSubjectIRI ( s )
relationship . SetRelationshipIRI ( friend )
2018-05-28 00:07:40 +09:00
relationship . AppendObjectIRI ( m )
2018-01-24 08:00:59 +09:00
relationship . SetStartTime ( t )
2018-05-28 00:07:40 +09:00
example146Type . AppendType ( "Create" )
example146Type . AppendSummaryString ( "Sally became a friend of Matt" )
example146Type . AppendActorIRI ( s )
example146Type . AppendObject ( relationship )
2018-01-24 08:00:59 +09:00
}
const example147 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"id" : "http://example.org/connection-requests/123" ,
"summary" : "Sally requested to be a friend of John" ,
"type" : "Offer" ,
"actor" : "acct:sally@example.org" ,
"object" : {
"summary" : "Sally and John's friendship" ,
"id" : "http://example.org/connections/123" ,
"type" : "Relationship" ,
"subject" : "acct:sally@example.org" ,
"relationship" : "http://purl.org/vocab/relationship/friendOf" ,
"object" : "acct:john@example.org"
} ,
"target" : "acct:john@example.org"
} `
var example147Type = & Offer { }
func init ( ) {
friend := MustParseURL ( "http://purl.org/vocab/relationship/friendOf" )
s := MustParseURL ( "acct:sally@example.org" )
t := MustParseURL ( "acct:john@example.org" )
rel := & Relationship { }
2018-05-28 00:07:40 +09:00
rel . AppendType ( "Relationship" )
rel . AppendSummaryString ( "Sally and John's friendship" )
2018-01-24 08:00:59 +09:00
rel . SetId ( MustParseURL ( "http://example.org/connections/123" ) )
rel . SetSubjectIRI ( s )
2018-05-28 00:07:40 +09:00
rel . AppendObjectIRI ( t )
2018-01-24 08:00:59 +09:00
rel . SetRelationshipIRI ( friend )
2018-05-28 00:07:40 +09:00
example147Type . AppendType ( "Offer" )
example147Type . AppendSummaryString ( "Sally requested to be a friend of John" )
2018-01-24 08:00:59 +09:00
example147Type . SetId ( MustParseURL ( "http://example.org/connection-requests/123" ) )
2018-05-28 00:07:40 +09:00
example147Type . AppendActorIRI ( s )
example147Type . AppendObject ( rel )
example147Type . AppendTargetIRI ( t )
2018-01-24 08:00:59 +09:00
}
const example148 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally and John's relationship history" ,
"type" : "Collection" ,
"items" : [
{
"summary" : "John accepted Sally's friend request" ,
"id" : "http://example.org/activities/122" ,
"type" : "Accept" ,
"actor" : "acct:john@example.org" ,
"object" : "http://example.org/connection-requests/123" ,
"inReplyTo" : "http://example.org/connection-requests/123" ,
"context" : "http://example.org/connections/123" ,
"result" : [
"http://example.org/activities/123" ,
"http://example.org/activities/124" ,
"http://example.org/activities/125" ,
"http://example.org/activities/126"
]
} ,
{
"summary" : "John followed Sally" ,
"id" : "http://example.org/activities/123" ,
"type" : "Follow" ,
"actor" : "acct:john@example.org" ,
"object" : "acct:sally@example.org" ,
"context" : "http://example.org/connections/123"
} ,
{
"summary" : "Sally followed John" ,
"id" : "http://example.org/activities/124" ,
"type" : "Follow" ,
"actor" : "acct:sally@example.org" ,
"object" : "acct:john@example.org" ,
"context" : "http://example.org/connections/123"
} ,
{
"summary" : "John added Sally to his friends list" ,
"id" : "http://example.org/activities/125" ,
"type" : "Add" ,
"actor" : "acct:john@example.org" ,
"object" : "http://example.org/connections/123" ,
"target" : {
"type" : "Collection" ,
"summary" : "John's Connections"
} ,
"context" : "http://example.org/connections/123"
} ,
{
"summary" : "Sally added John to her friends list" ,
"id" : "http://example.org/activities/126" ,
"type" : "Add" ,
"actor" : "acct:sally@example.org" ,
"object" : "http://example.org/connections/123" ,
"target" : {
"type" : "Collection" ,
"summary" : "Sally's Connections"
} ,
"context" : "http://example.org/connections/123"
}
]
} `
var example148Type = & Collection { }
func init ( ) {
john := MustParseURL ( "acct:john@example.org" )
sally := MustParseURL ( "acct:sally@example.org" )
req123 := MustParseURL ( "http://example.org/connection-requests/123" )
conn123 := MustParseURL ( "http://example.org/connections/123" )
a123 := MustParseURL ( "http://example.org/activities/123" )
a124 := MustParseURL ( "http://example.org/activities/124" )
a125 := MustParseURL ( "http://example.org/activities/125" )
a126 := MustParseURL ( "http://example.org/activities/126" )
jc := & Collection { }
2018-05-28 00:07:40 +09:00
jc . AppendType ( "Collection" )
jc . AppendSummaryString ( "John's Connections" )
2018-01-24 08:00:59 +09:00
sc := & Collection { }
2018-05-28 00:07:40 +09:00
sc . AppendType ( "Collection" )
sc . AppendSummaryString ( "Sally's Connections" )
2018-01-24 08:00:59 +09:00
o1 := & Accept { }
2018-05-28 00:07:40 +09:00
o1 . AppendType ( "Accept" )
2018-01-24 08:00:59 +09:00
o1 . SetId ( MustParseURL ( "http://example.org/activities/122" ) )
2018-05-28 00:07:40 +09:00
o1 . AppendSummaryString ( "John accepted Sally's friend request" )
o1 . AppendObjectIRI ( req123 )
o1 . AppendInReplyToIRI ( req123 )
o1 . AppendContextIRI ( conn123 )
o1 . AppendResultIRI ( a123 )
o1 . AppendResultIRI ( a124 )
o1 . AppendResultIRI ( a125 )
o1 . AppendResultIRI ( a126 )
o1 . AppendActorIRI ( john )
2018-01-24 08:00:59 +09:00
o2 := & Follow { }
2018-05-28 00:07:40 +09:00
o2 . AppendType ( "Follow" )
2018-01-24 08:00:59 +09:00
o2 . SetId ( MustParseURL ( "http://example.org/activities/123" ) )
2018-05-28 00:07:40 +09:00
o2 . AppendActorIRI ( john )
o2 . AppendObjectIRI ( sally )
o2 . AppendContextIRI ( conn123 )
o2 . AppendSummaryString ( "John followed Sally" )
2018-01-24 08:00:59 +09:00
o3 := & Follow { }
2018-05-28 00:07:40 +09:00
o3 . AppendType ( "Follow" )
2018-01-24 08:00:59 +09:00
o3 . SetId ( MustParseURL ( "http://example.org/activities/124" ) )
2018-05-28 00:07:40 +09:00
o3 . AppendActorIRI ( sally )
o3 . AppendObjectIRI ( john )
o3 . AppendContextIRI ( conn123 )
o3 . AppendSummaryString ( "Sally followed John" )
2018-01-24 08:00:59 +09:00
o4 := & Add { }
2018-05-28 00:07:40 +09:00
o4 . AppendType ( "Add" )
2018-01-24 08:00:59 +09:00
o4 . SetId ( MustParseURL ( "http://example.org/activities/125" ) )
2018-05-28 00:07:40 +09:00
o4 . AppendSummaryString ( "John added Sally to his friends list" )
o4 . AppendActorIRI ( john )
o4 . AppendObjectIRI ( conn123 )
o4 . AppendContextIRI ( conn123 )
o4 . AppendTargetObject ( jc )
2018-01-24 08:00:59 +09:00
o5 := & Add { }
2018-05-28 00:07:40 +09:00
o5 . AppendType ( "Add" )
2018-01-24 08:00:59 +09:00
o5 . SetId ( MustParseURL ( "http://example.org/activities/126" ) )
2018-05-28 00:07:40 +09:00
o5 . AppendSummaryString ( "Sally added John to her friends list" )
o5 . AppendActorIRI ( sally )
o5 . AppendObjectIRI ( conn123 )
o5 . AppendContextIRI ( conn123 )
o5 . AppendTargetObject ( sc )
example148Type . AppendType ( "Collection" )
example148Type . AppendSummaryString ( "Sally and John's relationship history" )
example148Type . AppendItemsObject ( o1 )
example148Type . AppendItemsObject ( o2 )
example148Type . AppendItemsObject ( o3 )
example148Type . AppendItemsObject ( o4 )
example148Type . AppendItemsObject ( o5 )
2018-01-24 08:00:59 +09:00
}
const example149 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "San Francisco, CA"
} `
var example149Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example149Type . AppendType ( "Place" )
example149Type . AppendNameString ( "San Francisco, CA" )
2018-01-24 08:00:59 +09:00
}
// NOTE: Un-stringified the longitude and latitude values.
const example150 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"type" : "Place" ,
"name" : "San Francisco, CA" ,
"longitude" : 122.4167 ,
"latitude" : 37.7833
} `
var example150Type = & Place { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example150Type . AppendType ( "Place" )
example150Type . AppendNameString ( "San Francisco, CA" )
2018-01-24 08:00:59 +09:00
example150Type . SetLongitude ( 122.4167 )
example150Type . SetLatitude ( 37.7833 )
}
const example151 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "A question about robots" ,
"id" : "http://help.example.org/question/1" ,
"type" : "Question" ,
"content" : "I'd like to build a robot to feed my cat. Should I use Arduino or Raspberry Pi?"
} `
var example151Type = & Question { }
func init ( ) {
2018-05-28 00:07:40 +09:00
example151Type . AppendType ( "Question" )
example151Type . AppendNameString ( "A question about robots" )
2018-01-24 08:00:59 +09:00
example151Type . SetId ( MustParseURL ( "http://help.example.org/question/1" ) )
2018-05-28 00:07:40 +09:00
example151Type . AppendContentString ( "I'd like to build a robot to feed my cat. Should I use Arduino or Raspberry Pi?" )
2018-01-24 08:00:59 +09:00
}
const example152 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"id" : "http://polls.example.org/question/1" ,
"name" : "A question about robots" ,
"type" : "Question" ,
"content" : "I'd like to build a robot to feed my cat. Which platform is best?" ,
"oneOf" : [
{ "name" : "arduino" } ,
{ "name" : "raspberry pi" }
]
} `
var example152Type = & Question { }
func init ( ) {
ard := make ( map [ string ] interface { } )
ard [ "name" ] = "arduino"
ras := make ( map [ string ] interface { } )
ras [ "name" ] = "raspberry pi"
oneOf := [ ] interface { } { ard , ras }
2018-05-28 00:07:40 +09:00
example152Type . AppendType ( "Question" )
example152Type . AppendNameString ( "A question about robots" )
2018-01-24 08:00:59 +09:00
example152Type . SetId ( MustParseURL ( "http://polls.example.org/question/1" ) )
2018-05-28 00:07:40 +09:00
example152Type . AppendContentString ( "I'd like to build a robot to feed my cat. Which platform is best?" )
2018-01-24 08:00:59 +09:00
example152Type . SetUnknownOneOf ( oneOf )
}
const example153 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"attributedTo" : "http://sally.example.org" ,
"inReplyTo" : "http://polls.example.org/question/1" ,
"name" : "arduino"
} `
var example153Type = & Unknown { }
func init ( ) {
example153Type . SetField ( "attributedTo" , "http://sally.example.org" )
example153Type . SetField ( "inReplyTo" , "http://polls.example.org/question/1" )
example153Type . SetField ( "name" , "arduino" )
}
const example154 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "A question about robots" ,
"id" : "http://polls.example.org/question/1" ,
"type" : "Question" ,
"content" : "I'd like to build a robot to feed my cat. Which platform is best?" ,
"oneOf" : [
{ "name" : "arduino" } ,
{ "name" : "raspberry pi" }
] ,
"replies" : {
"type" : "Collection" ,
"totalItems" : 3 ,
"items" : [
{
"attributedTo" : "http://sally.example.org" ,
"inReplyTo" : "http://polls.example.org/question/1" ,
"name" : "arduino"
} ,
{
"attributedTo" : "http://joe.example.org" ,
"inReplyTo" : "http://polls.example.org/question/1" ,
"name" : "arduino"
} ,
{
"attributedTo" : "http://john.example.org" ,
"inReplyTo" : "http://polls.example.org/question/1" ,
"name" : "raspberry pi"
}
]
} ,
"result" : {
"type" : "Note" ,
"content" : "Users are favoriting "arduino" by a 33% margin."
}
} `
var example154Type = & Question { }
func init ( ) {
ard := make ( map [ string ] interface { } )
ard [ "name" ] = "arduino"
ras := make ( map [ string ] interface { } )
ras [ "name" ] = "raspberry pi"
oneOf := [ ] interface { } { ard , ras }
one := make ( map [ string ] interface { } )
one [ "attributedTo" ] = "http://sally.example.org"
one [ "inReplyTo" ] = "http://polls.example.org/question/1"
one [ "name" ] = "arduino"
two := make ( map [ string ] interface { } )
two [ "attributedTo" ] = "http://joe.example.org"
two [ "inReplyTo" ] = "http://polls.example.org/question/1"
two [ "name" ] = "arduino"
three := make ( map [ string ] interface { } )
three [ "attributedTo" ] = "http://john.example.org"
three [ "inReplyTo" ] = "http://polls.example.org/question/1"
three [ "name" ] = "raspberry pi"
items := [ ] interface { } { one , two , three }
replies := & Collection { }
2018-05-28 00:07:40 +09:00
replies . AppendType ( "Collection" )
2018-01-24 08:00:59 +09:00
replies . SetTotalItems ( 3 )
replies . SetUnknownItems ( items )
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendContentString ( "Users are favoriting "arduino" by a 33% margin." )
example154Type . AppendType ( "Question" )
example154Type . AppendNameString ( "A question about robots" )
2018-01-24 08:00:59 +09:00
example154Type . SetId ( MustParseURL ( "http://polls.example.org/question/1" ) )
2018-05-28 00:07:40 +09:00
example154Type . AppendContentString ( "I'd like to build a robot to feed my cat. Which platform is best?" )
2018-01-24 08:00:59 +09:00
example154Type . SetUnknownOneOf ( oneOf )
example154Type . SetReplies ( replies )
2018-05-28 00:07:40 +09:00
example154Type . AppendResultObject ( note )
2018-01-24 08:00:59 +09:00
}
const example155 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "History of John's note" ,
"type" : "Collection" ,
"items" : [
{
"summary" : "Sally liked John's note" ,
"type" : "Like" ,
"actor" : "http://sally.example.org" ,
"id" : "http://activities.example.com/1" ,
"published" : "2015-11-12T12:34:56Z" ,
"object" : {
"summary" : "John's note" ,
"type" : "Note" ,
"id" : "http://notes.example.com/1" ,
"attributedTo" : "http://john.example.org" ,
"content" : "My note"
}
} ,
{
"summary" : "Sally disliked John's note" ,
"type" : "Dislike" ,
"actor" : "http://sally.example.org" ,
"id" : "http://activities.example.com/2" ,
"published" : "2015-12-11T21:43:56Z" ,
"object" : {
"summary" : "John's note" ,
"type" : "Note" ,
"id" : "http://notes.example.com/1" ,
"attributedTo" : "http://john.example.org" ,
"content" : "My note"
}
}
]
} `
var example155Type = & Collection { }
func init ( ) {
john := MustParseURL ( "http://john.example.org" )
sally := MustParseURL ( "http://sally.example.org" )
t1 , err := time . Parse ( time . RFC3339 , "2015-11-12T12:34:56Z" )
if err != nil {
panic ( err )
}
t2 , err := time . Parse ( time . RFC3339 , "2015-12-11T21:43:56Z" )
if err != nil {
panic ( err )
}
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
note . AppendSummaryString ( "John's note" )
2018-01-24 08:00:59 +09:00
note . SetId ( MustParseURL ( "http://notes.example.com/1" ) )
2018-05-28 00:07:40 +09:00
note . AppendContentString ( "My note" )
note . AppendAttributedToIRI ( john )
2018-01-24 08:00:59 +09:00
like := & Like { }
2018-05-28 00:07:40 +09:00
like . AppendType ( "Like" )
like . AppendSummaryString ( "Sally liked John's note" )
2018-01-24 08:00:59 +09:00
like . SetId ( MustParseURL ( "http://activities.example.com/1" ) )
2018-05-28 00:07:40 +09:00
like . AppendActorIRI ( sally )
2018-01-24 08:00:59 +09:00
like . SetPublished ( t1 )
2018-05-28 00:07:40 +09:00
like . AppendObject ( note )
2018-01-24 08:00:59 +09:00
dislike := & Dislike { }
2018-05-28 00:07:40 +09:00
dislike . AppendType ( "Dislike" )
dislike . AppendSummaryString ( "Sally disliked John's note" )
2018-01-24 08:00:59 +09:00
dislike . SetId ( MustParseURL ( "http://activities.example.com/2" ) )
2018-05-28 00:07:40 +09:00
dislike . AppendActorIRI ( sally )
2018-01-24 08:00:59 +09:00
dislike . SetPublished ( t2 )
2018-05-28 00:07:40 +09:00
dislike . AppendObject ( note )
example155Type . AppendType ( "Collection" )
example155Type . AppendSummaryString ( "History of John's note" )
example155Type . AppendItemsObject ( like )
example155Type . AppendItemsObject ( dislike )
2018-01-24 08:00:59 +09:00
}
const example156 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "History of John's note" ,
"type" : "Collection" ,
"items" : [
{
"summary" : "Sally liked John's note" ,
"type" : "Like" ,
"id" : "http://activities.example.com/1" ,
"actor" : "http://sally.example.org" ,
"published" : "2015-11-12T12:34:56Z" ,
"object" : {
"summary" : "John's note" ,
"type" : "Note" ,
"id" : "http://notes.example.com/1" ,
"attributedTo" : "http://john.example.org" ,
"content" : "My note"
}
} ,
{
"summary" : "Sally no longer likes John's note" ,
"type" : "Undo" ,
"id" : "http://activities.example.com/2" ,
"actor" : "http://sally.example.org" ,
"published" : "2015-12-11T21:43:56Z" ,
"object" : "http://activities.example.com/1"
}
]
} `
var example156Type = & Collection { }
func init ( ) {
john := MustParseURL ( "http://john.example.org" )
sally := MustParseURL ( "http://sally.example.org" )
a := MustParseURL ( "http://activities.example.com/1" )
t1 , err := time . Parse ( time . RFC3339 , "2015-11-12T12:34:56Z" )
if err != nil {
panic ( err )
}
t2 , err := time . Parse ( time . RFC3339 , "2015-12-11T21:43:56Z" )
if err != nil {
panic ( err )
}
note := & Note { }
2018-05-28 00:07:40 +09:00
note . AppendType ( "Note" )
2018-01-24 08:00:59 +09:00
note . SetId ( MustParseURL ( "http://notes.example.com/1" ) )
2018-05-28 00:07:40 +09:00
note . AppendSummaryString ( "John's note" )
note . AppendAttributedToIRI ( john )
note . AppendContentString ( "My note" )
2018-01-24 08:00:59 +09:00
like := & Like { }
2018-05-28 00:07:40 +09:00
like . AppendType ( "Like" )
2018-01-24 08:00:59 +09:00
like . SetId ( MustParseURL ( "http://activities.example.com/1" ) )
2018-05-28 00:07:40 +09:00
like . AppendSummaryString ( "Sally liked John's note" )
like . AppendActorIRI ( sally )
2018-01-24 08:00:59 +09:00
like . SetPublished ( t1 )
2018-05-28 00:07:40 +09:00
like . AppendObject ( note )
2018-01-24 08:00:59 +09:00
undo := & Undo { }
2018-05-28 00:07:40 +09:00
undo . AppendType ( "Undo" )
2018-01-24 08:00:59 +09:00
undo . SetId ( MustParseURL ( "http://activities.example.com/2" ) )
2018-05-28 00:07:40 +09:00
undo . AppendSummaryString ( "Sally no longer likes John's note" )
undo . AppendActorIRI ( sally )
2018-01-24 08:00:59 +09:00
undo . SetPublished ( t2 )
2018-05-28 00:07:40 +09:00
undo . AppendObjectIRI ( a )
example156Type . AppendType ( "Collection" )
example156Type . AppendSummaryString ( "History of John's note" )
example156Type . AppendItemsObject ( like )
example156Type . AppendItemsObject ( undo )
2018-01-24 08:00:59 +09:00
}
// NOTE: The `content` field has been inlined to keep within JSON spec.
const example157 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "A thank-you note" ,
"type" : "Note" ,
"content" : "Thank you <a href='http://sally.example.org'>@sally</a> for all your hard work! <a href='http://example.org/tags/givingthanks'>#givingthanks</a>" ,
"to" : {
"name" : "Sally" ,
"type" : "Person" ,
"id" : "http://sally.example.org"
} ,
"tag" : {
"id" : "http://example.org/tags/givingthanks" ,
"name" : "#givingthanks"
}
} `
var example157Type = & Note { }
func init ( ) {
tag := make ( map [ string ] interface { } )
tag [ "id" ] = "http://example.org/tags/givingthanks"
tag [ "name" ] = "#givingthanks"
person := & Person { }
2018-05-28 00:07:40 +09:00
person . AppendType ( "Person" )
person . AppendNameString ( "Sally" )
2018-01-24 08:00:59 +09:00
person . SetId ( MustParseURL ( "http://sally.example.org" ) )
2018-05-28 00:07:40 +09:00
example157Type . AppendType ( "Note" )
example157Type . AppendNameString ( "A thank-you note" )
example157Type . AppendContentString ( "Thank you <a href='http://sally.example.org'>@sally</a> for all your hard work! <a href='http://example.org/tags/givingthanks'>#givingthanks</a>" )
example157Type . AppendToObject ( person )
2018-01-24 08:00:59 +09:00
example157Type . SetUnknownTag ( tag )
}
const example158 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"name" : "A thank-you note" ,
"type" : "Note" ,
"content" : "Thank you @sally for all your hard work! #givingthanks" ,
"tag" : [
{
"type" : "Mention" ,
"href" : "http://example.org/people/sally" ,
"name" : "@sally"
} ,
{
"id" : "http://example.org/tags/givingthanks" ,
"name" : "#givingthanks"
}
]
} `
var example158Type = & Note { }
func init ( ) {
u := MustParseURL ( "http://example.org/people/sally" )
tag := make ( map [ string ] interface { } )
tag [ "id" ] = "http://example.org/tags/givingthanks"
tag [ "name" ] = "#givingthanks"
mention := & Mention { }
2018-05-28 00:07:40 +09:00
mention . AppendType ( "Mention" )
2018-01-24 08:00:59 +09:00
mention . SetHref ( u )
2018-05-28 00:07:40 +09:00
mention . AppendNameString ( "@sally" )
example158Type . AppendType ( "Note" )
example158Type . AppendNameString ( "A thank-you note" )
example158Type . AppendContentString ( "Thank you @sally for all your hard work! #givingthanks" )
example158Type . AppendTagLink ( mention )
2018-01-24 08:00:59 +09:00
example158Type . SetUnknownTag ( tag )
}
const example159 = ` {
"@context" : "https://www.w3.org/ns/activitystreams" ,
"summary" : "Sally moved the sales figures from Folder A to Folder B" ,
"type" : "Move" ,
"actor" : "http://sally.example.org" ,
"object" : {
"type" : "Document" ,
"name" : "sales figures"
} ,
"origin" : {
"type" : "Collection" ,
"name" : "Folder A"
} ,
"target" : {
"type" : "Collection" ,
"name" : "Folder B"
}
} `
var example159Type = & Move { }
func init ( ) {
sally := MustParseURL ( "http://sally.example.org" )
obj := & Document { }
2018-05-28 00:07:40 +09:00
obj . AppendType ( "Document" )
obj . AppendNameString ( "sales figures" )
2018-01-24 08:00:59 +09:00
origin := & Collection { }
2018-05-28 00:07:40 +09:00
origin . AppendType ( "Collection" )
origin . AppendNameString ( "Folder A" )
2018-01-24 08:00:59 +09:00
target := & Collection { }
2018-05-28 00:07:40 +09:00
target . AppendType ( "Collection" )
target . AppendNameString ( "Folder B" )
example159Type . AppendType ( "Move" )
example159Type . AppendSummaryString ( "Sally moved the sales figures from Folder A to Folder B" )
example159Type . AppendActorIRI ( sally )
example159Type . AppendObject ( obj )
example159Type . AppendOriginObject ( origin )
example159Type . AppendTargetObject ( target )
2018-01-24 08:00:59 +09:00
}