Documentation ¶
Index ¶
- func EncodeTagArray(arr []Tag) []string
- type Change
- type ChangeFilter
- type ChangeKey
- type ChangeModel
- type ChangeObjectSet
- type Channel
- type ChannelFilter
- type ChannelUpdate
- type Chapter
- type ChapterCommentMode
- type ChapterFilter
- type ChapterUpdate
- type Character
- type CharacterFilter
- type CharacterUpdate
- type Comment
- type CommentFilter
- type CommentUpdate
- type File
- type FileFilter
- type FileUpdate
- type Key
- type KeyFilter
- type Log
- type LogFilter
- type LogImporter
- type LogSuggestion
- type LogUpdate
- type Post
- type PostFilter
- type PostUpdate
- type Story
- type StoryCategory
- type StoryFilter
- type StoryUpdate
- type Tag
- type TagFilter
- type TagKind
- type Token
- type UnknownNick
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeTagArray ¶
Types ¶
type Change ¶
type Change struct { ID string `bson:"_id"` Model ChangeModel `bson:"model"` Op string `bson:"op"` Author string `bson:"author"` Listed bool `bson:"listed"` Keys []ChangeKey `bson:"keys"` Date time.Time `bson:"date"` ChangeObjectSet }
Change represents a change in the rpdata history through the API.
func (*Change) Objects ¶
func (change *Change) Objects() []interface{}
Objects makes a combined, mixed array of all the models stored in this change.
func (*Change) PassesFilter ¶
func (change *Change) PassesFilter(filter ChangeFilter) bool
type ChangeFilter ¶
type ChangeFilter struct { Keys []ChangeKey EarliestDate *time.Time LatestDate *time.Time Author *string Limit *int }
ChangeFilter is a filter for listing changes.
type ChangeKey ¶
type ChangeKey struct { Model ChangeModel `bson:"model"` ID string `bson:"id"` }
ChangeKey is a key for a change that can be used when subscribing to them.
type ChangeModel ¶
type ChangeModel string
ChangeModel describes a model related to the change.
const ( // ChangeModelCharacter is a value of ChangeModel ChangeModelCharacter ChangeModel = "Character" // ChangeModelChannel is a value of ChangeModel ChangeModelChannel ChangeModel = "Channel" // ChangeModelLog is a value of ChangeModel ChangeModelLog ChangeModel = "Log" // ChangeModelPost is a value of ChangeModel ChangeModelPost ChangeModel = "Post" // ChangeModelStory is a value of ChangeModel ChangeModelStory ChangeModel = "Story" // ChangeModelTag is a value of ChangeModel ChangeModelTag ChangeModel = "Tag" // ChangeModelChapter is a value of ChangeModel ChangeModelChapter ChangeModel = "Chapter" // ChangeModelComment is a value of ChangeModel ChangeModelComment ChangeModel = "Comment" // ChangeModelFile is a value of ChangeModel ChangeModelFile ChangeModel = "File" )
func (ChangeModel) IsValid ¶
func (e ChangeModel) IsValid() bool
IsValid returns true if the underlying string is one of the correct values.
func (ChangeModel) MarshalGQL ¶
func (e ChangeModel) MarshalGQL(w io.Writer)
MarshalGQL marshals the underlying graphql value.
func (ChangeModel) String ¶
func (e ChangeModel) String() string
func (*ChangeModel) UnmarshalGQL ¶
func (e *ChangeModel) UnmarshalGQL(v interface{}) error
UnmarshalGQL unmarshals the underlying graphql value.
type ChangeObjectSet ¶
type ChangeObjectSet struct { Logs []*Log `bson:"logs" json:"logs,omitempty"` Characters []*Character `bson:"characters" json:"characters,omitempty"` Channels []*Channel `bson:"channels" json:"channels,omitempty"` Posts []*Post `bson:"posts" json:"posts,omitempty"` Stories []*Story `bson:"stories" json:"stories,omitempty"` Tags []*Tag `bson:"tags" json:"tags,omitempty"` Chapters []*Chapter `bson:"chapters" json:"chapters,omitempty"` Comments []*Comment `bson:"comments" json:"comments,omitempty"` Files []*File `bson:"files" json:"files,omitempty"` }
func (*ChangeObjectSet) AddObject ¶
func (change *ChangeObjectSet) AddObject(object interface{}) bool
AddObject adds the model into the appropriate array.
type Channel ¶
type Channel struct { Name string `bson:"_id"` Logged bool `bson:"logged"` Hub bool `bson:"hub"` EventName string `bson:"eventName,omitempty"` LocationName string `bson:"locationName,omitempty"` }
A Channel represents information abount an IRC RP channel, and whether it should be logged
func (*Channel) ApplyUpdate ¶
func (channel *Channel) ApplyUpdate(update ChannelUpdate)
func (*Channel) IsChangeObject ¶
func (*Channel) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type ChannelFilter ¶
type ChannelFilter struct { Names []string `json:"names"` Logged *bool `json:"logged"` EventName *string `json:"eventName"` LocationName *string `json:"locationName"` Limit int `json:"limit"` }
ChannelFilter is a filter for channel listing.
type ChannelUpdate ¶
type ChannelUpdate struct { Logged *bool `json:"logged"` Hub *bool `json:"hub"` EventName *string `json:"eventName"` LocationName *string `json:"locationName"` }
ChannelUpdate is a filter for channel listing.
type Chapter ¶
type Chapter struct { ID string `bson:"_id"` StoryID string `bson:"storyId"` Title string `bson:"title"` Author string `bson:"author"` Source string `bson:"source"` CreatedDate time.Time `bson:"createdDate"` FictionalDate time.Time `bson:"fictionalDate,omitempty"` EditedDate time.Time `bson:"editedDate"` CommentMode ChapterCommentMode `bson:"commentMode"` CommentsLocked bool `bson:"commentsLocked"` }
A Chapter is a part of a story.
func (*Chapter) ApplyUpdate ¶
func (chapter *Chapter) ApplyUpdate(update ChapterUpdate)
func (*Chapter) CanComment ¶
CanComment returns true if the chapter can be commented to.
func (*Chapter) IsChangeObject ¶
func (*Chapter) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type ChapterCommentMode ¶
type ChapterCommentMode string
ChapterCommentMode represents the kind of tags.
const ( // ChapterCommentModeDisabled is a chapter comment mode, see GraphQL documentation. ChapterCommentModeDisabled ChapterCommentMode = "Disabled" // ChapterCommentModeArticle is a chapter comment mode, see GraphQL documentation. ChapterCommentModeArticle ChapterCommentMode = "Article" // ChapterCommentModeChat is a chapter comment mode, see GraphQL documentation. ChapterCommentModeChat ChapterCommentMode = "Chat" // ChapterCommentModeMessage is a chapter comment mode, see GraphQL documentation. ChapterCommentModeMessage ChapterCommentMode = "Message" )
func (ChapterCommentMode) IsEnabled ¶
func (e ChapterCommentMode) IsEnabled() bool
IsEnabled returns true if comments are enabled.
func (ChapterCommentMode) MarshalGQL ¶
func (e ChapterCommentMode) MarshalGQL(w io.Writer)
MarshalGQL turns it into a JSON string
func (*ChapterCommentMode) UnmarshalGQL ¶
func (e *ChapterCommentMode) UnmarshalGQL(v interface{}) error
UnmarshalGQL unmarshals
type ChapterFilter ¶
type ChapterUpdate ¶
type Character ¶
type Character struct { ID string `json:"id" bson:"_id" db:"id"` Nicks []string `json:"nicks" bson:"nicks" db:"nicks"` Name string `json:"name" bson:"name" db:"name"` ShortName string `json:"shortName" bson:"shortName" db:"short_name"` Author string `json:"author" bson:"author" db:"author"` Description string `json:"description" bson:"description" db:"description"` }
Character is a common data model representing an RP character or NPC.
func (*Character) ApplyUpdate ¶
func (character *Character) ApplyUpdate(update CharacterUpdate)
func (*Character) IsChangeObject ¶
func (*Character) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type CharacterFilter ¶
type CharacterFilter struct { IDs []string Nicks []string Names []string Author *string Search *string Limit int }
CharacterFilter is a filter for character listing.
type CharacterUpdate ¶
CharacterUpdate is an update for characters.
type Comment ¶
type Comment struct { ID string `bson:"_id"` ChapterID string `bson:"chapterId"` Subject string `bson:"subject"` Author string `bson:"author"` CharacterName string `bson:"characterName"` CharacterID string `bson:"characterId"` FictionalDate time.Time `bson:"fictionalDate"` CreatedDate time.Time `bson:"createdDate"` EditedDate time.Time `bson:"editedDate"` Source string `bson:"source"` }
A Comment is a comment on a chapter.
func (*Comment) ApplyUpdate ¶
func (comment *Comment) ApplyUpdate(update CommentUpdate)
func (*Comment) IsChangeObject ¶
func (*Comment) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type CommentFilter ¶
type CommentUpdate ¶
type File ¶
type File struct { ID string `bson:"_id" json:"id"` Time time.Time `bson:"time" json:"time"` Kind string `bson:"kind" json:"kind"` Public bool `bson:"public" json:"public"` Name string `bson:"name" json:"name"` MimeType string `bson:"mimeType" json:"mimeType"` Size int64 `bson:"size" json:"size"` Author string `bson:"author" json:"author"` URL string `bson:"url,omitempty" json:"url,omitempty"` }
A File is a record of a file stored in the Space.
func (*File) IsChangeObject ¶
func (*File) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type FileFilter ¶
A FileFilter is a filter that can be used to filter files.
type FileUpdate ¶
A FileUpdate is a set of changes possible to do on file metadata.
type Key ¶
type Key struct { ID string `bson:"_id"` Name string `bson:"name"` User string `bson:"user"` Secret string `bson:"secret"` }
A Key contains a JWT secret and the limitations of it. There are two types of keys, single-user keys and wildcard keys. The former is used to authenticate a single user (e.g. the logbot) through an API while the latter is only for services that can be trusted to perform its own authentication (a frontend).
func (*Key) ValidForUser ¶
ValidForUser returns true if the key's user is the same as the user, or it's a wildcard key.
type Log ¶
type Log struct { ID string `bson:"_id"` ShortID string `bson:"shortId"` Date time.Time `bson:"date"` ChannelName string `bson:"channel"` EventName string `bson:"event,omitempty"` Title string `bson:"title,omitempty"` Description string `bson:"description,omitempty"` Open bool `bson:"open"` CharacterIDs []string `bson:"characterIds"` }
Log is the header/session for a log file.
func (*Log) ApplyUpdate ¶
func (*Log) IsChangeObject ¶
func (*Log) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type LogFilter ¶
type LogFilter struct { Open *bool Characters []string Channels []string Events []string MinDate *time.Time MaxDate *time.Time Search *string Limit int }
A LogFilter is a filter that can be used to list logs.
type LogImporter ¶
type LogImporter string
LogImporter describes a model related log importing.
const ( // LogImporterMircLike is a value of LogImporter LogImporterMircLike LogImporter = "MircLike" // LogImporterForumLog is a value of LogImporter LogImporterForumLog LogImporter = "ForumLog" // LogImporterForumLog is a value of LogImporter LogImporterIrcCloud LogImporter = "IrcCloud" )
func (LogImporter) IsValid ¶
func (e LogImporter) IsValid() bool
IsValid returns true if the underlying string is one of the correct values.
func (LogImporter) MarshalGQL ¶
func (e LogImporter) MarshalGQL(w io.Writer)
MarshalGQL marshals the underlying graphql value.
func (LogImporter) String ¶
func (e LogImporter) String() string
func (*LogImporter) UnmarshalGQL ¶
func (e *LogImporter) UnmarshalGQL(v interface{}) error
UnmarshalGQL unmarshals the underlying graphql value.
type LogSuggestion ¶
A LogSuggestion is a suggestion for a log.
type Post ¶
type Post struct { ID string `bson:"_id"` LogID string `bson:"logId"` Time time.Time `bson:"time"` Kind string `bson:"kind"` Nick string `bson:"nick"` Text string `bson:"text"` Position int `bson:"position"` }
A Post is a part of a log file.
func (*Post) ApplyUpdate ¶
func (post *Post) ApplyUpdate(update PostUpdate)
func (*Post) IsChangeObject ¶
func (*Post) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type PostFilter ¶
PostFilter is used to generate a query to the database.
type Story ¶
type Story struct { ID string `bson:"_id"` Author string `bson:"author"` Name string `bson:"name"` Category StoryCategory `bson:"category"` Open bool `bson:"open"` Listed bool `bson:"listed"` Tags []Tag `bson:"tags"` CreatedDate time.Time `bson:"createdDate"` FictionalDate time.Time `bson:"fictionalDate,omitempty"` UpdatedDate time.Time `bson:"updatedDate"` SortByFictionalDate bool `bson:"sortByFictionalDate"` }
A Story is user content that does not have a wiki-suitable format. Documents, new stories, short stories, and so on. The story model is a container for multiple chapters this time, in contrast to the previous version.
func (*Story) ApplyUpdate ¶
func (story *Story) ApplyUpdate(update StoryUpdate)
func (*Story) IsChangeObject ¶
func (_ *Story) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type StoryCategory ¶
type StoryCategory string
StoryCategory represents the category of a story.
const ( // StoryCategoryInfo is a story category, see GraphQL documentation. StoryCategoryInfo StoryCategory = "Info" // StoryCategoryNews is a story category, see GraphQL documentation. StoryCategoryNews StoryCategory = "News" // StoryCategoryDocument is a story category, see GraphQL documentation. StoryCategoryDocument StoryCategory = "Document" // StoryCategoryBackground is a story category, see GraphQL documentation. StoryCategoryBackground StoryCategory = "Background" // StoryCategoryStory is a story category, see GraphQL documentation. StoryCategoryStory StoryCategory = "Story" )
func (*StoryCategory) IsValid ¶
func (e *StoryCategory) IsValid() bool
IsValid returns whether the category is one of the valid values.
func (StoryCategory) MarshalGQL ¶
func (e StoryCategory) MarshalGQL(w io.Writer)
MarshalGQL turns it into a JSON string
func (*StoryCategory) UnmarshalGQL ¶
func (e *StoryCategory) UnmarshalGQL(v interface{}) error
UnmarshalGQL unmarshals
type StoryFilter ¶
type StoryUpdate ¶
type Tag ¶
A Tag associates a story with other content, like other stories, logs and more.
func DecodeTagArray ¶
func (*Tag) IsChangeObject ¶
func (*Tag) IsChangeObject()
IsChangeObject is an interface implementation to identify it as a valid ChangeObject in GQL.
type TagFilter ¶
type TagFilter struct {
Kind *TagKind `bson:"kind,omitempty"`
}
TagFilter is a filter for tag listing.
type TagKind ¶
type TagKind string
TagKind represents the kind of tags.
const ( // TagKindOrganization is a tag kind, see GraphQL documentation. TagKindOrganization TagKind = "Organization" // TagKindCharacter is a tag kind, see GraphQL documentation. TagKindCharacter TagKind = "Character" // TagKindLocation is a tag kind, see GraphQL documentation. TagKindLocation TagKind = "Location" // TagKindEvent is a tag kind, see GraphQL documentation. TagKindEvent TagKind = "Event" // TagKindSeries is a tag kind, see GraphQL documentation. TagKindSeries TagKind = "Series" )
func (TagKind) MarshalGQL ¶
MarshalGQL turns it into a JSON string
func (*TagKind) UnmarshalGQL ¶
UnmarshalGQL unmarshals
type Token ¶
A Token contains the parsed results from an bearer token. Its methods are safe to use with a nil receiver, but the userID should be checked.
func (*Token) Authenticated ¶
Authenticated returns true if the token is non-nil and parsed
func (*Token) Permitted ¶
Permitted returns true if the token is non-nil and has the given permission or the "admin" permission
func (*Token) PermittedUser ¶
PermittedUser checks the first permission if the user matches, the second otherwise. This is a common pattern.
type UnknownNick ¶
UnknownNick represents an unknown nick name.