<commit_before>// Package goldie provides test assertions based on golden files. It's typically
// used for testing responses with larger data bodies.
//
// The concept is straight forward. Valid response data is stored in a "golden
// file". The actual response data will be byte compared with the golden file
// and the test will fail if there is a difference.
//
// Updating the golden file can be done by running `go test -update ./...`.
package goldie

import (
	"bytes"
	"flag"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"
)

var (
	// FixtureDir is the folder name for where the fixtures are stored. It's
	// relative to the "go test" path.
	FixtureDir = "fixtures"

	// FileNameSuffix is the suffix appended to the fixtures. Set to empty
	// string to disable file name suffixes.
	FileNameSuffix = ".golden"

	// FlagName is the name of the command line flag for go test.
	FlagName = "update"

	// update determines if the actual received data should be written to the
	// golden files or not. This should be true when you need to update the
	// data, but false when actually running the tests.
	update = flag.Bool(FlagName, false, "Update golden test file fixture")
)

// Assert compares the actual data received with the expected data in the
// golden files. If the update flag is set, it will also update the golden
// file.
func Assert(t *testing.T, name string, actualData []byte) {
	goldenFilePath := filepath.Join(
		FixtureDir,
		fmt.Sprintf("%s%s", name, FileNameSuffix))

	if *update {
		err := ensureBasePath()
		if err != nil {
			t.Error(err)
			t.FailNow()
		}

		err := ioutil.WriteFile(goldenFilePath, actualData, 0644)
		if err != nil {
			t.Error(err)
			t.FailNow()
		}
	}

	expectedData, err := ioutil.ReadFile(goldenFilePath)
	if err != nil {
		if os.IsNotExist(err) {
			t.Error("Golden fixture not found. Try running with -update flag.")
			t.FailNow()
		} else {
			t.Errorf("Expected %s to be nil", err.Error())
		}
	}

	if !bytes.Equal(actualData, expectedData) {
		t.Errorf("Result did not match the golden file")
	}
}

// ensureBasePath will create the fixture folder if it does not already exist.
func ensureBasePath() error {
	_, err := os.Stat(FixtureDir)
	if err == nil {
		return nil
	}

	if os.IsNotExist(err) {
		err = os.Mkdir(FixtureDir, 0755)
		if err != nil {
			return err
		}
	}

	return err
}
<commit_msg>Update parameter docs for name<commit_after>// Package goldie provides test assertions based on golden files. It's typically
// used for testing responses with larger data bodies.
//
// The concept is straight forward. Valid response data is stored in a "golden
// file". The actual response data will be byte compared with the golden file
// and the test will fail if there is a difference.
//
// Updating the golden file can be done by running `go test -update ./...`.
package goldie

import (
	"bytes"
	"flag"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"testing"
)

var (
	// FixtureDir is the folder name for where the fixtures are stored. It's
	// relative to the "go test" path.
	FixtureDir = "fixtures"

	// FileNameSuffix is the suffix appended to the fixtures. Set to empty
	// string to disable file name suffixes.
	FileNameSuffix = ".golden"

	// FlagName is the name of the command line flag for go test.
	FlagName = "update"

	// update determines if the actual received data should be written to the
	// golden files or not. This should be true when you need to update the
	// data, but false when actually running the tests.
	update = flag.Bool(FlagName, false, "Update golden test file fixture")
)

// Assert compares the actual data received with the expected data in the
// golden files. If the update flag is set, it will also update the golden
// file.
//
// `name` refers to the name of the test and it should typically be unique
// withing the package. Also it should be a valid file name (so keeping to
// `a-z0-9\-\_` is a good idea.
func Assert(t *testing.T, name string, actualData []byte) {
	goldenFilePath := filepath.Join(
		FixtureDir,
		fmt.Sprintf("%s%s", name, FileNameSuffix))

	if *update {
		err := ensureBasePath()
		if err != nil {
			t.Error(err)
			t.FailNow()
		}

		err := ioutil.WriteFile(goldenFilePath, actualData, 0644)
		if err != nil {
			t.Error(err)
			t.FailNow()
		}
	}

	expectedData, err := ioutil.ReadFile(goldenFilePath)
	if err != nil {
		if os.IsNotExist(err) {
			t.Error("Golden fixture not found. Try running with -update flag.")
			t.FailNow()
		} else {
			t.Errorf("Expected %s to be nil", err.Error())
		}
	}

	if !bytes.Equal(actualData, expectedData) {
		t.Errorf("Result did not match the golden file")
	}
}

// ensureBasePath will create the fixture folder if it does not already exist.
func ensureBasePath() error {
	_, err := os.Stat(FixtureDir)
	if err == nil {
		return nil
	}

	if os.IsNotExist(err) {
		err = os.Mkdir(FixtureDir, 0755)
		if err != nil {
			return err
		}
	}

	return err
}
<|endoftext|>


<commit_before>package gomake

import (
	"sort"

	"github.com/hinshun/gomake/pkg/cli"
)

const (
	// Version is the current version of gomake.
	Version = "0.1.0"
)

// Gomake creates a cli app for the given Gomakefile.
func Gomake(gomakefile *Gomakefile) *cli.App {
	app := &cli.App{
		Name:    "gomake",
		Usage:   "Makefile for gophers",
		Version: Version,
		Action: func(ctx *cli.Context) error {
			_, ok := gomakefile.Targets[""]
			if !ok {
				return nil
			}

			results := gomakefile.Make("")
			return HandleResults(results)
		},
	}

	for gomakeTarget, rule := range gomakefile.Targets {
		// Skip default
		if gomakeTarget == "" {
			continue
		}

		// Create closure around target for command
		target := gomakeTarget
		command := &cli.Command{
			Name:        target,
			Description: rule.Description,
			Action: func(ctx *cli.Context) error {
				results := gomakefile.Make(target)
				return HandleResults(results)
			},
		}

		app.Commands = append(app.Commands, command)
	}

	sort.Sort(app.Commands)
	return app
}
<commit_msg>Update package documentation<commit_after>/*
Package gomake provides a makefile-like syntax to define rules and their
dependencies.

gomake is designed to be imported and used to create a main package with rules
to make your program. We can start off by writing a Gomakefile that will build
itself:

	package main

	import (
		"fmt"
		"os"
		"os/exec"

		"github.com/hinshun/gomake"
	)

	func main() {
		gomakefile := gomake.NewGomakefile()

		gomakeItself := gomakefile.AddRule("gomake", "Builds gomake", nil, func() error {
			build := exec.Command("go", "build")
			build.Stdout = os.Stdout
			build.Stderr = os.Stderr

			return build.Run()
		})

		// Sets the default target
		gomakefile.Targets[""] = gomakeItself

		err := gomake.Gomake(gomakefile).Run(os.Args)
		if err != nil {
			fmt.Println(err)
			os.Exit(-1)
		}
	}
*/
package gomake

import (
	"sort"

	"github.com/hinshun/gomake/pkg/cli"
)

const (
	// Version is the current version of gomake.
	Version = "0.1.0"
)

// Gomake creates a cli app for the given Gomakefile.
func Gomake(gomakefile *Gomakefile) *cli.App {
	app := &cli.App{
		Name:    "gomake",
		Usage:   "Makefile for gophers",
		Version: Version,
		Action: func(ctx *cli.Context) error {
			_, ok := gomakefile.Targets[""]
			if !ok {
				return nil
			}

			results := gomakefile.Make("")
			return HandleResults(results)
		},
	}

	for gomakeTarget, rule := range gomakefile.Targets {
		// Skip default
		if gomakeTarget == "" {
			continue
		}

		// Create closure around target for command
		target := gomakeTarget
		command := &cli.Command{
			Name:        target,
			Description: rule.Description,
			Action: func(ctx *cli.Context) error {
				results := gomakefile.Make(target)
				return HandleResults(results)
			},
		}

		app.Commands = append(app.Commands, command)
	}

	sort.Sort(app.Commands)
	return app
}
<|endoftext|>


<commit_before>package main

import  (
        "fmt"
        "github.com/spf13/cobra"
        "github.com/rakyll/globalconf"
        "flag"
)

func main() {

        conf, _ := globalconf.New("gonoter")

        var flagNotedir = flag.String("dir", "", "Location of the note.txt directory.")
        var dir string

        var cmdAdd = &cobra.Command{
            Use:   "add [title] [category]",
            Short: "Add a note.",
            Long:  `Add a note into a category.`,
            Run: func(cmd *cobra.Command, args []string) {
                if len(args) < 1 {
                        fmt.Println("I need something to add")
                        return
                }
            },
        }

        var cmdList = &cobra.Command{
            Use:   "list",
            Short: "List notes.",
            Long:  `List all valid note files in the directory.`,
            Run: func(cmd *cobra.Command, args []string) {
            },
        }

        var GonoterCmd = &cobra.Command{
            Use:   "gonoter",
            Short: "gonoter is a go implementation of note.txt specification.",
            Long: `A small, fast and fun implementation of note.txt`,
            Run: func(cmd *cobra.Command, args []string) {
            },
        }

        GonoterCmd.PersistentFlags().StringVarP(&dir, "directory", "", "",
                                     "Location of the note.txt directory.")

        if dir == "" {
                if *flagNotedir == "" {
                        dir = "~/notes"
                } else {
                        dir = *flagNotedir
                }
        }
        conf.ParseAll()

        GonoterCmd.AddCommand(cmdAdd)
        GonoterCmd.AddCommand(cmdList)
        GonoterCmd.Execute()
}
<commit_msg>Updated to use tags<commit_after>package main

import  (
        "fmt"
        "github.com/spf13/cobra"
        "github.com/rakyll/globalconf"
        "flag"
)

func main() {

        conf, _ := globalconf.New("gonoter")

        var flagNotedir = flag.String("dir", "", "Location of the note.txt directory.")
        var dir string

        var cmdAdd = &cobra.Command{
            Use:   "add [title] [tag]",
            Short: "Add a note.",
            Long:  `Add a note and tag it.`,
            Run: func(cmd *cobra.Command, args []string) {
                if len(args) < 1 {
                        fmt.Println("I need something to add")
                        return
                }
            },
        }

        var cmdList = &cobra.Command{
            Use:   "list",
            Short: "List notes.",
            Long:  `List all valid note files in the directory.`,
            Run: func(cmd *cobra.Command, args []string) {
            },
        }

        var GonoterCmd = &cobra.Command{
            Use:   "gonoter",
            Short: "gonoter is a go implementation of note.txt specification.",
            Long: `A small, fast and fun implementation of note.txt`,
            Run: func(cmd *cobra.Command, args []string) {
            },
        }

        GonoterCmd.PersistentFlags().StringVarP(&dir, "directory", "", "",
                                     "Location of the note.txt directory.")

        if dir == "" {
                if *flagNotedir == "" {
                        dir = "~/notes"
                } else {
                        dir = *flagNotedir
                }
        }
        conf.ParseAll()

        GonoterCmd.AddCommand(cmdAdd)
        GonoterCmd.AddCommand(cmdList)
        GonoterCmd.Execute()
}
<|endoftext|>


<commit_before>package auth

import (
	"github.com/happierall/l"
	soso "github.com/happierall/soso-server"
	"golang.org/x/oauth2"
	googleConf "golang.org/x/oauth2/google"
	"google.golang.org/api/plus/v1"
)

