tootns

package module
v0.0.0-...-a1e2b1b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2025 License: MIT Imports: 2 Imported by: 0

README

go-tootns

Package tootns provides an implementation of the (Mastodon) toot JSON-LD namespace for the ActivityPub and ActivityStreams protocols, as they are used on the Fediverse, for the Go programming language.

The toot namespace is the one that uses the URL http://joinmastodon.org/ns#

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-tootns

GoDoc

Example

import (
	"github.com/reiver/go-tootns"
	"github.com/reiver/go-jsonld"
)

// ...

var toot = tootns.Toot{
	Discoverable: opt.Something(true),
	Indexable:    opt.Something(true),
}

// ...

bytes, err := jsonld.Marshal(toot)

jsonld.Marshal() can be used to mix multiple namespaces. For example:

import (
	"github.com/reiver/go-act"
	"github.com/reiver/go-tootns"
	"github.com/reiver/go-jsonld"
)

// ...

var person act.Person{
	// ...
}

var toot = tootns.Toot{
	Discoverable: opt.Something(true),
	Indexable:    opt.Something(true),
}

// ...

bytes, err := jsonld.Marshal(person, toot)

Import

To import package tootns use import code like the follownig:

import "github.com/reiver/go-tootns"

Installation

To install package tootns do the following:

GOPROXY=direct go get github.com/reiver/go-tootns

Author

Package tootns was written by Charles Iliya Krempeaux

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Toot

type Toot struct {
	NameSpace jsonld.NameSpace `jsonld:"http://joinmastodon.org/ns#"`
	Prefix    jsonld.Prefix    `jsonld:"toot"`

	AttributionDomains opt.Optional[string] `json:"attributionDomains,omitempty"`
	BlurHash           opt.Optional[string] `json:"blurhash,omitempty"`
	Discoverable       opt.Optional[bool]   `json:"discoverable,omitempty"`
	//	Emoji              opt.Optional[string] `json:"Emoji,omitempty"`
	Featured     opt.Optional[bool] `json:"featured,omitempty"`
	FeaturedTags []string           `json:"featuredTags,omitempty"`
	FocalPoint   []any              `json:"focalPoint,omitempty"`
	//	IdentityProof      opt.Optional[string] `json:"IdentityProof,omitempty"`
	Indexable   opt.Optional[bool]   `json:"indexable,omitempty"`
	Memorial    opt.Optional[bool]   `json:"memorial,omitempty"`
	Suspended   opt.Optional[bool]   `json:"suspended,omitempty"`
	VotersCount opt.Optional[string] `json:"votersCount,omitempty"`
}

"toot": "http://joinmastodon.org/ns#"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL