esa

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

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

Go to latest
Published: Jan 30, 2017 License: MIT Imports: 5 Imported by: 0

README

go-esa

package main

import (
	"fmt"
	"log"
	"os"

	"github.com/yuichiro-h/go-esa"
)

func main() {
	client := esa.New(&esa.Config{AccessToken: "accessToken"})
	res, err := client.GetTeams(&esa.GetTeamsRequest{})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Printf("%v", res)
}

Supported resources

  • GET /v1/teams
  • GET /v1/teams/:team_name
  • GET /v1/teams/:team_name/stats
  • GET /v1/teams/:team_name/members
  • GET /v1/teams/:team_name/posts
  • GET /v1/teams/:team_name/posts/:post_number
  • POST /v1/teams/:team_name/posts
  • PATCH /v1/teams/:team_name/posts/:post_number
  • DELETE /v1/teams/:team_name/posts/:post_number
  • GET /v1/teams/:team_name/posts/:post_number/comments
  • GET /v1/teams/:team_name/comments/:comment_id
  • POST /v1/teams/:team_name/posts/:post_number/comments
  • PATCH /v1/teams/:team_name/comments/:comment_id
  • DELETE /v1/teams/:team_name/comments/:comment_id
  • GET /v1/teams/:team_name/posts/:post_number/stargazers
  • POST /v1/teams/:team_name/posts/:post_number/star
  • DELETE /v1/teams/:team_name/posts/:post_number/star
  • GET /v1/teams/:team_name/comments/:comment_id/stargazers
  • POST /v1/teams/:team_name/comments/:comment_id/star
  • DELETE /v1/teams/:team_name/comments/:comment_id/star
  • GET /v1/teams/:team_name/posts/:post_number/watchers
  • POST /v1/teams/:team_name/posts/:post_number/watch
  • DELETE /v1/teams/:team_name/posts/:post_number/watch
  • GET /v1/user

Documentation

Index

Constants

View Source
const (
	Version = "0.1.0"
)

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

func Int

func Int(v int) *int

func SliceString

func SliceString(v []string) *[]string

func String

func String(v string) *string

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Client

func (*Client) CreateTeamPost

func (c *Client) CreateTeamPost(teamName string, req *CreateTeamPostRequest) (*CreateTeamPostResponse, error)

func (*Client) CreateTeamPostComment

func (c *Client) CreateTeamPostComment(teamName string, postNumber int, req *CreateTeamPostCommentRequest) (*CreateTeamPostCommentResponse, error)

func (*Client) CreateTeamPostCommentStar

func (c *Client) CreateTeamPostCommentStar(teamName string, commentID int, req *CreateTeamPostCommentStarRequest) error

func (*Client) CreateTeamPostStar

func (c *Client) CreateTeamPostStar(teamName string, postNumber int, req *CreateTeamPostStarRequest) error

func (*Client) CreateTeamPostWatch

func (c *Client) CreateTeamPostWatch(teamName string, postNumber int) error

func (*Client) GetTeam

func (c *Client) GetTeam(teamName string) (*GetTeamResponse, error)

func (*Client) GetTeamComment

func (c *Client) GetTeamComment(teamName string, commentID int) (*GetTeamCommentResponse, error)

func (*Client) GetTeamCommentStargazers

func (c *Client) GetTeamCommentStargazers(teamName string, commentID int, req *GetTeamCommentStargazersRequest) (*GetTeamCommentStargazersResponse, error)

func (*Client) GetTeamMembers

func (c *Client) GetTeamMembers(teamName string, req *GetTeamMembersRequest) (*GetTeamMembersResponse, error)

func (*Client) GetTeamPost

func (c *Client) GetTeamPost(teamName string, number int) (*GetTeamPostResponse, error)

func (*Client) GetTeamPostComments

func (c *Client) GetTeamPostComments(teamName string, req *GetTeamPostCommentRequest) (*GetTeamPostCommentsResponse, error)

func (*Client) GetTeamPostStarGazers

func (c *Client) GetTeamPostStarGazers(teamName string, postNumber int, req *GetTeamPostStargazersRequest) (*GetTeamPostStargazersResponse, error)

func (*Client) GetTeamPostWatchers

func (c *Client) GetTeamPostWatchers(teamName string, postNumber int, req *GetTeamPostWatchersRequest) (*GetTeamPostWatchersResponse, error)

func (*Client) GetTeamPosts

func (c *Client) GetTeamPosts(teamName string, req *GetTeamPostsRequest) (*GetTeamPostsResponse, error)

func (*Client) GetTeamStats

func (c *Client) GetTeamStats(teamName string) (*GetTeamStatsResponse, error)

func (*Client) GetTeams

func (c *Client) GetTeams(req *GetTeamsRequest) (*GetTeamsResponse, error)

func (*Client) GetUser

func (c *Client) GetUser() (*GetUserResponse, error)