// scopes: email
func UseGoogleAuth(
	auth *Auth,
	clientID, clientSecret string, scopes []string, redirectURL string) *googleAuth {

	g := &googleAuth{}

	g.Name = "google"
	g.Auth = auth
	g.ClientID = clientID
	g.ClientSecret = clientSecret
	g.Scopes = scopes

	if redirectURL != "" {
		// RedirectURL = "http://localhost:4000/oauth/callback/github"
		g.RedirectURL = redirectURL + "/oauth/callback/" + g.Name
	}

	g.Sessions = soso.NewSessionList()

	g.CallbackHandler = g.callbackGoogle
	g.Endpoint = googleConf.Endpoint

	defer g.Handle()
	return g
}

type googleAuth struct {
	Base
}

func (g *googleAuth) callbackGoogle(session soso.Session) {

	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: g.Token.AccessToken},
	)
	client := oauth2.NewClient(oauth2.NoContext, ts)

	service, err := plus.New(client)
	if err != nil {
		l.Error(err, "Create Plus Client", 500)
		return
	}

	people := service.People.Get("me")
	data, err := people.Do()
	if err != nil {
		l.Error(err)
		return
	}

	user := User{}

	user.GoogleID = data.Id
	user.Name = data.DisplayName

	for _, e := range data.Emails {
		if e.Type == "account" {
			user.Email = e.Value
		}
	}

	g.registerUser(user, session)
}
<commit_msg>update google name<commit_after>package auth

import (
	"strings"

	"github.com/happierall/l"
	soso "github.com/happierall/soso-server"
	"golang.org/x/oauth2"
	googleConf "golang.org/x/oauth2/google"
	"google.golang.org/api/plus/v1"
)

// scopes: email
func UseGoogleAuth(
	auth *Auth,
	clientID, clientSecret string, scopes []string, redirectURL string) *googleAuth {

	g := &googleAuth{}

	g.Name = "google"
	g.Auth = auth
	g.ClientID = clientID
	g.ClientSecret = clientSecret
	g.Scopes = scopes

	if redirectURL != "" {
		// RedirectURL = "http://localhost:4000/oauth/callback/github"
		g.RedirectURL = redirectURL + "/oauth/callback/" + g.Name
	}

	g.Sessions = soso.NewSessionList()

	g.CallbackHandler = g.callbackGoogle
	g.Endpoint = googleConf.Endpoint

	defer g.Handle()
	return g
}

type googleAuth struct {
	Base
}

func (g *googleAuth) callbackGoogle(session soso.Session) {

	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: g.Token.AccessToken},
	)
	client := oauth2.NewClient(oauth2.NoContext, ts)

	service, err := plus.New(client)
	if err != nil {
		l.Error(err, "Create Plus Client", 500)
		return
	}

	people := service.People.Get("me")
	data, err := people.Do()
	if err != nil {
		l.Error(err)
		return
	}

	user := User{}

	user.GoogleID = data.Id

	if data.DisplayName != "" {
		user.Name = data.DisplayName
	} else if data.Name.GivenName != "" || data.Name.FamilyName != "" {
		user.Name = strings.Join([]string{data.Name.GivenName, data.Name.FamilyName}, " ")
	} else if data.Nickname != "" {
		user.Name = data.Nickname
	} else {
		user.Name = data.Id
	}

	for _, e := range data.Emails {
		if e.Type == "account" {
			user.Email = e.Value
		}
	}

	g.registerUser(user, session)
}
<|endoftext|>


<commit_before>package tgbotapi

import (
	"encoding/json"
)

// APIResponse is a response from the Telegram API with the result stored raw.
type APIResponse struct {
	Ok          bool            `json:"ok"`
	Result      json.RawMessage `json:"result"`
	ErrorCode   int             `json:"error_code"`
	Description string          `json:"description"`
}

// Update is an update response, from GetUpdates.
type Update struct {
	UpdateID int     `json:"update_id"`
	Message  Message `json:"message"`
}

// User is a user, contained in Message and returned by GetSelf.
type User struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
}

// String displays a simple text version of a user.
// It is normally a user's username,
// but falls back to a first/last name as available.
func (u *User) String() string {
	if u.UserName != "" {
		return u.UserName
	}

	name := u.FirstName
	if u.LastName != "" {
		name += " " + u.LastName
	}

	return name
}

// GroupChat is a group chat, and not currently in use.
type GroupChat struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

// UserOrGroupChat is returned in Message, because it's not clear which it is.
type UserOrGroupChat struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
	Title     string `json:"title"`
}

// Message is returned by almost every request, and contains data about almost anything.
type Message struct {
	MessageID           int             `json:"message_id"`
	From                User            `json:"from"`
	Date                int             `json:"date"`
	Chat                UserOrGroupChat `json:"chat"`
	ForwardFrom         User            `json:"forward_from"`
	ForwardDate         int             `json:"forward_date"`
	ReplyToMessage      *Message        `json:"reply_to_message"`
	Text                string          `json:"text"`
	Audio               Audio           `json:"audio"`
	Document            Document        `json:"document"`
	Photo               []PhotoSize     `json:"photo"`
	Sticker             Sticker         `json:"sticker"`
	Video               Video           `json:"video"`
	Contact             Contact         `json:"contact"`
	Location            Location        `json:"location"`
	NewChatParticipant  User            `json:"new_chat_participant"`
	LeftChatParticipant User            `json:"left_chat_participant"`
	NewChatTitle        string          `json:"new_chat_title"`
	NewChatPhoto        string          `json:"new_chat_photo"`
	DeleteChatPhoto     bool            `json:"delete_chat_photo"`
	GroupChatCreated    bool            `json:"group_chat_created"`
}

// PhotoSize contains information about photos, including ID and Width and Height.
type PhotoSize struct {
	FileID   string `json:"file_id"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	FileSize int    `json:"file_size"`
}

// Audio contains information about audio, including ID and Duration.
type Audio struct {
	FileID   string `json:"file_id"`
	Duration int    `json:"duration"`
	MimeType string `json:"mime_type"`
	FileSize int    `json:"file_size"`
}

// Document contains information about a document, including ID and a Thumbnail.
type Document struct {
	FileID    string    `json:"file_id"`
	Thumbnail PhotoSize `json:"thumb"`
	FileName  string    `json:"file_name"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
}

// Sticker contains information about a sticker, including ID and Thumbnail.
type Sticker struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Thumbnail PhotoSize `json:"thumb"`
	FileSize  int       `json:"file_size"`
}

// Video contains information about a video, including ID and duration and Thumbnail.
type Video struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Duration  int       `json:"duration"`
	Thumbnail PhotoSize `json:"thumb"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
	Caption   string    `json:"caption"`
}

// Contact contains information about a contact, such as PhoneNumber and UserId.
type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	UserID      string `json:"user_id"`
}

// Location contains information about a place, such as Longitude and Latitude.
type Location struct {
	Longitude float32 `json:"longitude"`
	Latitude  float32 `json:"latitude"`
}

// UserProfilePhotos contains information a set of user profile photos.
type UserProfilePhotos struct {
	TotalCount int         `json:"total_count"`
	Photos     []PhotoSize `json:"photos"`
}

// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
type ReplyKeyboardMarkup struct {
	Keyboard        [][]string `json:"keyboard"`
	ResizeKeyboard  bool       `json:"resize_keyboard"`
	OneTimeKeyboard bool       `json:"one_time_keyboard"`
	Selective       bool       `json:"selective"`
}

// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
type ReplyKeyboardHide struct {
	HideKeyboard bool `json:"hide_keyboard"`
	Selective    bool `json:"selective"`
}

// ForceReply allows the Bot to have users directly reply to it without additional interaction.
type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective"`
}
<commit_msg>helper functions on message<commit_after>package tgbotapi

import (
	"encoding/json"
	"time"
)

// APIResponse is a response from the Telegram API with the result stored raw.
type APIResponse struct {
	Ok          bool            `json:"ok"`
	Result      json.RawMessage `json:"result"`
	ErrorCode   int             `json:"error_code"`
	Description string          `json:"description"`
}

// Update is an update response, from GetUpdates.
type Update struct {
	UpdateID int     `json:"update_id"`
	Message  Message `json:"message"`
}

// User is a user, contained in Message and returned by GetSelf.
type User struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
}

// String displays a simple text version of a user.
// It is normally a user's username,
// but falls back to a first/last name as available.
func (u *User) String() string {
	if u.UserName != "" {
		return u.UserName
	}

	name := u.FirstName
	if u.LastName != "" {
		name += " " + u.LastName
	}

	return name
}

// GroupChat is a group chat, and not currently in use.
type GroupChat struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

// UserOrGroupChat is returned in Message, because it's not clear which it is.
type UserOrGroupChat struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
	Title     string `json:"title"`
}

// Message is returned by almost every request, and contains data about almost anything.
type Message struct {
	MessageID           int             `json:"message_id"`
	From                User            `json:"from"`
	Date                int             `json:"date"`
	Chat                UserOrGroupChat `json:"chat"`
	ForwardFrom         User            `json:"forward_from"`
	ForwardDate         int             `json:"forward_date"`
	ReplyToMessage      *Message        `json:"reply_to_message"`
	Text                string          `json:"text"`
	Audio               Audio           `json:"audio"`
	Document            Document        `json:"document"`
	Photo               []PhotoSize     `json:"photo"`
	Sticker             Sticker         `json:"sticker"`
	Video               Video           `json:"video"`
	Contact             Contact         `json:"contact"`
	Location            Location        `json:"location"`
	NewChatParticipant  User            `json:"new_chat_participant"`
	LeftChatParticipant User            `json:"left_chat_participant"`
	NewChatTitle        string          `json:"new_chat_title"`
	NewChatPhoto        string          `json:"new_chat_photo"`
	DeleteChatPhoto     bool            `json:"delete_chat_photo"`
	GroupChatCreated    bool            `json:"group_chat_created"`
}

// Time converts the message timestamp into a Time.
func (m *Message) Time() time.Time {
	return time.Unix(int64(m.Date), 0)
}

// IsGroup returns if the message was sent to a group.
func (m *Message) IsGroup() bool {
	return m.From.ID != m.Chat.ID
}

// PhotoSize contains information about photos, including ID and Width and Height.
type PhotoSize struct {
	FileID   string `json:"file_id"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	FileSize int    `json:"file_size"`
}

// Audio contains information about audio, including ID and Duration.
type Audio struct {
	FileID   string `json:"file_id"`
	Duration int    `json:"duration"`
	MimeType string `json:"mime_type"`
	FileSize int    `json:"file_size"`
}

// Document contains information about a document, including ID and a Thumbnail.
type Document struct {
	FileID    string    `json:"file_id"`
	Thumbnail PhotoSize `json:"thumb"`
	FileName  string    `json:"file_name"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
}

// Sticker contains information about a sticker, including ID and Thumbnail.
type Sticker struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Thumbnail PhotoSize `json:"thumb"`
	FileSize  int       `json:"file_size"`
}

