reactions: Index | Examples | Files | Directories

package reactions

import ""

Package reactions provides a reactions service definition.


package main

import (

/*func TestMapping(t *testing.T) {
	tests := []string{
		"32.5% 55%",
		"32.5% 42.5%",
	for _, test := range tests {

func main() {
    in := "32.5% 55%"
    want := []string{"32.5%", "55%"}
    got := bar(in)

    fmt.Println(reflect.DeepEqual(got, want))


func bar(in string) []string {
    return strings.Fields(in)

/*func ExampleBaz() {
	in := "32.5%"
	want := 13
	got := baz(in)

	fmt.Println(reflect.DeepEqual(got, want))

	// Output: true



Package Files

doc.go reactions.go service.go


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


func Position Uses

func Position(emojiID string) string

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., "".
    // 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., "".
    // 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.


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 14 packages. Updated 2017-03-20. Refresh now. Tools for package owners.