reactions: github.com/shurcooL/reactions Index | Files | Directories

package reactions

import "github.com/shurcooL/reactions"

Package reactions provides a reactions service definition.

Index

Package Files

doc.go reactions.go service.go

Variables

var Sorted = []string{ /* 1292 elements not displayed */

}

Sorted is a sorted list of reactions.

func Position Uses

func Position(emojiID string) string

Position returns position of emojiID within the emojis tilemap.

type EmojiID Uses

type EmojiID string

EmojiID is the id of a reaction. For example, "+1". TODO, THINK: Maybe keep the colons, i.e., ":+1:".

type Reaction Uses

type Reaction struct {
    Reaction EmojiID
    Users    []users.User // Length is 1 or more. First entry is first person who reacted.
}

Reaction represents a single reaction, backed by 1 or more users.

type Service Uses

type Service interface {
    // List all reactions at uri. Map key is reactable ID.
    // uri is clean '/'-separated URI. E.g., "example.com/page".
    // If uri isn't a valid reactable URI, a not exist error is returned.
    List(ctx context.Context, uri string) (map[string][]Reaction, error)

    // Get reactions for id at uri.
    // uri is clean '/'-separated URI. E.g., "example.com/page".
    // If uri/id doesn't point at a valid reactable target,
    // a not exist error is returned.
    Get(ctx context.Context, uri string, id string) ([]Reaction, error)

    // Toggle a reaction for id at uri.
    // If uri/id doesn't point at a valid reactable target,
    // a not exist error is returned.
    Toggle(ctx context.Context, uri string, id string, tr ToggleRequest) ([]Reaction, error)
}

Service defines methods of a reactions service.

type ToggleRequest Uses

type ToggleRequest struct {
    Reaction EmojiID
}

ToggleRequest is a request to toggle a reaction.

func (ToggleRequest) Validate Uses

func (ToggleRequest) Validate() error

Validate returns non-nil error if the request is invalid.

Directories

PathSynopsis
componentPackage component contains individual components that can render themselves as HTML.
emojisPackage emojis contains emojis image data.
fsPackage fs implements reactions.Service using a virtual filesystem.
mousemoveclickmousemoveclick is a script to demonstrate a peculiar browser behavior on iOS.

Package reactions imports 2 packages (graph) and is imported by 17 packages. Updated 2017-09-26. Refresh now. Tools for package owners.