// Video contains information about a video, including ID and duration and Thumbnail.
type Video struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Duration  int       `json:"duration"`
	Thumbnail PhotoSize `json:"thumb"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
	Caption   string    `json:"caption"`
}

// Contact contains information about a contact, such as PhoneNumber and UserId.
type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	UserID      string `json:"user_id"`
}

// Location contains information about a place, such as Longitude and Latitude.
type Location struct {
	Longitude float32 `json:"longitude"`
	Latitude  float32 `json:"latitude"`
}

// UserProfilePhotos contains information a set of user profile photos.
type UserProfilePhotos struct {
	TotalCount int         `json:"total_count"`
	Photos     []PhotoSize `json:"photos"`
}

// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
type ReplyKeyboardMarkup struct {
	Keyboard        [][]string `json:"keyboard"`
	ResizeKeyboard  bool       `json:"resize_keyboard"`
	OneTimeKeyboard bool       `json:"one_time_keyboard"`
	Selective       bool       `json:"selective"`
}

// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
type ReplyKeyboardHide struct {
	HideKeyboard bool `json:"hide_keyboard"`
	Selective    bool `json:"selective"`
}

// ForceReply allows the Bot to have users directly reply to it without additional interaction.
type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective"`
}
<|endoftext|>


<commit_before>package tgbotapi

import (
	"encoding/json"
	"fmt"
	"time"
)

// APIResponse is a response from the Telegram API with the result stored raw.
type APIResponse struct {
	Ok          bool            `json:"ok"`
	Result      json.RawMessage `json:"result"`
	ErrorCode   int             `json:"error_code"`
	Description string          `json:"description"`
}

// Update is an update response, from GetUpdates.
type Update struct {
	UpdateID int     `json:"update_id"`
	Message  Message `json:"message"`
}

// User is a user, contained in Message and returned by GetSelf.
type User struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
}

// String displays a simple text version of a user.
// It is normally a user's username,
// but falls back to a first/last name as available.
func (u *User) String() string {
	if u.UserName != "" {
		return u.UserName
	}

	name := u.FirstName
	if u.LastName != "" {
		name += " " + u.LastName
	}

	return name
}

// GroupChat is a group chat, and not currently in use.
type GroupChat struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

// UserOrGroupChat is returned in Message, because it's not clear which it is.
type UserOrGroupChat struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
	Title     string `json:"title"`
}

// Message is returned by almost every request, and contains data about almost anything.
type Message struct {
	MessageID           int             `json:"message_id"`
	From                User            `json:"from"`
	Date                int             `json:"date"`
	Chat                UserOrGroupChat `json:"chat"`
	ForwardFrom         User            `json:"forward_from"`
	ForwardDate         int             `json:"forward_date"`
	ReplyToMessage      *Message        `json:"reply_to_message"`
	Text                string          `json:"text"`
	Audio               Audio           `json:"audio"`
	Document            Document        `json:"document"`
	Photo               []PhotoSize     `json:"photo"`
	Sticker             Sticker         `json:"sticker"`
	Video               Video           `json:"video"`
	Voice               Voice           `json:"voice"`
	Caption             string          `json:"caption"`
	Contact             Contact         `json:"contact"`
	Location            Location        `json:"location"`
	NewChatParticipant  User            `json:"new_chat_participant"`
	LeftChatParticipant User            `json:"left_chat_participant"`
	NewChatTitle        string          `json:"new_chat_title"`
	NewChatPhoto        []PhotoSize     `json:"new_chat_photo"`
	DeleteChatPhoto     bool            `json:"delete_chat_photo"`
	GroupChatCreated    bool            `json:"group_chat_created"`
}

// Time converts the message timestamp into a Time.
func (m *Message) Time() time.Time {
	return time.Unix(int64(m.Date), 0)
}

// IsGroup returns if the message was sent to a group.
func (m *Message) IsGroup() bool {
	return m.From.ID != m.Chat.ID
}

// PhotoSize contains information about photos, including ID and Width and Height.
type PhotoSize struct {
	FileID   string `json:"file_id"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	FileSize int    `json:"file_size"`
}

// Audio contains information about audio,
// including ID, Duration, Performer and Title.
type Audio struct {
	FileID    string `json:"file_id"`
	Duration  int    `json:"duration"`
	Performer string `json:"performer"`
	Title     string `json:"title"`
	MimeType  string `json:"mime_type"`
	FileSize  int    `json:"file_size"`
}

// Document contains information about a document, including ID and a Thumbnail.
type Document struct {
	FileID    string    `json:"file_id"`
	Thumbnail PhotoSize `json:"thumb"`
	FileName  string    `json:"file_name"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
}

// Sticker contains information about a sticker, including ID and Thumbnail.
type Sticker struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Thumbnail PhotoSize `json:"thumb"`
	FileSize  int       `json:"file_size"`
}

// Video contains information about a video, including ID and duration and Thumbnail.
type Video struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Duration  int       `json:"duration"`
	Thumbnail PhotoSize `json:"thumb"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
}

// Voice contains information about a voice, including ID and duration.
type Voice struct {
	FileID   string `json:"file_id"`
	Duration int    `json:"duration"`
	MimeType string `json:"mime_type"`
	FileSize int    `json:"file_size"`
}

// Contact contains information about a contact, such as PhoneNumber and UserId.
type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	UserID      int    `json:"user_id"`
}

// Location contains information about a place, such as Longitude and Latitude.
type Location struct {
	Longitude float32 `json:"longitude"`
	Latitude  float32 `json:"latitude"`
}

// UserProfilePhotos contains information a set of user profile photos.
type UserProfilePhotos struct {
	TotalCount int         `json:"total_count"`
	Photos     []PhotoSize `json:"photos"`
}

// File contains information about a file to download from Telegram
type File struct {
	FileID   string `json:"file_id"`
	FileSize int    `json:"file_size"`
	FilePath string `json:"file_path"`
}

// Link returns a full path to the download URL for a File.
//
// It requires the Bot Token to create the link.
func (f *File) Link(token string) string {
	return fmt.Sprintf(FileEndpoint, token, f.FilePath)
}

// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
type ReplyKeyboardMarkup struct {
	Keyboard        [][]string `json:"keyboard"`
	ResizeKeyboard  bool       `json:"resize_keyboard"`
	OneTimeKeyboard bool       `json:"one_time_keyboard"`
	Selective       bool       `json:"selective"`
}

// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
type ReplyKeyboardHide struct {
	HideKeyboard bool `json:"hide_keyboard"`
	Selective    bool `json:"selective"`
}

// ForceReply allows the Bot to have users directly reply to it without additional interaction.
type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective"`
}
<commit_msg>fix broken const<commit_after>package tgbotapi

import (
	"encoding/json"
	"fmt"
	"time"
)

// APIResponse is a response from the Telegram API with the result stored raw.
type APIResponse struct {
	Ok          bool            `json:"ok"`
	Result      json.RawMessage `json:"result"`
	ErrorCode   int             `json:"error_code"`
	Description string          `json:"description"`
}

// Update is an update response, from GetUpdates.
type Update struct {
	UpdateID int     `json:"update_id"`
	Message  Message `json:"message"`
}

// User is a user, contained in Message and returned by GetSelf.
type User struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
}

// String displays a simple text version of a user.
// It is normally a user's username,
// but falls back to a first/last name as available.
func (u *User) String() string {
	if u.UserName != "" {
		return u.UserName
	}

	name := u.FirstName
	if u.LastName != "" {
		name += " " + u.LastName
	}

	return name
}

// GroupChat is a group chat, and not currently in use.
type GroupChat struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

// UserOrGroupChat is returned in Message, because it's not clear which it is.
type UserOrGroupChat struct {
	ID        int    `json:"id"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	UserName  string `json:"username"`
	Title     string `json:"title"`
}

// Message is returned by almost every request, and contains data about almost anything.
type Message struct {
	MessageID           int             `json:"message_id"`
	From                User            `json:"from"`
	Date                int             `json:"date"`
	Chat                UserOrGroupChat `json:"chat"`
	ForwardFrom         User            `json:"forward_from"`
	ForwardDate         int             `json:"forward_date"`
	ReplyToMessage      *Message        `json:"reply_to_message"`
	Text                string          `json:"text"`
	Audio               Audio           `json:"audio"`
	Document            Document        `json:"document"`
	Photo               []PhotoSize     `json:"photo"`
	Sticker             Sticker         `json:"sticker"`
	Video               Video           `json:"video"`
	Voice               Voice           `json:"voice"`
	Caption             string          `json:"caption"`
	Contact             Contact         `json:"contact"`
	Location            Location        `json:"location"`
	NewChatParticipant  User            `json:"new_chat_participant"`
	LeftChatParticipant User            `json:"left_chat_participant"`
	NewChatTitle        string          `json:"new_chat_title"`
	NewChatPhoto        []PhotoSize     `json:"new_chat_photo"`
	DeleteChatPhoto     bool            `json:"delete_chat_photo"`
	GroupChatCreated    bool            `json:"group_chat_created"`
}

// Time converts the message timestamp into a Time.
func (m *Message) Time() time.Time {
	return time.Unix(int64(m.Date), 0)
}

// IsGroup returns if the message was sent to a group.
func (m *Message) IsGroup() bool {
	return m.From.ID != m.Chat.ID
}

// PhotoSize contains information about photos, including ID and Width and Height.
type PhotoSize struct {
	FileID   string `json:"file_id"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	FileSize int    `json:"file_size"`
}

// Audio contains information about audio,
// including ID, Duration, Performer and Title.
type Audio struct {
	FileID    string `json:"file_id"`
	Duration  int    `json:"duration"`
	Performer string `json:"performer"`
	Title     string `json:"title"`
	MimeType  string `json:"mime_type"`
	FileSize  int    `json:"file_size"`
}

// Document contains information about a document, including ID and a Thumbnail.
type Document struct {
	FileID    string    `json:"file_id"`
	Thumbnail PhotoSize `json:"thumb"`
	FileName  string    `json:"file_name"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
}

// Sticker contains information about a sticker, including ID and Thumbnail.
type Sticker struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Thumbnail PhotoSize `json:"thumb"`
	FileSize  int       `json:"file_size"`
}

// Video contains information about a video, including ID and duration and Thumbnail.
type Video struct {
	FileID    string    `json:"file_id"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	Duration  int       `json:"duration"`
	Thumbnail PhotoSize `json:"thumb"`
	MimeType  string    `json:"mime_type"`
	FileSize  int       `json:"file_size"`
}

// Voice contains information about a voice, including ID and duration.
type Voice struct {
	FileID   string `json:"file_id"`
	Duration int    `json:"duration"`
	MimeType string `json:"mime_type"`
	FileSize int    `json:"file_size"`
}