func (*Client) UpdateTeamPost

func (c *Client) UpdateTeamPost(teamName string, postNumber int, req *UpdateTeamPostRequest) (*UpdateTeamPostResponse, error)

func (*Client) UpdateTeamPostComment

func (c *Client) UpdateTeamPostComment(teamName string, commentID int, req *UpdateTeamPostCommentRequest) (*UpdateTeamPostCommentResponse, error)

type Comment

type Comment struct {
	ID              int           `json:"id"`
	BodyMD          string        `json:"body_md"`
	BodyHTML        string        `json:"body_html"`
	CreatedAt       time.Time     `json:"created_at"`
	UpdatedAt       time.Time     `json:"updated_at"`
	URL             string        `json:"url"`
	CreatedBy       CommentMember `json:"created_by"`
	StargazersCount int           `json:"stargazers_count"`
	Star            bool          `json:"star"`
}

type CommentMember

type CommentMember struct {
	Name       string `json:"name"`
	ScreenName string `json:"screen_name"`
	Icon       string `json:"icon"`
}

type Config

type Config struct {
	AccessToken string
}

type CreateTeamPostCommentRequest

type CreateTeamPostCommentRequest struct {
	BodyMD string  `json:"body_md"`
	User   *string `json:"user"`
}

type CreateTeamPostCommentResponse

type CreateTeamPostCommentResponse struct {
	Comment
}

type CreateTeamPostCommentStarRequest

type CreateTeamPostCommentStarRequest struct {
	Body *string `json:"body"`
}

type CreateTeamPostRequest

type CreateTeamPostRequest struct {
	Name     string    `json:"name"`
	BodyMD   *string   `json:"body_md"`
	Tags     *[]string `json:"tags"`
	Category *string   `json:"category"`
	WIP      *bool     `json:"wip"`
	Message  *string   `json:"message"`
	User     *string   `json:"user"`
}

type CreateTeamPostResponse

type CreateTeamPostResponse struct {
	Post
}

type CreateTeamPostStarRequest

type CreateTeamPostStarRequest struct {
	Body *string `json:"body"`
}

type EsaError

type EsaError struct {
	Code    string `json:"error"`
	Message string `json:"message"`
}

func (EsaError) Error

func (e EsaError) Error() string

type GetTeamCommentResponse

type GetTeamCommentResponse struct {
	Comment
}

type GetTeamCommentStargazersRequest

type GetTeamCommentStargazersRequest struct {
	PaginationRequest
}

type GetTeamCommentStargazersResponse

type GetTeamCommentStargazersResponse struct {
	Stargazers []Stargazer `json:"stargazers"`
	PaginationResponse
}

type GetTeamMembersRequest

type GetTeamMembersRequest struct {
	TeamName string
	PaginationRequest
}

type GetTeamMembersResponse

type GetTeamMembersResponse struct {
	Members []Member `json:"members"`
	PaginationResponse
}

type GetTeamPostCommentRequest

type GetTeamPostCommentRequest struct {
	PostNumber int
	PaginationRequest
}

type GetTeamPostCommentResponse

type GetTeamPostCommentResponse struct {
	Comment
}

type GetTeamPostCommentsResponse

type GetTeamPostCommentsResponse struct {
	Comments []Comment `json:"comments"`
	PaginationResponse
}

type GetTeamPostResponse

type GetTeamPostResponse struct {
	Post
}

type GetTeamPostStargazersRequest

type GetTeamPostStargazersRequest struct {
	PaginationRequest
}

type GetTeamPostStargazersResponse

type GetTeamPostStargazersResponse struct {
	Stargazers []Stargazer `json:"stargazers"`
	PaginationResponse
}

type GetTeamPostWatchersRequest

type GetTeamPostWatchersRequest struct {
	PaginationRequest
}

type GetTeamPostWatchersResponse

type GetTeamPostWatchersResponse struct {
	Watchers []Watcher `json:"watchers"`
	PaginationResponse
}

type GetTeamPostsRequest

type GetTeamPostsRequest struct {
	Q       *string
	Include *string
	Sort    *string
	Order   *string
	PaginationRequest
}

type GetTeamPostsResponse

type GetTeamPostsResponse struct {
	Posts []Post `json:"posts"`
	PaginationResponse
}

type GetTeamResponse

type GetTeamResponse struct {
	Team
}

type GetTeamStatsResponse

type GetTeamStatsResponse struct {
	TeamStats
}

type GetTeamsRequest

type GetTeamsRequest struct {
	PaginationRequest
}

type GetTeamsResponse

type GetTeamsResponse struct {
	Teams []Team `json:"teams"`
	PaginationResponse
}

type GetUserResponse

type GetUserResponse struct {
	User
}

type Member

type Member struct {
	Name       string  `json:"name"`
	ScreenName string  `json:"screen_name"`
	Icon       string  `json:"icon"`
	Email      *string `json:"email"`
	PostsCount int     `json:"posts_count"`
}