// Contact contains information about a contact, such as PhoneNumber and UserId.
type Contact struct {
	PhoneNumber string `json:"phone_number"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	UserID      int    `json:"user_id"`
}

// Location contains information about a place, such as Longitude and Latitude.
type Location struct {
	Longitude float32 `json:"longitude"`
	Latitude  float32 `json:"latitude"`
}

// UserProfilePhotos contains information a set of user profile photos.
type UserProfilePhotos struct {
	TotalCount int         `json:"total_count"`
	Photos     []PhotoSize `json:"photos"`
}

// File contains information about a file to download from Telegram
type File struct {
	FileID   string `json:"file_id"`
	FileSize int    `json:"file_size"`
	FilePath string `json:"file_path"`
}

// Link returns a full path to the download URL for a File.
//
// It requires the Bot Token to create the link.
func (f *File) Link(token string) string {
	return fmt.Sprintf("https://api.telegram.org/file/bot%s/%s", token, f.FilePath)
}

// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
type ReplyKeyboardMarkup struct {
	Keyboard        [][]string `json:"keyboard"`
	ResizeKeyboard  bool       `json:"resize_keyboard"`
	OneTimeKeyboard bool       `json:"one_time_keyboard"`
	Selective       bool       `json:"selective"`
}

// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
type ReplyKeyboardHide struct {
	HideKeyboard bool `json:"hide_keyboard"`
	Selective    bool `json:"selective"`
}

// ForceReply allows the Bot to have users directly reply to it without additional interaction.
type ForceReply struct {
	ForceReply bool `json:"force_reply"`
	Selective  bool `json:"selective"`
}
<|endoftext|>


<commit_before>// Copyright 2015 bol.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package mesos_metrics

// Counter == int64
// Gauge   == float64

// Metrics from endpoint /{master}:5050/metrics/snapshot
// Mesos version 0.22.1
type MasterMetrics struct {
	CpuPercentage                                    float64 `json:"master/cpus_percent"`
	CpuTotal                                         int64 `json:"master/cpus_total"`
	CpuUsed                                          float64 `json:"master/cpus_used"`
	DiskPercentage                                   float64 `json:"master/disk_percent"`
	DiskTotal                                        int64 `json:"master/disk_total"`
	DiskUsed                                         int64 `json:"master/disk_used"`
	DroppedMessages                                  int64 `json:"master/dropped_messages"`

	Elected                                          int64 `json:"master/elected"`

	EventQueueDispatches                             int64 `json:"master/event_queue_dispatches"`
	EventQueueHttpRequests                           int64 `json:"master/event_queue_http_requests"`
	EventQueueMessages                               int64 `json:"master/event_queue_messages"`

	FrameworksActive                                 int64 `json:"master/frameworks_active"`
	FrameworksConnected                              int64 `json:"master/frameworks_connected"`
	FrameworksDisconnected                           int64 `json:"master/frameworks_disconnected"`
	FrameworksInactive                               int64 `json:"master/frameworks_inactive"`

	InvalidFrameworkToExecutorMessages               int64 `json:"master/invalid_framework_to_executor_messages"`
	InvalidStatusUpdateAcknowledgements              int64 `json:"master/invalid_status_update_acknowledgements"`
	InvalidStatusUpdates                             int64 `json:"master/invalid_status_updates"`

	MemoryPercentage                                 float64 `json:"master/mem_percent"`
	MemoryTotal                                      int64 `json:"master/mem_total"`
	MemoryUsed                                       int64 `json:"master/mem_used"`

	MessagesAuthenticate                             int64 `json:"master/messages_authenticate"`
	MessagesDeactivateFramework                      int64 `json:"master/messages_deactivate_framework"`
	MessagesDeclineOffers                            int64 `json:"master/messages_decline_offers"`
	MessagesExitedExecutor                           int64 `json:"master/messages_exited_executor"`
	MessagesFrameworkToExecutor                      int64 `json:"master/messages_framework_to_executor"`
	MessagesKillTask                                 int64 `json:"master/messages_kill_task"`
	MessagesLaunchTasks                              int64 `json:"master/messages_launch_tasks"`
	MessagesReconcileTasks                           int64 `json:"master/messages_reconcile_tasks"`
	MessagesRegisterFramework                        int64 `json:"master/messages_register_framework"`
	MessagesRegisterSlave                            int64 `json:"master/messages_register_slave"`
	MessagesReregisterFramework                      int64 `json:"master/messages_reregister_framework"`
	MessagesReregisterSlave                          int64 `json:"master/messages_reregister_slave"`
	MessagesResourceRequest                          int64 `json:"master/messages_resource_request"`
	MessagesReviveOffers                             int64 `json:"master/messages_revive_offers"`
	MessagesStatusUpdate                             int64 `json:"master/messages_status_update"`
	MessagesStatusUpdateAcknowledgement              int64 `json:"master/messages_status_update_acknowledgement"`
	MessagesUnregisterFramework                      int64 `json:"master/messages_unregister_framework"`
	MessagesUnregisterSlave                          int64 `json:"master/messages_unregister_slave"`

	OutstandingOffers                                int64 `json:"master/outstanding_offers"`
	RecoverySlaveRemovals                            int64 `json:"master/recovery_slave_removals"`

	SlaveRegistrations                               int64 `json:"master/slave_registrations"`
	SlaveRemovals                                    int64 `json:"master/slave_removals"`
	SlaveReregistrations                             int64 `json:"master/slave_reregistrations"`
	SlaveShutdownsCanceled                           int64 `json:"master/slave_shutdowns_canceled"`
	SlaveShutdownsScheduled                          int64 `json:"master/slave_shutdowns_scheduled"`
	SlavesActive                                     int64 `json:"master/slaves_active"`
	SlavesConnected                                  int64 `json:"master/slaves_connected"`
	SlavesDisconnected                               int64 `json:"master/slaves_disconnected"`
	SlavesInactive                                   int64 `json:"master/slaves_inactive"`

	TaskFailedSourceSlaveReasonCommandExecutorFailed int64 `json:"master/task_failed/source_slave/reason_command_executor_failed"`

	TasksError                                       int64 `json:"master/tasks_error"`
	TasksFailed                                      int64 `json:"master/tasks_failed"`
	TasksFinished                                    int64 `json:"master/tasks_finished"`
	TasksKilled                                      int64 `json:"master/tasks_killed"`
	TasksLost                                        int64 `json:"master/tasks_lost"`
	TasksRunning                                     int64 `json:"master/tasks_running"`
	TasksStaging                                     int64 `json:"master/tasks_staging"`
	TasksStarting                                    int64 `json:"master/tasks_starting"`

	UptimeSecs                                       float64 `json:"master/uptime_secs"`

	ValidFrameworkToExecutorMessages                 int64 `json:"master/valid_framework_to_executor_messages"`
	ValidStatusUpdateAcknowledgements                int64 `json:"master/valid_status_update_acknowledgements"`
	ValidStatusUpdates                               int64 `json:"master/valid_status_updates"`

	RegistrarQueuedOperations                        int64 `json:"registrar/queued_operations"`
	RegistrarSizeBytes                               int64 `json:"registrar/registry_size_bytes"`
	RegistrarStateFetchMilliSecs                     float64 `json:"registrar/state_fetch_ms"`
	RegistrarStateStoreMilliSecs                     float64 `json:"registrar/state_store_ms"`
	RegistrarStateStoreMilliSecsCount                int64 `json:"registrar/state_store_ms/count"`
	RegistrarStateStoreMilliSecsMax                  float64 `json:"registrar/state_store_ms/max"`
	RegistrarStateStoreMilliSecsMin                  float64 `json:"registrar/state_store_ms/min"`
	RegistrarStateStoreMilliSecsP50                  float64 `json:"registrar/state_store_ms/p50"`
	RegistrarStateStoreMilliSecsP90                  float64 `json:"registrar/state_store_ms/p90"`
	RegistrarStateStoreMilliSecsP95                  float64 `json:"registrar/state_store_ms/p95"`
	RegistrarStateStoreMilliSecsP99                  float64 `json:"registrar/state_store_ms/p99"`
	RegistrarStateStoreMilliSecsP999                 float64 `json:"registrar/state_store_ms/p999"`
	RegistrarStateStoreMilliSecsP9999                float64 `json:"registrar/state_store_ms/p9999"`

	SystemCpuTotal                                   int64 `json:"system/cpus_total"`
	SystemLoad15MinuteAvg                            float64 `json:"system/load_15min"`
	SystemLoad1MinuteAvg                             float64 `json:"system/load_1min"`
	SystemLoad5MinuteAvg                             float64 `json:"system/load_5min"`
	SystemMemoryFreeBytes                            int64 `json:"system/mem_free_bytes"`
	SystemMemoryTotalBytes                           int64 `json:"system/mem_total_bytes"`
}

// Metrics from endpoint /{slave}:5051/metrics/snapshot
// Mesos version 0.22.1
type SlaveMetrics struct {
	CpuPercentage            float64 `json:"slave/cpus_percent"`
	CpuTotal                 int64 `json:"slave/cpus_total"`
	CpuUsed                  float64 `json:"slave/cpus_used"`
	DiskPercentage           float64 `json:"slave/disk_percent"`
	DiskTotal                int64 `json:"slave/disk_total"`
	DiskUsed                 int64 `json:"slave/disk_used"`

	ExecutorsRegistering     int64 `json:"slave/executors_registering"`
	ExecutorsRunning         int64 `json:"slave/executors_running"`
	ExecutorsTerminated      int64 `json:"slave/executors_terminated"`
	ExecutorsTerminating     int64 `json:"slave/executors_terminating"`

	FrameworksActive         int64 `json:"slave/frameworks_active"`
	InvalidFrameworkMessages int64 `json:"slave/invalid_framework_messages"`
	InvalidStatusUpdates     int64 `json:"slave/invalid_status_updates"`

	MemoryPercentage         float64 `json:"slave/mem_percent"`
	MemoryTotal              int64 `json:"slave/mem_total"`
	MemoryUsed               int64 `json:"slave/mem_used"`

	RecoveryErrors           int64 `json:"slave/recovery_errors"`
	Registered               int64 `json:"slave/registered"`

	TasksFailed              int64 `json:"slave/tasks_failed"`
	TasksFinished            int64 `json:"slave/tasks_finished"`
	TasksKilled              int64 `json:"slave/tasks_killed"`
	TasksLost                int64 `json:"slave/tasks_lost"`
	TasksRunning             int64 `json:"slave/tasks_running"`
	TasksStaging             int64 `json:"slave/tasks_staging"`
	TasksStarting            int64 `json:"slave/tasks_starting"`

	UptimeSecs               float64 `json:"slave/uptime_secs"`

	ValidFrameworkMessages   int64 `json:"slave/valid_framework_messages"`
	ValidStatusUpdates       int64 `json:"slave/valid_status_updates"`

	SystemCpuTotal           int64 `json:"system/cpus_total"`
	SystemLoad15MinuteAvg    float64 `json:"system/load_15min"`
	SystemLoad1MinuteAvg     float64 `json:"system/load_1min"`
	SystemLoad5MinuteAvg     float64 `json:"system/load_5min"`
	SystemMemoryFreeBytes    int64 `json:"system/mem_free_bytes"`
	SystemMemoryTotalBytes   int64 `json:"system/mem_total_bytes"`
}
<commit_msg>Remove comment on counter and gauge types, as it's incorrect<commit_after>// Copyright 2015 bol.com
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package mesos_metrics

// Metrics from endpoint /{master}:5050/metrics/snapshot
// Mesos version 0.22.1
type MasterMetrics struct {
	CpuPercentage                                    float64 `json:"master/cpus_percent"`
	CpuTotal                                         int64 `json:"master/cpus_total"`
	CpuUsed                                          float64 `json:"master/cpus_used"`
	DiskPercentage                                   float64 `json:"master/disk_percent"`
	DiskTotal                                        int64 `json:"master/disk_total"`
	DiskUsed                                         int64 `json:"master/disk_used"`
	DroppedMessages                                  int64 `json:"master/dropped_messages"`

	Elected                                          int64 `json:"master/elected"`

	EventQueueDispatches                             int64 `json:"master/event_queue_dispatches"`
	EventQueueHttpRequests                           int64 `json:"master/event_queue_http_requests"`
	EventQueueMessages                               int64 `json:"master/event_queue_messages"`

	FrameworksActive                                 int64 `json:"master/frameworks_active"`
	FrameworksConnected                              int64 `json:"master/frameworks_connected"`
	FrameworksDisconnected                           int64 `json:"master/frameworks_disconnected"`
	FrameworksInactive                               int64 `json:"master/frameworks_inactive"`

	InvalidFrameworkToExecutorMessages               int64 `json:"master/invalid_framework_to_executor_messages"`
	InvalidStatusUpdateAcknowledgements              int64 `json:"master/invalid_status_update_acknowledgements"`
	InvalidStatusUpdates                             int64 `json:"master/invalid_status_updates"`

	MemoryPercentage                                 float64 `json:"master/mem_percent"`
	MemoryTotal                                      int64 `json:"master/mem_total"`
	MemoryUsed                                       int64 `json:"master/mem_used"`

	MessagesAuthenticate                             int64 `json:"master/messages_authenticate"`
	MessagesDeactivateFramework                      int64 `json:"master/messages_deactivate_framework"`
	MessagesDeclineOffers                            int64 `json:"master/messages_decline_offers"`
	MessagesExitedExecutor                           int64 `json:"master/messages_exited_executor"`
	MessagesFrameworkToExecutor                      int64 `json:"master/messages_framework_to_executor"`
	MessagesKillTask                                 int64 `json:"master/messages_kill_task"`
	MessagesLaunchTasks                              int64 `json:"master/messages_launch_tasks"`
	MessagesReconcileTasks                           int64 `json:"master/messages_reconcile_tasks"`
	MessagesRegisterFramework                        int64 `json:"master/messages_register_framework"`
	MessagesRegisterSlave                            int64 `json:"master/messages_register_slave"`
	MessagesReregisterFramework                      int64 `json:"master/messages_reregister_framework"`
	MessagesReregisterSlave                          int64 `json:"master/messages_reregister_slave"`
	MessagesResourceRequest                          int64 `json:"master/messages_resource_request"`
	MessagesReviveOffers                             int64 `json:"master/messages_revive_offers"`
	MessagesStatusUpdate                             int64 `json:"master/messages_status_update"`
	MessagesStatusUpdateAcknowledgement              int64 `json:"master/messages_status_update_acknowledgement"`
	MessagesUnregisterFramework                      int64 `json:"master/messages_unregister_framework"`
	MessagesUnregisterSlave                          int64 `json:"master/messages_unregister_slave"`

	OutstandingOffers                                int64 `json:"master/outstanding_offers"`
	RecoverySlaveRemovals                            int64 `json:"master/recovery_slave_removals"`

	SlaveRegistrations                               int64 `json:"master/slave_registrations"`
	SlaveRemovals                                    int64 `json:"master/slave_removals"`
	SlaveReregistrations                             int64 `json:"master/slave_reregistrations"`
	SlaveShutdownsCanceled                           int64 `json:"master/slave_shutdowns_canceled"`
	SlaveShutdownsScheduled                          int64 `json:"master/slave_shutdowns_scheduled"`
	SlavesActive                                     int64 `json:"master/slaves_active"`
	SlavesConnected                                  int64 `json:"master/slaves_connected"`
	SlavesDisconnected                               int64 `json:"master/slaves_disconnected"`
	SlavesInactive                                   int64 `json:"master/slaves_inactive"`

	TaskFailedSourceSlaveReasonCommandExecutorFailed int64 `json:"master/task_failed/source_slave/reason_command_executor_failed"`

	TasksError                                       int64 `json:"master/tasks_error"`
	TasksFailed                                      int64 `json:"master/tasks_failed"`
	TasksFinished                                    int64 `json:"master/tasks_finished"`
	TasksKilled                                      int64 `json:"master/tasks_killed"`
	TasksLost                                        int64 `json:"master/tasks_lost"`
	TasksRunning                                     int64 `json:"master/tasks_running"`
	TasksStaging                                     int64 `json:"master/tasks_staging"`
	TasksStarting                                    int64 `json:"master/tasks_starting"`

	UptimeSecs                                       float64 `json:"master/uptime_secs"`

	ValidFrameworkToExecutorMessages                 int64 `json:"master/valid_framework_to_executor_messages"`
	ValidStatusUpdateAcknowledgements                int64 `json:"master/valid_status_update_acknowledgements"`
	ValidStatusUpdates                               int64 `json:"master/valid_status_updates"`

	RegistrarQueuedOperations                        int64 `json:"registrar/queued_operations"`
	RegistrarSizeBytes                               int64 `json:"registrar/registry_size_bytes"`
	RegistrarStateFetchMilliSecs                     float64 `json:"registrar/state_fetch_ms"`
	RegistrarStateStoreMilliSecs                     float64 `json:"registrar/state_store_ms"`
	RegistrarStateStoreMilliSecsCount                int64 `json:"registrar/state_store_ms/count"`
	RegistrarStateStoreMilliSecsMax                  float64 `json:"registrar/state_store_ms/max"`
	RegistrarStateStoreMilliSecsMin                  float64 `json:"registrar/state_store_ms/min"`
	RegistrarStateStoreMilliSecsP50                  float64 `json:"registrar/state_store_ms/p50"`
	RegistrarStateStoreMilliSecsP90                  float64 `json:"registrar/state_store_ms/p90"`
	RegistrarStateStoreMilliSecsP95                  float64 `json:"registrar/state_store_ms/p95"`
	RegistrarStateStoreMilliSecsP99                  float64 `json:"registrar/state_store_ms/p99"`
	RegistrarStateStoreMilliSecsP999                 float64 `json:"registrar/state_store_ms/p999"`
	RegistrarStateStoreMilliSecsP9999                float64 `json:"registrar/state_store_ms/p9999"`

	SystemCpuTotal                                   int64 `json:"system/cpus_total"`
	SystemLoad15MinuteAvg                            float64 `json:"system/load_15min"`
	SystemLoad1MinuteAvg                             float64 `json:"system/load_1min"`
	SystemLoad5MinuteAvg                             float64 `json:"system/load_5min"`
	SystemMemoryFreeBytes                            int64 `json:"system/mem_free_bytes"`
	SystemMemoryTotalBytes                           int64 `json:"system/mem_total_bytes"`
}

// Metrics from endpoint /{slave}:5051/metrics/snapshot
// Mesos version 0.22.1
type SlaveMetrics struct {
	CpuPercentage            float64 `json:"slave/cpus_percent"`
	CpuTotal                 int64 `json:"slave/cpus_total"`
	CpuUsed                  float64 `json:"slave/cpus_used"`
	DiskPercentage           float64 `json:"slave/disk_percent"`
	DiskTotal                int64 `json:"slave/disk_total"`
	DiskUsed                 int64 `json:"slave/disk_used"`

	ExecutorsRegistering     int64 `json:"slave/executors_registering"`
	ExecutorsRunning         int64 `json:"slave/executors_running"`
	ExecutorsTerminated      int64 `json:"slave/executors_terminated"`
	ExecutorsTerminating     int64 `json:"slave/executors_terminating"`

	FrameworksActive         int64 `json:"slave/frameworks_active"`
	InvalidFrameworkMessages int64 `json:"slave/invalid_framework_messages"`
	InvalidStatusUpdates     int64 `json:"slave/invalid_status_updates"`

	MemoryPercentage         float64 `json:"slave/mem_percent"`
	MemoryTotal              int64 `json:"slave/mem_total"`
	MemoryUsed               int64 `json:"slave/mem_used"`

	RecoveryErrors           int64 `json:"slave/recovery_errors"`
	Registered               int64 `json:"slave/registered"`

	TasksFailed              int64 `json:"slave/tasks_failed"`
	TasksFinished            int64 `json:"slave/tasks_finished"`
	TasksKilled              int64 `json:"slave/tasks_killed"`
	TasksLost                int64 `json:"slave/tasks_lost"`
	TasksRunning             int64 `json:"slave/tasks_running"`
	TasksStaging             int64 `json:"slave/tasks_staging"`
	TasksStarting            int64 `json:"slave/tasks_starting"`

	UptimeSecs               float64 `json:"slave/uptime_secs"`

	ValidFrameworkMessages   int64 `json:"slave/valid_framework_messages"`
	ValidStatusUpdates       int64 `json:"slave/valid_status_updates"`

	SystemCpuTotal           int64 `json:"system/cpus_total"`
	SystemLoad15MinuteAvg    float64 `json:"system/load_15min"`
	SystemLoad1MinuteAvg     float64 `json:"system/load_1min"`
	SystemLoad5MinuteAvg     float64 `json:"system/load_5min"`
	SystemMemoryFreeBytes    int64 `json:"system/mem_free_bytes"`
	SystemMemoryTotalBytes   int64 `json:"system/mem_total_bytes"`
}
<|endoftext|>


<commit_before>package dockerclient

import (
	"fmt"
	"io"
	"time"

	"github.com/docker/docker/pkg/units"
)

type ContainerConfig struct {
	Hostname        string
	Domainname      string
	User            string
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	ExposedPorts    map[string]struct{}
	Tty             bool
	OpenStdin       bool
	StdinOnce       bool
	Env             []string
	Cmd             []string
	Image           string
	Volumes         map[string]struct{}
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
	MacAddress      string
	OnBuild         []string
	Labels          map[string]string
	StopSignal      string

	// FIXME: VolumeDriver have been removed since docker 1.9
	VolumeDriver string

	// FIXME: The following fields have been removed since API v1.18
	Memory     int64
	MemorySwap int64
	CpuShares  int64
	Cpuset     string
	PortSpecs  []string

	// This is used only by the create command
	HostConfig HostConfig
}

type HostConfig struct {
	Binds             []string
	ContainerIDFile   string
	LxcConf           []map[string]string
	Memory            int64
	MemoryReservation int64
	MemorySwap        int64
	KernelMemory      int64
	CpuShares         int64
	CpuPeriod         int64
	CpusetCpus        string
	CpusetMems        string
	CpuQuota          int64
	BlkioWeight       int64
	OomKillDisable    bool
	MemorySwappiness  int64
	Privileged        bool
	PortBindings      map[string][]PortBinding
	Links             []string
	PublishAllPorts   bool
	Dns               []string
	DNSOptions        []string
	DnsSearch         []string
	ExtraHosts        []string
	VolumesFrom       []string
	Devices           []DeviceMapping
	NetworkMode       string
	IpcMode           string
	PidMode           string
	UTSMode           string
	CapAdd            []string
	CapDrop           []string
	GroupAdd          []string
	RestartPolicy     RestartPolicy
	SecurityOpt       []string
	ReadonlyRootfs    bool
	Ulimits           []Ulimit
	LogConfig         LogConfig
	CgroupParent      string
	ConsoleSize       [2]int
	VolumeDriver      string
}

type DeviceMapping struct {
	PathOnHost        string `json:"PathOnHost"`
	PathInContainer   string `json:"PathInContainer"`
	CgroupPermissions string `json:"CgroupPermissions"`
}

type ExecConfig struct {
	AttachStdin  bool
	AttachStdout bool
	AttachStderr bool
	Tty          bool
	Cmd          []string
	Container    string
	Detach       bool
}

type LogOptions struct {
	Follow     bool
	Stdout     bool
	Stderr     bool
	Timestamps bool
	Tail       int64
}

type AttachOptions struct {
	Logs   bool
	Stream bool
	Stdin  bool
	Stdout bool
	Stderr bool
}

type MonitorEventsFilters struct {
	Event     string `json:",omitempty"`
	Image     string `json:",omitempty"`
	Container string `json:",omitempty"`
}

type MonitorEventsOptions struct {
	Since   int
	Until   int
	Filters *MonitorEventsFilters `json:",omitempty"`
}

type RestartPolicy struct {
	Name              string
	MaximumRetryCount int64
}

type PortBinding struct {
	HostIp   string
	HostPort string
}

type State struct {
	Running    bool
	Paused     bool
	Restarting bool
	OOMKilled  bool
	Dead       bool
	Pid        int
	ExitCode   int
	Error      string // contains last known error when starting the container
	StartedAt  time.Time
	FinishedAt time.Time
	Ghost      bool
}

// String returns a human-readable description of the state
// Stoken from docker/docker/daemon/state.go
func (s *State) String() string {
	if s.Running {
		if s.Paused {
			return fmt.Sprintf("Up %s (Paused)", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
		}
		if s.Restarting {
			return fmt.Sprintf("Restarting (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt)))
		}

		return fmt.Sprintf("Up %s", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
	}

	if s.Dead {
		return "Dead"
	}

	if s.FinishedAt.IsZero() {
		return ""
	}

	return fmt.Sprintf("Exited (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt)))
}

// StateString returns a single string to describe state
// Stoken from docker/docker/daemon/state.go
func (s *State) StateString() string {
	if s.Running {
		if s.Paused {
			return "paused"
		}
		if s.Restarting {
			return "restarting"
		}
		return "running"
	}

	if s.Dead {
		return "dead"
	}

	return "exited"
}

type ImageInfo struct {
	Architecture    string
	Author          string
	Comment         string
	Config          *ContainerConfig
	Container       string
	ContainerConfig *ContainerConfig
	Created         time.Time
	DockerVersion   string
	Id              string
	Os              string
	Parent          string
	Size            int64
	VirtualSize     int64
}

type ContainerInfo struct {
	Id              string
	Created         string
	Path            string
	Name            string
	Args            []string
	ExecIDs         []string
	Config          *ContainerConfig
	State           *State
	Image           string
	NetworkSettings struct {
		IPAddress   string `json:"IpAddress"`
		IPPrefixLen int    `json:"IpPrefixLen"`
		Gateway     string
		Bridge      string
		Ports       map[string][]PortBinding
	}
	SysInitPath    string
	ResolvConfPath string
	Volumes        map[string]string
	HostConfig     *HostConfig
}

type ContainerChanges struct {
	Path string
	Kind int
}

type Port struct {
	IP          string
	PrivatePort int
	PublicPort  int
	Type        string
}

type Container struct {
	Id         string
	Names      []string
	Image      string
	Command    string
	Created    int64
	Status     string
	Ports      []Port
	SizeRw     int64
	SizeRootFs int64
	Labels     map[string]string
}

type Event struct {
	Id     string
	Status string
	From   string
	Time   int64
}

type Version struct {
	ApiVersion    string
	Arch          string
	GitCommit     string
	GoVersion     string
	KernelVersion string
	Os            string
	Version       string
}

type RespContainersCreate struct {
	Id       string
	Warnings []string
}

type Image struct {
	Created     int64
	Id          string
	Labels      map[string]string
	ParentId    string
	RepoDigests []string
	RepoTags    []string
	Size        int64
	VirtualSize int64
}

// Info is the struct returned by /info
// The API is currently in flux, so Debug, MemoryLimit, SwapLimit, and
// IPv4Forwarding are interfaces because in docker 1.6.1 they are 0 or 1 but in
// master they are bools.
type Info struct {
	ID                 string
	Containers         int64
	Driver             string
	DriverStatus       [][]string
	ExecutionDriver    string
	Images             int64
	KernelVersion      string
	OperatingSystem    string
	NCPU               int64
	MemTotal           int64
	Name               string
	Labels             []string
	Debug              interface{}
	NFd                int64
	NGoroutines        int64
	SystemTime         string
	NEventsListener    int64
	InitPath           string
	InitSha1           string
	IndexServerAddress string
	MemoryLimit        interface{}
	SwapLimit          interface{}
	IPv4Forwarding     interface{}
	BridgeNfIptables   bool
	BridgeNfIp6tables  bool
	DockerRootDir      string
	HttpProxy          string
	HttpsProxy         string
	NoProxy            string
}

type ImageDelete struct {
	Deleted  string
	Untagged string
}

type EventOrError struct {
	Event
	Error error
}

type WaitResult struct {
	ExitCode int
	Error    error
}

type decodingResult struct {
	result interface{}
	err    error
}

// The following are types for the API stats endpoint
type ThrottlingData struct {
	// Number of periods with throttling active
	Periods uint64 `json:"periods"`
	// Number of periods when the container hit its throttling limit.
	ThrottledPeriods uint64 `json:"throttled_periods"`
	// Aggregate time the container was throttled for in nanoseconds.
	ThrottledTime uint64 `json:"throttled_time"`
}

type CpuUsage struct {
	// Total CPU time consumed.
	// Units: nanoseconds.
	TotalUsage uint64 `json:"total_usage"`
	// Total CPU time consumed per core.
	// Units: nanoseconds.
	PercpuUsage []uint64 `json:"percpu_usage"`
	// Time spent by tasks of the cgroup in kernel mode.
	// Units: nanoseconds.
	UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
	// Time spent by tasks of the cgroup in user mode.
	// Units: nanoseconds.
	UsageInUsermode uint64 `json:"usage_in_usermode"`
}

type CpuStats struct {
	CpuUsage       CpuUsage       `json:"cpu_usage"`
	SystemUsage    uint64         `json:"system_cpu_usage"`
	ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
}

type NetworkStats struct {
	RxBytes   uint64 `json:"rx_bytes"`
	RxPackets uint64 `json:"rx_packets"`
	RxErrors  uint64 `json:"rx_errors"`
	RxDropped uint64 `json:"rx_dropped"`
	TxBytes   uint64 `json:"tx_bytes"`
	TxPackets uint64 `json:"tx_packets"`
	TxErrors  uint64 `json:"tx_errors"`
	TxDropped uint64 `json:"tx_dropped"`
}

type MemoryStats struct {
	Usage    uint64            `json:"usage"`
	MaxUsage uint64            `json:"max_usage"`
	Stats    map[string]uint64 `json:"stats"`
	Failcnt  uint64            `json:"failcnt"`
	Limit    uint64            `json:"limit"`
}

type BlkioStatEntry struct {
	Major uint64 `json:"major"`
	Minor uint64 `json:"minor"`
	Op    string `json:"op"`
	Value uint64 `json:"value"`
}

type BlkioStats struct {
	// number of bytes tranferred to and from the block device
	IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"`
	IoServicedRecursive     []BlkioStatEntry `json:"io_serviced_recursive"`
	IoQueuedRecursive       []BlkioStatEntry `json:"io_queue_recursive"`
	IoServiceTimeRecursive  []BlkioStatEntry `json:"io_service_time_recursive"`
	IoWaitTimeRecursive     []BlkioStatEntry `json:"io_wait_time_recursive"`
	IoMergedRecursive       []BlkioStatEntry `json:"io_merged_recursive"`
	IoTimeRecursive         []BlkioStatEntry `json:"io_time_recursive"`
	SectorsRecursive        []BlkioStatEntry `json:"sectors_recursive"`
}

type Stats struct {
	Read         time.Time    `json:"read"`
	NetworkStats NetworkStats `json:"network,omitempty"`
	CpuStats     CpuStats     `json:"cpu_stats,omitempty"`
	MemoryStats  MemoryStats  `json:"memory_stats,omitempty"`
	BlkioStats   BlkioStats   `json:"blkio_stats,omitempty"`
}

type Ulimit struct {
	Name string `json:"name"`
	Soft uint64 `json:"soft"`
	Hard uint64 `json:"hard"`
}

type LogConfig struct {
	Type   string            `json:"type"`
	Config map[string]string `json:"config"`
}

type BuildImage struct {
	Config         *ConfigFile
	DockerfileName string
	Context        io.Reader
	RemoteURL      string
	RepoName       string
	SuppressOutput bool
	NoCache        bool
	Remove         bool
	ForceRemove    bool
	Pull           bool
	Memory         int64
	MemorySwap     int64
	CpuShares      int64
	CpuPeriod      int64
	CpuQuota       int64
	CpuSetCpus     string
	CpuSetMems     string
	CgroupParent   string
	BuildArgs      map[string]string
}

type Volume struct {
	Name       string // Name is the name of the volume
	Driver     string // Driver is the Driver name used to create the volume
	Mountpoint string // Mountpoint is the location on disk of the volume
}