type OriginalRevision

type OriginalRevision struct {
	BodyMD string `json:"body_md"`
	Number int    `json:"number"`
	User   string `json:"user"`
}

type Pagination

type Pagination struct {
	PrevPage   *int `json:"prev_page"`
	NextPage   *int `json:"next_page"`
	TotalCount int  `json:"total_count"`
	Page       int  `json:"page"`
	PerPage    int  `json:"per_page"`
	MaxPerPage int  `json:"max_per_page"`
}

type PaginationRequest

type PaginationRequest struct {
	Page    *int `json:"page"`
	PerPage *int `json:"per_page"`
}

type PaginationResponse

type PaginationResponse struct {
	PrevPage   *int `json:"prev_page"`
	NextPage   *int `json:"next_page"`
	TotalCount int  `json:"total_count"`
	Page       int  `json:"page"`
	PerPage    int  `json:"per_page"`
	MaxPerPage int  `json:"max_per_page"`
}

type Post

type Post struct {
	Number          int         `json:"number"`
	Name            string      `json:"name"`
	FullName        string      `json:"full_name"`
	WIP             bool        `json:"wip"`
	BodyMD          string      `json:"body_md"`
	BodyHTML        string      `json:"body_html"`
	CreatedAt       time.Time   `json:"created_at"`
	Message         string      `json:"message"`
	URL             string      `json:"url"`
	UpdatedAt       time.Time   `json:"updated_at"`
	Tags            []string    `json:"tags"`
	Category        *string     `json:"category"`
	RevisionNumber  int         `json:"revision_number"`
	CreatedBy       PostMember  `json:"created_by"`
	UpdatedBy       PostMember  `json:"updated_by"`
	Kind            string      `json:"kind"`
	CommentsCount   int         `json:"comments_countr"`
	TaskCount       int         `json:"task_count"`
	DoneTasksCount  int         `json:"done_tasks_count"`
	StargazersCount int         `json:"stargazers_count"`
	WatchersCount   int         `json:"watchers_count"`
	Star            bool        `json:"star"`
	Watch           bool        `json:"watch"`
	Comments        []Comment   `json:"comments"`
	Stargazers      []Stargazer `json:"stargazers"`
}

type PostMember

type PostMember struct {
	Name       string `json:"name"`
	ScreenName string `json:"screen_name"`
	Icon       string `json:"icon"`
}

type Stargazer

type Stargazer struct {
	CreatedAt time.Time `json:"created_at"`
	Body      string    `json:"body"`
	User      struct {
		Name       string `json:"name"`
		ScreenName string `json:"screen_name"`
		Icon       string `json:"icon"`
	} `json:"user"`
}

type Team

type Team struct {
	Name        string `json:"name"`
	Privacy     string `json:"privacy"`
	Description string `json:"description"`
	Icon        string `json:"icon"`
	URL         string `json:"url"`
}

type TeamStats

type TeamStats struct {
	Members            int `json:"members"`
	Posts              int `json:"posts"`
	PostsWIP           int `json:"posts_wip"`
	PostsShipped       int `json:"posts_shipped"`
	Comments           int `json:"comments"`
	Stars              int `json:"stars"`
	DailyActiveUsers   int `json:"daily_active_users"`
	WeeklyActiveusers  int `json:"weekly_active_users"`
	MonthlyActiveUsers int `json:"monthly_active_users"`
}

type UpdateTeamPostCommentRequest

type UpdateTeamPostCommentRequest struct {
	BodyMD string  `json:"body_md"`
	User   *string `json:"user"`
}

type UpdateTeamPostCommentResponse

type UpdateTeamPostCommentResponse struct {
	Comment
}

type UpdateTeamPostRequest

type UpdateTeamPostRequest struct {
	Name             string            `json:"name"`
	BodyMD           *string           `json:"body_md"`
	Tags             *[]string         `json:"tags"`
	Category         *string           `json:"category"`
	WIP              bool              `json:"wip"`
	Message          *string           `json:"message"`
	CreatedBy        string            `json:"created_by"`
	UpdatedBy        string            `json:"updated_by"`
	OriginalRevision *OriginalRevision `json:"original_revision"`
}

type UpdateTeamPostResponse

type UpdateTeamPostResponse struct {
	Post
	Overlapped *bool `json:"overlapped"`
}

type User

type User struct {
	ID         int       `json:"id"`
	Name       string    `json:"name"`
	ScreenName string    `json:"screen_name"`
	Icon       string    `json:"icon"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

type Watcher

type Watcher struct {
	CreatedAt time.Time `json:"created_at"`
	User      struct {
		Name       string `json:"name"`
		ScreenName string `json:"screen_name"`
		Icon       string `json:"icon"`
	} `json:"user"`
}

Jump to

Keyboard shortcuts

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