type VolumesListResponse struct {
	Volumes []*Volume // Volumes is the list of volumes being returned
}

type VolumeCreateRequest struct {
	Name       string            // Name is the requested name of the volume
	Driver     string            // Driver is the name of the driver that should be used to create the volume
	DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume.
}

// IPAM represents IP Address Management
type IPAM struct {
	Driver string
	Config []IPAMConfig
}

// IPAMConfig represents IPAM configurations
type IPAMConfig struct {
	Subnet     string            `json:",omitempty"`
	IPRange    string            `json:",omitempty"`
	Gateway    string            `json:",omitempty"`
	AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"`
}

// NetworkResource is the body of the "get network" http response message
type NetworkResource struct {
	Name       string
	ID         string `json:"Id"`
	Scope      string
	Driver     string
	IPAM       IPAM
	Containers map[string]EndpointResource
}

//EndpointResource contains network resources allocated and usd for a container in a network
type EndpointResource struct {
	EndpointID  string
	MacAddress  string
	IPv4Address string
	IPv6Address string
}

// NetworkCreate is the expected body of the "create network" http request message
type NetworkCreate struct {
	Name           string
	CheckDuplicate bool
	Driver         string
	IPAM           IPAM
	Options        map[string]string
}

// NetworkCreateResponse is the response message sent by the server for network create call
type NetworkCreateResponse struct {
	ID      string `json:"Id"`
	Warning string
}

// NetworkConnect represents the data to be used to connect a container to the network
type NetworkConnect struct {
	Container string
}

// NetworkDisconnect represents the data to be used to disconnect a container from the network
type NetworkDisconnect struct {
	Container string
}
<commit_msg>Replace pkg/units with the docker/go-units package<commit_after>package dockerclient

import (
	"fmt"
	"io"
	"time"

	"github.com/docker/go-units"
)

type ContainerConfig struct {
	Hostname        string
	Domainname      string
	User            string
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	ExposedPorts    map[string]struct{}
	Tty             bool
	OpenStdin       bool
	StdinOnce       bool
	Env             []string
	Cmd             []string
	Image           string
	Volumes         map[string]struct{}
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
	MacAddress      string
	OnBuild         []string
	Labels          map[string]string
	StopSignal      string

	// FIXME: VolumeDriver have been removed since docker 1.9
	VolumeDriver string

	// FIXME: The following fields have been removed since API v1.18
	Memory     int64
	MemorySwap int64
	CpuShares  int64
	Cpuset     string
	PortSpecs  []string

	// This is used only by the create command
	HostConfig HostConfig
}

type HostConfig struct {
	Binds             []string
	ContainerIDFile   string
	LxcConf           []map[string]string
	Memory            int64
	MemoryReservation int64
	MemorySwap        int64
	KernelMemory      int64
	CpuShares         int64
	CpuPeriod         int64
	CpusetCpus        string
	CpusetMems        string
	CpuQuota          int64
	BlkioWeight       int64
	OomKillDisable    bool
	MemorySwappiness  int64
	Privileged        bool
	PortBindings      map[string][]PortBinding
	Links             []string
	PublishAllPorts   bool
	Dns               []string
	DNSOptions        []string
	DnsSearch         []string
	ExtraHosts        []string
	VolumesFrom       []string
	Devices           []DeviceMapping
	NetworkMode       string
	IpcMode           string
	PidMode           string
	UTSMode           string
	CapAdd            []string
	CapDrop           []string
	GroupAdd          []string
	RestartPolicy     RestartPolicy
	SecurityOpt       []string
	ReadonlyRootfs    bool
	Ulimits           []Ulimit
	LogConfig         LogConfig
	CgroupParent      string
	ConsoleSize       [2]int
	VolumeDriver      string
}

type DeviceMapping struct {
	PathOnHost        string `json:"PathOnHost"`
	PathInContainer   string `json:"PathInContainer"`
	CgroupPermissions string `json:"CgroupPermissions"`
}

type ExecConfig struct {
	AttachStdin  bool
	AttachStdout bool
	AttachStderr bool
	Tty          bool
	Cmd          []string
	Container    string
	Detach       bool
}

type LogOptions struct {
	Follow     bool
	Stdout     bool
	Stderr     bool
	Timestamps bool
	Tail       int64
}

type AttachOptions struct {
	Logs   bool
	Stream bool
	Stdin  bool
	Stdout bool
	Stderr bool
}

type MonitorEventsFilters struct {
	Event     string `json:",omitempty"`
	Image     string `json:",omitempty"`
	Container string `json:",omitempty"`
}

type MonitorEventsOptions struct {
	Since   int
	Until   int
	Filters *MonitorEventsFilters `json:",omitempty"`
}

type RestartPolicy struct {
	Name              string
	MaximumRetryCount int64
}

type PortBinding struct {
	HostIp   string
	HostPort string
}

type State struct {
	Running    bool
	Paused     bool
	Restarting bool
	OOMKilled  bool
	Dead       bool
	Pid        int
	ExitCode   int
	Error      string // contains last known error when starting the container
	StartedAt  time.Time
	FinishedAt time.Time
	Ghost      bool
}

// String returns a human-readable description of the state
// Stoken from docker/docker/daemon/state.go
func (s *State) String() string {
	if s.Running {
		if s.Paused {
			return fmt.Sprintf("Up %s (Paused)", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
		}
		if s.Restarting {
			return fmt.Sprintf("Restarting (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt)))
		}

		return fmt.Sprintf("Up %s", units.HumanDuration(time.Now().UTC().Sub(s.StartedAt)))
	}

	if s.Dead {
		return "Dead"
	}

	if s.FinishedAt.IsZero() {
		return ""
	}

	return fmt.Sprintf("Exited (%d) %s ago", s.ExitCode, units.HumanDuration(time.Now().UTC().Sub(s.FinishedAt)))
}

// StateString returns a single string to describe state
// Stoken from docker/docker/daemon/state.go
func (s *State) StateString() string {
	if s.Running {
		if s.Paused {
			return "paused"
		}
		if s.Restarting {
			return "restarting"
		}
		return "running"
	}

	if s.Dead {
		return "dead"
	}

	return "exited"
}

type ImageInfo struct {
	Architecture    string
	Author          string
	Comment         string
	Config          *ContainerConfig
	Container       string
	ContainerConfig *ContainerConfig
	Created         time.Time
	DockerVersion   string
	Id              string
	Os              string
	Parent          string
	Size            int64
	VirtualSize     int64
}

type ContainerInfo struct {
	Id              string
	Created         string
	Path            string
	Name            string
	Args            []string
	ExecIDs         []string
	Config          *ContainerConfig
	State           *State
	Image           string
	NetworkSettings struct {
		IPAddress   string `json:"IpAddress"`
		IPPrefixLen int    `json:"IpPrefixLen"`
		Gateway     string
		Bridge      string
		Ports       map[string][]PortBinding
	}
	SysInitPath    string
	ResolvConfPath string
	Volumes        map[string]string
	HostConfig     *HostConfig
}

type ContainerChanges struct {
	Path string
	Kind int
}

type Port struct {
	IP          string
	PrivatePort int
	PublicPort  int
	Type        string
}

type Container struct {
	Id         string
	Names      []string
	Image      string
	Command    string
	Created    int64
	Status     string
	Ports      []Port
	SizeRw     int64
	SizeRootFs int64
	Labels     map[string]string
}

type Event struct {
	Id     string
	Status string
	From   string
	Time   int64
}

type Version struct {
	ApiVersion    string
	Arch          string
	GitCommit     string
	GoVersion     string
	KernelVersion string
	Os            string
	Version       string
}

type RespContainersCreate struct {
	Id       string
	Warnings []string
}

type Image struct {
	Created     int64
	Id          string
	Labels      map[string]string
	ParentId    string
	RepoDigests []string
	RepoTags    []string
	Size        int64
	VirtualSize int64
}

// Info is the struct returned by /info
// The API is currently in flux, so Debug, MemoryLimit, SwapLimit, and
// IPv4Forwarding are interfaces because in docker 1.6.1 they are 0 or 1 but in
// master they are bools.
type Info struct {
	ID                 string
	Containers         int64
	Driver             string
	DriverStatus       [][]string
	ExecutionDriver    string
	Images             int64
	KernelVersion      string
	OperatingSystem    string
	NCPU               int64
	MemTotal           int64
	Name               string
	Labels             []string
	Debug              interface{}
	NFd                int64
	NGoroutines        int64
	SystemTime         string
	NEventsListener    int64
	InitPath           string
	InitSha1           string
	IndexServerAddress string
	MemoryLimit        interface{}
	SwapLimit          interface{}
	IPv4Forwarding     interface{}
	BridgeNfIptables   bool
	BridgeNfIp6tables  bool
	DockerRootDir      string
	HttpProxy          string
	HttpsProxy         string
	NoProxy            string
}

type ImageDelete struct {
	Deleted  string
	Untagged string
}

type EventOrError struct {
	Event
	Error error
}

type WaitResult struct {
	ExitCode int
	Error    error
}

type decodingResult struct {
	result interface{}
	err    error
}

// The following are types for the API stats endpoint
type ThrottlingData struct {
	// Number of periods with throttling active
	Periods uint64 `json:"periods"`
	// Number of periods when the container hit its throttling limit.
	ThrottledPeriods uint64 `json:"throttled_periods"`
	// Aggregate time the container was throttled for in nanoseconds.
	ThrottledTime uint64 `json:"throttled_time"`
}

type CpuUsage struct {
	// Total CPU time consumed.
	// Units: nanoseconds.
	TotalUsage uint64 `json:"total_usage"`
	// Total CPU time consumed per core.
	// Units: nanoseconds.
	PercpuUsage []uint64 `json:"percpu_usage"`
	// Time spent by tasks of the cgroup in kernel mode.
	// Units: nanoseconds.
	UsageInKernelmode uint64 `json:"usage_in_kernelmode"`
	// Time spent by tasks of the cgroup in user mode.
	// Units: nanoseconds.
	UsageInUsermode uint64 `json:"usage_in_usermode"`
}

type CpuStats struct {
	CpuUsage       CpuUsage       `json:"cpu_usage"`
	SystemUsage    uint64         `json:"system_cpu_usage"`
	ThrottlingData ThrottlingData `json:"throttling_data,omitempty"`
}

type NetworkStats struct {
	RxBytes   uint64 `json:"rx_bytes"`
	RxPackets uint64 `json:"rx_packets"`
	RxErrors  uint64 `json:"rx_errors"`
	RxDropped uint64 `json:"rx_dropped"`
	TxBytes   uint64 `json:"tx_bytes"`
	TxPackets uint64 `json:"tx_packets"`
	TxErrors  uint64 `json:"tx_errors"`
	TxDropped uint64 `json:"tx_dropped"`
}

type MemoryStats struct {
	Usage    uint64            `json:"usage"`
	MaxUsage uint64            `json:"max_usage"`
	Stats    map[string]uint64 `json:"stats"`
	Failcnt  uint64            `json:"failcnt"`
	Limit    uint64            `json:"limit"`
}

type BlkioStatEntry struct {
	Major uint64 `json:"major"`
	Minor uint64 `json:"minor"`
	Op    string `json:"op"`
	Value uint64 `json:"value"`
}

type BlkioStats struct {
	// number of bytes tranferred to and from the block device
	IoServiceBytesRecursive []BlkioStatEntry `json:"io_service_bytes_recursive"`
	IoServicedRecursive     []BlkioStatEntry `json:"io_serviced_recursive"`
	IoQueuedRecursive       []BlkioStatEntry `json:"io_queue_recursive"`
	IoServiceTimeRecursive  []BlkioStatEntry `json:"io_service_time_recursive"`
	IoWaitTimeRecursive     []BlkioStatEntry `json:"io_wait_time_recursive"`
	IoMergedRecursive       []BlkioStatEntry `json:"io_merged_recursive"`
	IoTimeRecursive         []BlkioStatEntry `json:"io_time_recursive"`
	SectorsRecursive        []BlkioStatEntry `json:"sectors_recursive"`
}

type Stats struct {
	Read         time.Time    `json:"read"`
	NetworkStats NetworkStats `json:"network,omitempty"`
	CpuStats     CpuStats     `json:"cpu_stats,omitempty"`
	MemoryStats  MemoryStats  `json:"memory_stats,omitempty"`
	BlkioStats   BlkioStats   `json:"blkio_stats,omitempty"`
}

type Ulimit struct {
	Name string `json:"name"`
	Soft uint64 `json:"soft"`
	Hard uint64 `json:"hard"`
}

type LogConfig struct {
	Type   string            `json:"type"`
	Config map[string]string `json:"config"`
}

type BuildImage struct {
	Config         *ConfigFile
	DockerfileName string
	Context        io.Reader
	RemoteURL      string
	RepoName       string
	SuppressOutput bool
	NoCache        bool
	Remove         bool
	ForceRemove    bool
	Pull           bool
	Memory         int64
	MemorySwap     int64
	CpuShares      int64
	CpuPeriod      int64
	CpuQuota       int64
	CpuSetCpus     string
	CpuSetMems     string
	CgroupParent   string
	BuildArgs      map[string]string
}

type Volume struct {
	Name       string // Name is the name of the volume
	Driver     string // Driver is the Driver name used to create the volume
	Mountpoint string // Mountpoint is the location on disk of the volume
}

type VolumesListResponse struct {
	Volumes []*Volume // Volumes is the list of volumes being returned
}

type VolumeCreateRequest struct {
	Name       string            // Name is the requested name of the volume
	Driver     string            // Driver is the name of the driver that should be used to create the volume
	DriverOpts map[string]string // DriverOpts holds the driver specific options to use for when creating the volume.
}

// IPAM represents IP Address Management
type IPAM struct {
	Driver string
	Config []IPAMConfig
}

// IPAMConfig represents IPAM configurations
type IPAMConfig struct {
	Subnet     string            `json:",omitempty"`
	IPRange    string            `json:",omitempty"`
	Gateway    string            `json:",omitempty"`
	AuxAddress map[string]string `json:"AuxiliaryAddresses,omitempty"`
}

// NetworkResource is the body of the "get network" http response message
type NetworkResource struct {
	Name       string
	ID         string `json:"Id"`
	Scope      string
	Driver     string
	IPAM       IPAM
	Containers map[string]EndpointResource
}

//EndpointResource contains network resources allocated and usd for a container in a network
type EndpointResource struct {
	EndpointID  string
	MacAddress  string
	IPv4Address string
	IPv6Address string
}

// NetworkCreate is the expected body of the "create network" http request message
type NetworkCreate struct {
	Name           string
	CheckDuplicate bool
	Driver         string
	IPAM           IPAM
	Options        map[string]string
}

// NetworkCreateResponse is the response message sent by the server for network create call
type NetworkCreateResponse struct {
	ID      string `json:"Id"`
	Warning string
}

// NetworkConnect represents the data to be used to connect a container to the network
type NetworkConnect struct {
	Container string
}

// NetworkDisconnect represents the data to be used to disconnect a container from the network
type NetworkDisconnect struct {
	Container string
}
<|endoftext|>


<commit_before>package dockerclient

type ContainerConfig struct {
	Hostname        string
	Domainname      string
	User            string
	Memory          int
	MemorySwap      int
	CpuShares       int
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	Tty             bool
	OpenStdin       bool
	StdinOnce       bool
	Env             []string
	Cmd             []string
	Dns             []string
	Image           string
	VolumesFrom     string
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
}

type HostConfig struct {
	Binds           []string
	ContainerIDFile string
	LxcConf         []map[string]string
	Privileged      bool
	PortBindings    map[string][]PortBinding
	Links           []string
	PublishAllPorts bool
}

type PortBinding struct {
	HostIp   string
	HostPort string
}

type ContainerInfo struct {
	Id     string
	Create string
	Path   string
	Args   []string
	Config *ContainerConfig
	State  struct {
		Running   bool
		Pid       int
		ExitCode  int
		StartedAt string
		Ghost     bool
	}
	Image           string
	NetworkSettings struct {
		IpAddress   string
		IpPrefixLen int
		Gateway     string
		Bridge      string
		Ports       map[string][]PortBinding
	}
	SysInitPath    string
	ResolvConfPath string
	Volumes        map[string]string
	HostConfig     *HostConfig
}

type Port struct {
	PrivatePort int
	PublicPort  int
	Type        string
}

type Container struct {
	Id         string
	Names      []string
	Image      string
	Command    string
	Created    int
	Status     string
	Ports      []Port
	SizeRw     int
	SizeRootFs int
}

type Event struct {
	Id     string
	Status string
	From   string
	Time   int
}

type Version struct {
	Version   string
	GitCommit string
	GoVersion string
}

type RespContainersCreate struct {
	Id       string
	Warnings []string
}
<commit_msg>Move Dns and VolumesFrom to host config<commit_after>package dockerclient

type ContainerConfig struct {
	Hostname        string
	Domainname      string
	User            string
	Memory          int
	MemorySwap      int
	CpuShares       int
	AttachStdin     bool
	AttachStdout    bool
	AttachStderr    bool
	Tty             bool
	OpenStdin       bool
	StdinOnce       bool
	Env             []string
	Cmd             []string
	Image           string
	WorkingDir      string
	Entrypoint      []string
	NetworkDisabled bool
}

type HostConfig struct {
	Binds           []string
	ContainerIDFile string
	LxcConf         []map[string]string
	Privileged      bool
	PortBindings    map[string][]PortBinding
	Links           []string
	PublishAllPorts bool
	Dns             []string
	DnsSearch       []string
	VolumesFrom     []string
}

type PortBinding struct {
	HostIp   string
	HostPort string
}

type ContainerInfo struct {
	Id     string
	Create string
	Path   string
	Args   []string
	Config *ContainerConfig
	State  struct {
		Running   bool
		Pid       int
		ExitCode  int
		StartedAt string
		Ghost     bool
	}
	Image           string
	NetworkSettings struct {
		IpAddress   string
		IpPrefixLen int
		Gateway     string
		Bridge      string
		Ports       map[string][]PortBinding
	}
	SysInitPath    string
	ResolvConfPath string
	Volumes        map[string]string
	HostConfig     *HostConfig
}

type Port struct {
	PrivatePort int
	PublicPort  int
	Type        string
}

type Container struct {
	Id         string
	Names      []string
	Image      string
	Command    string
	Created    int
	Status     string
	Ports      []Port
	SizeRw     int
	SizeRootFs int
}

type Event struct {
	Id     string
	Status string
	From   string
	Time   int
}

type Version struct {
	Version   string
	GitCommit string
	GoVersion string
}

type RespContainersCreate struct {
	Id       string
	Warnings []string
}
<|endoftext|>


<commit_before>package aspect

import (
	"fmt"
	"strings"
)

type dbType interface {
	Create(Dialect) (string, error)
}

type Text struct{}

func (s Text) Create(d Dialect) (string, error) {
	compiled := "TEXT"
	return compiled, nil
}

type String struct {
	Length     int
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s String) Create(d Dialect) (string, error) {
	compiled := "VARCHAR"
	attrs := make([]string, 0)
	if s.Length != 0 {
		compiled += fmt.Sprintf("(%d)", s.Length)
	}
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}

type Integer struct {
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s Integer) Create(d Dialect) (string, error) {
	compiled := "INTEGER"
	attrs := make([]string, 0)
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}

type Timestamp struct {
	NotNull    bool
	PrimaryKey bool
}

func (s Timestamp) Create(d Dialect) (string, error) {
	compiled := "DATETIME"
	if s.NotNull {
		compiled += " NOT NULL"
	}
	return compiled, nil
}

type Boolean struct {
	NotNull bool
}

func (s Boolean) Create(d Dialect) (string, error) {
	compiled := "BOOL"
	if s.NotNull {
		compiled += " NOT NULL"
	}
	return compiled, nil
}

type Serial struct{}

func (s Serial) Create(d Dialect) (string, error) {
	return "SERIAL NOT NULL", nil
}

type Double struct {
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s Double) Create(d Dialect) (string, error) {
	compiled := "DOUBLE PRECISION"
	attrs := make([]string, 0)
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}

type Inet struct {
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s Inet) Create(d Dialect) (string, error) {
	compiled := "INET"
	attrs := make([]string, 0)
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}
<commit_msg>Added a Date type<commit_after>package aspect

import (
	"fmt"
	"strings"
)

type dbType interface {
	Create(Dialect) (string, error)
}

type Text struct{}

func (s Text) Create(d Dialect) (string, error) {
	compiled := "TEXT"
	return compiled, nil
}

type String struct {
	Length     int
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s String) Create(d Dialect) (string, error) {
	compiled := "VARCHAR"
	attrs := make([]string, 0)
	if s.Length != 0 {
		compiled += fmt.Sprintf("(%d)", s.Length)
	}
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}

type Integer struct {
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s Integer) Create(d Dialect) (string, error) {
	compiled := "INTEGER"
	attrs := make([]string, 0)
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}

type Timestamp struct {
	NotNull    bool
	PrimaryKey bool
}

func (s Timestamp) Create(d Dialect) (string, error) {
	compiled := "DATETIME"
	if s.NotNull {
		compiled += " NOT NULL"
	}
	return compiled, nil
}

type DateType struct {
	NotNull    bool
	PrimaryKey bool
}

func (s DateType) Create(d Dialect) (string, error) {
	compiled := "DATE"
	if s.NotNull {
		compiled += " NOT NULL"
	}
	return compiled, nil
}

type Boolean struct {
	NotNull bool
}

func (s Boolean) Create(d Dialect) (string, error) {
	compiled := "BOOL"
	if s.NotNull {
		compiled += " NOT NULL"
	}
	return compiled, nil
}

type Serial struct{}

func (s Serial) Create(d Dialect) (string, error) {
	return "SERIAL NOT NULL", nil
}

type Double struct {
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s Double) Create(d Dialect) (string, error) {
	compiled := "DOUBLE PRECISION"
	attrs := make([]string, 0)
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}

type Inet struct {
	NotNull    bool
	Unique     bool
	PrimaryKey bool
}

func (s Inet) Create(d Dialect) (string, error) {
	compiled := "INET"
	attrs := make([]string, 0)
	if s.PrimaryKey {
		attrs = append(attrs, "PRIMARY KEY")
	}
	if s.NotNull {
		attrs = append(attrs, "NOT NULL")
	}
	if s.Unique {
		attrs = append(attrs, "UNIQUE")
	}
	if len(attrs) > 0 {
		compiled += fmt.Sprintf(" %s", strings.Join(attrs, " "))
	}
	return compiled, nil
}
<|endoftext|>


<commit_before>package goinsta

import (
	"fmt"
	"net/http"
)

// Instagram represent the main API handler
//
// ...
type Instagram struct {
	user string
	pass string
	// device id
	dID string
	// uuid
	uuid string
	// rankToken
	rankToken string
	// token
	token string
	// phone id
	pid string

	// Instagram objects

	// Users is the user interaction
	Users *Users
	// Account stores all personal data of the user and his/her options.
	Account *Account
	// Search performs searching of multiple things (users, locations...)
	Search *Search

	logged bool

	c *http.Client
}

// School is void structure (yet).
type School struct {
}

// PicURLInfo repre
type PicURLInfo struct {
	Height int    `json:"height"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
}

type instaError struct {
	Message   string `json:"message"`
	Status    string `json:"status"`
	ErrorType string `json:"error_type"`
}

func instaToErr(ierr instaError) error {
	return fmt.Errorf("%s: %s | %s", ierr.Status, ierr.Message, ierr.ErrorType)
}

type Nametag struct {
	Mode          int    `json:"mode"`
	Gradient      int    `json:"gradient"`
	Emoji         string `json:"emoji"`
	SelfieSticker int    `json:"selfie_sticker"`
}
<commit_msg>Changed error formatting<commit_after>package goinsta

import (
	"fmt"
	"net/http"
)

// Instagram represent the main API handler
//
// ...
type Instagram struct {
	user string
	pass string
	// device id
	dID string
	// uuid
	uuid string
	// rankToken
	rankToken string
	// token
	token string
	// phone id
	pid string

	// Instagram objects

	// Users is the user interaction
	Users *Users
	// Account stores all personal data of the user and his/her options.
	Account *Account
	// Search performs searching of multiple things (users, locations...)
	Search *Search

	logged bool

	c *http.Client
}

// School is void structure (yet).
type School struct {
}

// PicURLInfo repre
type PicURLInfo struct {
	Height int    `json:"height"`
	URL    string `json:"url"`
	Width  int    `json:"width"`
}

type instaError struct {
	Message   string `json:"message"`
	Status    string `json:"status"`
	ErrorType string `json:"error_type"`
}

func instaToErr(ierr instaError) error {
	return fmt.Errorf("%s: %s (%s)", ierr.Status, ierr.Message, ierr.ErrorType)
}

type Nametag struct {
	Mode          int    `json:"mode"`
	Gradient      int    `json:"gradient"`
	Emoji         string `json:"emoji"`
	SelfieSticker int    `json:"selfie_sticker"`
}
<|endoftext|>