Documentation ¶
Index ¶
- func BoolP(v bool) *bool
- func IntP(v int) *int
- func StrP(v string) *string
- func UintP(v uint) *uint
- type BaseOption
- type BatchMoveParam
- type BatchMoveResult
- type Client
- type ClientImpl
- func (c *ClientImpl) AppendOption(options ...BaseOption)
- func (c ClientImpl) ChangeCategory(ctx context.Context, from string, to string) (*BatchMoveResult, error)
- func (c *ClientImpl) ClearOptions()
- func (c ClientImpl) CreateComment(ctx context.Context, postNumber uint, param CreateCommentParam) (*Comment, error)
- func (c ClientImpl) CreateEmoji(ctx context.Context, param CreateEmojiParam) (*Emoji, error)
- func (c ClientImpl) CreatePost(ctx context.Context, param CreatePostParam) (*Post, error)
- func (c ClientImpl) DeleteComment(ctx context.Context, id uint) error
- func (c ClientImpl) DeleteEmoji(ctx context.Context, code string) error
- func (c ClientImpl) DeleteInvitation(ctx context.Context, code string) error
- func (c ClientImpl) DeletePost(ctx context.Context, number uint) error
- func (c ClientImpl) GetComment(ctx context.Context, id uint) (*Comment, error)
- func (c ClientImpl) GetInvitationURL(ctx context.Context) (*URLResp, error)
- func (c ClientImpl) GetPost(ctx context.Context, number uint) (*Post, error)
- func (c ClientImpl) GetTeam(ctx context.Context) (*Team, error)
- func (c ClientImpl) GetTeamStats(ctx context.Context) (*TeamStats, error)
- func (c ClientImpl) GetUser(ctx context.Context, param GetUserParam) (*User, error)
- func (c ClientImpl) InviteByEmail(ctx context.Context, emails ...string) (*InvitationByEmailResp, error)
- func (c ClientImpl) ListCommentStargazers(ctx context.Context, commentID uint, page uint, perPage uint) (*StargazersResp, error)
- func (c ClientImpl) ListComments(ctx context.Context, postNumber uint, page uint, perPage uint) (*CommentsResp, error)
- func (c ClientImpl) ListEmojis(ctx context.Context, param ListEmojisParam, page uint, perPage uint) (*EmojisResp, error)
- func (c ClientImpl) ListInvitations(ctx context.Context, page uint, perPage uint) (*InvitationsResp, error)
- func (c ClientImpl) ListMembers(ctx context.Context, page uint, perPage uint) (*MembersResp, error)
- func (c ClientImpl) ListPostStargazers(ctx context.Context, postNumber uint, page uint, perPage uint) (*StargazersResp, error)
- func (c ClientImpl) ListPostWatchers(ctx context.Context, postNumber uint, page uint, perPage uint) (*WatchersResp, error)
- func (c ClientImpl) ListPosts(ctx context.Context, param ListPostsParam, page uint, perPage uint) (*PostsResp, error)
- func (c ClientImpl) ListTeams(ctx context.Context, page uint, perPage uint) (*TeamsResp, error)
- func (c *ClientImpl) OverwriteBaseURL(u url.URL)
- func (c ClientImpl) RegenerateInvitationURL(ctx context.Context) (*URLResp, error)
- func (c *ClientImpl) SetAccessToken(accessToken string)
- func (c *ClientImpl) SetOption(options ...BaseOption)
- func (c *ClientImpl) SetTeam(teamName string)
- func (c ClientImpl) StarComment(ctx context.Context, commentID uint, param StarParam) error
- func (c ClientImpl) StarPost(ctx context.Context, postNumber uint, param StarParam) error
- func (c ClientImpl) UnstarComment(ctx context.Context, commentID uint) error
- func (c ClientImpl) UnstarPost(ctx context.Context, postNumber uint) error
- func (c ClientImpl) UnwatchPost(ctx context.Context, postNumber uint) error
- func (c ClientImpl) UpdateComment(ctx context.Context, id uint, param UpdateCommentParam) (*Comment, error)
- func (c ClientImpl) UpdatePost(ctx context.Context, number uint, param UpdatePostParam) (*UpdatedPost, error)
- func (c ClientImpl) WatchPost(ctx context.Context, postNumber uint) error
- type Comment
- type CommentsResp
- type CreateCommentParam
- type CreateEmojiParam
- type CreatePostParam
- type Emoji
- type EmojisResp
- type Error
- type GetUserParam
- type GetUserParamInclude
- type Invitation
- type InvitationByEmailParam
- type InvitationByEmailResp
- type InvitationsResp
- type ListEmojisParam
- type ListEmojisParamInclude
- type ListPostsParam
- type ListPostsParamInclude
- type ListPostsParamSort
- type Member
- type MembersResp
- type Order
- type OriginalRevision
- type PageResp
- type Post
- type PostKind
- type PostsResp
- type Privacy
- type StarParam
- type Stargazer
- type StargazersResp
- type Team
- type TeamStats
- type TeamsResp
- type URLResp
- type UpdateCommentParam
- type UpdatePostParam
- type UpdatedPost
- type User
- type Watcher
- type WatchersResp
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseOption ¶
type BaseOption func(*baseOptions)
BaseOption overwrite base requrest params
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) BaseOption
WithHTTPClient apply overwrite httpClient
func WithUserAgent ¶
func WithUserAgent(userAgent string) BaseOption
WithUserAgent apply overwrite userAgent
type BatchMoveParam ¶
BatchMoveParam is param for batch move
type BatchMoveResult ¶
type BatchMoveResult struct { Count uint `json:"count"` From string `json:"from"` To string `json:"to"` }
BatchMoveResult is result for batch move
type Client ¶
type Client interface { SetTeam(teamName string) SetAccessToken(accessToken string) AppendOption(options ...BaseOption) SetOption(options ...BaseOption) ClearOptions() // like url.URL{Scheme: "http", Host: "localhost"} OverwriteBaseURL(u url.URL) ListTeams(ctx context.Context, page uint, perPage uint) (*TeamsResp, error) GetTeam(ctx context.Context) (*Team, error) GetTeamStats(ctx context.Context) (*TeamStats, error) ListMembers(ctx context.Context, page uint, perPage uint) (*MembersResp, error) ListPosts(ctx context.Context, param ListPostsParam, page uint, perPage uint) (*PostsResp, error) GetPost(ctx context.Context, number uint) (*Post, error) CreatePost(ctx context.Context, param CreatePostParam) (*Post, error) UpdatePost(ctx context.Context, number uint, param UpdatePostParam) (*UpdatedPost, error) DeletePost(ctx context.Context, number uint) error ListComments(ctx context.Context, postNumber uint, page uint, perPage uint) (*CommentsResp, error) GetComment(ctx context.Context, id uint) (*Comment, error) CreateComment(ctx context.Context, postNumber uint, param CreateCommentParam) (*Comment, error) UpdateComment(ctx context.Context, id uint, param UpdateCommentParam) (*Comment, error) DeleteComment(ctx context.Context, id uint) error ListPostStargazers(ctx context.Context, postNumber uint, page uint, perPage uint) (*StargazersResp, error) StarPost(ctx context.Context, postNumber uint, param StarParam) error UnstarPost(ctx context.Context, postNumber uint) error ListCommentStargazers(ctx context.Context, commentID uint, page uint, perPage uint) (*StargazersResp, error) StarComment(ctx context.Context, commentID uint, param StarParam) error UnstarComment(ctx context.Context, commentID uint) error ListPostWatchers(ctx context.Context, postNumber uint, page uint, perPage uint) (*WatchersResp, error) WatchPost(ctx context.Context, postNumber uint) error UnwatchPost(ctx context.Context, postNumber uint) error ChangeCategory(ctx context.Context, from string, to string) (*BatchMoveResult, error) GetInvitationURL(ctx context.Context) (*URLResp, error) RegenerateInvitationURL(ctx context.Context) (*URLResp, error) InviteByEmail(ctx context.Context, emails ...string) (*InvitationByEmailResp, error) ListInvitations(ctx context.Context, page uint, perPage uint) (*InvitationsResp, error) DeleteInvitation(ctx context.Context, code string) error ListEmojis(ctx context.Context, param ListEmojisParam, page uint, perPage uint) (*EmojisResp, error) CreateEmoji(ctx context.Context, param CreateEmojiParam) (*Emoji, error) DeleteEmoji(ctx context.Context, code string) error GetUser(ctx context.Context, param GetUserParam) (*User, error) }
Client is interface for esa
type ClientImpl ¶
type ClientImpl struct {
// contains filtered or unexported fields
}
ClientImpl is implementation of Client
func (*ClientImpl) AppendOption ¶
func (c *ClientImpl) AppendOption(options ...BaseOption)
AppendOption append option
func (ClientImpl) ChangeCategory ¶
func (c ClientImpl) ChangeCategory(ctx context.Context, from string, to string) (*BatchMoveResult, error)
ChangeCategory change category
func (ClientImpl) CreateComment ¶
func (c ClientImpl) CreateComment(ctx context.Context, postNumber uint, param CreateCommentParam) (*Comment, error)
CreateComment create comment
func (ClientImpl) CreateEmoji ¶
func (c ClientImpl) CreateEmoji(ctx context.Context, param CreateEmojiParam) (*Emoji, error)
CreateEmoji create emoji
func (ClientImpl) CreatePost ¶
func (c ClientImpl) CreatePost(ctx context.Context, param CreatePostParam) (*Post, error)
CreatePost create post
func (ClientImpl) DeleteComment ¶
func (c ClientImpl) DeleteComment(ctx context.Context, id uint) error
DeleteComment delete comment
func (ClientImpl) DeleteEmoji ¶
func (c ClientImpl) DeleteEmoji(ctx context.Context, code string) error
DeleteEmoji delete emoji
func (ClientImpl) DeleteInvitation ¶
func (c ClientImpl) DeleteInvitation(ctx context.Context, code string) error
DeleteInvitation delete invitation
func (ClientImpl) DeletePost ¶
func (c ClientImpl) DeletePost(ctx context.Context, number uint) error
DeletePost delete post
func (ClientImpl) GetComment ¶
GetComment get comment
func (ClientImpl) GetInvitationURL ¶
func (c ClientImpl) GetInvitationURL(ctx context.Context) (*URLResp, error)
GetInvitationURL get invitationURL
func (ClientImpl) GetTeam ¶
func (c ClientImpl) GetTeam(ctx context.Context) (*Team, error)
GetTeam get team
func (ClientImpl) GetTeamStats ¶
func (c ClientImpl) GetTeamStats(ctx context.Context) (*TeamStats, error)
GetTeamStats get teamStats
func (ClientImpl) GetUser ¶
func (c ClientImpl) GetUser(ctx context.Context, param GetUserParam) (*User, error)
GetUser get user
func (ClientImpl) InviteByEmail ¶
func (c ClientImpl) InviteByEmail(ctx context.Context, emails ...string) (*InvitationByEmailResp, error)
InviteByEmail invite byEmail
func (ClientImpl) ListCommentStargazers ¶
func (c ClientImpl) ListCommentStargazers(ctx context.Context, commentID uint, page uint, perPage uint) (*StargazersResp, error)
ListCommentStargazers list commentStargazers
func (ClientImpl) ListComments ¶
func (c ClientImpl) ListComments(ctx context.Context, postNumber uint, page uint, perPage uint) (*CommentsResp, error)
ListComments list comments
func (ClientImpl) ListEmojis ¶
func (c ClientImpl) ListEmojis(ctx context.Context, param ListEmojisParam, page uint, perPage uint) (*EmojisResp, error)
ListEmojis list emojis
func (ClientImpl) ListInvitations ¶
func (c ClientImpl) ListInvitations(ctx context.Context, page uint, perPage uint) (*InvitationsResp, error)
ListInvitations list invitations
func (ClientImpl) ListMembers ¶
func (c ClientImpl) ListMembers(ctx context.Context, page uint, perPage uint) (*MembersResp, error)
ListMembers list members
func (ClientImpl) ListPostStargazers ¶
func (c ClientImpl) ListPostStargazers(ctx context.Context, postNumber uint, page uint, perPage uint) (*StargazersResp, error)
ListPostStargazers list postStargazers
func (ClientImpl) ListPostWatchers ¶
func (c ClientImpl) ListPostWatchers(ctx context.Context, postNumber uint, page uint, perPage uint) (*WatchersResp, error)
ListPostWatchers list postWatchers
func (ClientImpl) ListPosts ¶
func (c ClientImpl) ListPosts(ctx context.Context, param ListPostsParam, page uint, perPage uint) (*PostsResp, error)
ListPosts list posts
func (*ClientImpl) OverwriteBaseURL ¶
func (c *ClientImpl) OverwriteBaseURL(u url.URL)
OverwriteBaseURL overwrite baseURL
func (ClientImpl) RegenerateInvitationURL ¶
func (c ClientImpl) RegenerateInvitationURL(ctx context.Context) (*URLResp, error)
RegenerateInvitationURL regenerate invitationURL
func (*ClientImpl) SetAccessToken ¶
func (c *ClientImpl) SetAccessToken(accessToken string)
SetAccessToken set accessToken
func (*ClientImpl) SetOption ¶
func (c *ClientImpl) SetOption(options ...BaseOption)
SetOption set option
func (ClientImpl) StarComment ¶
StarComment star comment
func (ClientImpl) UnstarComment ¶
func (c ClientImpl) UnstarComment(ctx context.Context, commentID uint) error
UnstarComment unstar comment
func (ClientImpl) UnstarPost ¶
func (c ClientImpl) UnstarPost(ctx context.Context, postNumber uint) error
UnstarPost unstar post
func (ClientImpl) UnwatchPost ¶
func (c ClientImpl) UnwatchPost(ctx context.Context, postNumber uint) error
UnwatchPost unwatch post
func (ClientImpl) UpdateComment ¶
func (c ClientImpl) UpdateComment(ctx context.Context, id uint, param UpdateCommentParam) (*Comment, error)
UpdateComment update comment
func (ClientImpl) UpdatePost ¶
func (c ClientImpl) UpdatePost(ctx context.Context, number uint, param UpdatePostParam) (*UpdatedPost, error)
UpdatePost update post
type Comment ¶
type Comment struct { ID uint `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 Member `json:"created_by"` StargazersCount uint `json:"stargazers_count"` Star bool `json:"star"` }
Comment is struct for comment
type CommentsResp ¶
CommentsResp is resp for comments
type CreateCommentParam ¶
type CreateCommentParam struct { BodyMD string `json:"body_md"` User *string `json:"user,omitempty"` }
CreateCommentParam is param for create comment
type CreateEmojiParam ¶
type CreateEmojiParam struct { Code string `json:"code"` // For alias OriginCode string `json:"origin_code,omitempty"` // BASE64 String Image string `json:"image,omitempty"` }
CreateEmojiParam is param for create emoji
type CreatePostParam ¶
type CreatePostParam struct { Name string `json:"name"` BodyMD *string `json:"body_md,omitempty"` Tags *[]string `json:"tags,omitempty"` Category *string `json:"category,omitempty"` WIP *bool `json:"wip,omitempty"` Message *string `json:"message,omitempty"` User *string `json:"user,omitempty"` }
CreatePostParam is param for create post
type Emoji ¶
type Emoji struct { Code string `json:"code"` Aliases []string `json:"aliases,omitempty"` URL string `json:"url,omitempty"` }
Emoji is struct for emoji
type EmojisResp ¶
EmojisResp is resp for emojis
type GetUserParam ¶
type GetUserParam struct {
Include []GetUserParamInclude `url:"include,comma"`
}
GetUserParam is param for get user
type GetUserParamInclude ¶
type GetUserParamInclude string
GetUserParamInclude is enum for post param "include"
const ( // GetUserParamIncludeTeams is enum for post param "include" GetUserParamIncludeTeams GetUserParamInclude = "teams" )
type Invitation ¶
type Invitation struct { Email string `json:"email"` Code string `json:"code"` ExpiresAt time.Time `json:"expires_at"` URL string `json:"url"` }
Invitation is struct for inivitaion
type InvitationByEmailParam ¶
type InvitationByEmailParam struct { Member struct { Emails []string `json:"emails"` } `json:"member"` }
InvitationByEmailParam is param for invitation by email
type InvitationByEmailResp ¶
type InvitationByEmailResp struct {
Invitations []Invitation `json:"invitations"`
}
InvitationByEmailResp is resp for invitation by email
type InvitationsResp ¶
type InvitationsResp struct { PageResp Invitations []Invitation `json:"invitations"` }
InvitationsResp is resp for invitations
type ListEmojisParam ¶
type ListEmojisParam struct {
Include []ListEmojisParamInclude `url:"include,comma"`
}
ListEmojisParam is param for fetch user
type ListEmojisParamInclude ¶
type ListEmojisParamInclude string
ListEmojisParamInclude is enum for post param "include"
const ( // ListEmojisParamIncludeAll is enum for post param "include" ListEmojisParamIncludeAll ListEmojisParamInclude = "all" )
type ListPostsParam ¶
type ListPostsParam struct { Q string `url:"q,omitempty"` Include []ListPostsParamInclude `url:"include,omitempty,comma"` Sort ListPostsParamSort `url:"sort,omitempty"` Order Order `url:"order,omitempty"` }
ListPostsParam is param for list posts
type ListPostsParamInclude ¶
type ListPostsParamInclude string
ListPostsParamInclude is enum for post param "include"
const ( // ListPostsParamIncludeComments is enum for post param "include" ListPostsParamIncludeComments ListPostsParamInclude = "comments" // ListPostsParamIncludeCommentsStargazers is enum for post param "include" ListPostsParamIncludeCommentsStargazers ListPostsParamInclude = "comments.stargazers" // ListPostsParamIncludeStargazers is enum for post param "include" ListPostsParamIncludeStargazers ListPostsParamInclude = "stargazers" )
type ListPostsParamSort ¶
type ListPostsParamSort string
ListPostsParamSort is enum for post param "sort"
const ( // ListPostsParamSortUpdated is enum for post param "sort" ListPostsParamSortUpdated ListPostsParamSort = "updated" // ListPostsParamSortCreated is enum for post param "sort" ListPostsParamSortCreated ListPostsParamSort = "created" // ListPostsParamSortStars is enum for post param "sort" ListPostsParamSortStars ListPostsParamSort = "stars" // ListPostsParamSortWatches is enum for post param "sort" ListPostsParamSortWatches ListPostsParamSort = "watches" // ListPostsParamSortComments is enum for post param "sort" ListPostsParamSortComments ListPostsParamSort = "comments" // ListPostsParamSortBestMatch is enum for post param "sort" ListPostsParamSortBestMatch ListPostsParamSort = "best_match" )
type Member ¶
type Member struct { Name string `json:"name,omitempty"` ScreenName string `json:"screen_name,omitempty"` Icon string `json:"icon,omitempty"` Email string `json:"email,omitempty"` PostsCount int64 `json:"posts_count,omitempty"` }
Member is struct for member
type MembersResp ¶
MembersResp is resp for members
type OriginalRevision ¶
type OriginalRevision struct { BodyMD string `json:"body_md"` Number uint `json:"number"` User string `json:"user"` }
OriginalRevision is subparam for update post
type PageResp ¶
type PageResp struct { PrevPage *uint `json:"prev_page"` NextPage *uint `json:"next_page"` TotalCount uint `json:"total_count"` Page uint `json:"page"` PerPage uint `json:"per_page"` MaxPerPage uint `json:"max_per_page"` }
PageResp is resp for pager
type Post ¶
type Post struct { Name string `json:"name"` Number uint `json:"number"` Tags []string `json:"tags"` Category string `json:"category"` 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"` UpdatedAt time.Time `json:"updated_at"` Message string `json:"message"` RevisionNumber int64 `json:"revision_number"` CreatedBy Member `json:"created_by"` UpdatedBy Member `json:"updated_by"` Kind PostKind `json:"kind,omitempty"` URL string `json:"url"` CommentsCount *uint `json:"comments_count,omitempty"` TasksCount *uint `json:"tasks_count,omitempty"` DoneTasksCount *uint `json:"done_tasks_count,omitempty"` StargazersCount *uint `json:"stargazers_count,omitempty"` WatchersCount *uint `json:"watchers_count,omitempty"` Star *bool `json:"star,omitempty"` Watch *bool `json:"watch,omitempty"` }
Post is struct for post
type StarParam ¶
type StarParam struct {
Body *string `json:"body"`
}
StarParam is param for create star
type Stargazer ¶
type Stargazer struct { CreatedAt time.Time `json:"created_at"` Body *string `json:"body"` User Member `json:"user"` }
Stargazer is struct for stargazer
type StargazersResp ¶
StargazersResp is resp for stargazers
type Team ¶
type Team struct { Name string `json:"name"` Privacy Privacy `json:"privacy"` Description string `json:"description"` Icon string `json:"icon"` URL string `json:"url"` }
Team is struct for team
type TeamStats ¶
type TeamStats struct { Members uint `json:"members"` Posts uint `json:"posts"` PostsWIP uint `json:"posts_wip"` PostsShipped uint `json:"posts_shipped"` Comments uint `json:"comments"` Stars uint `json:"stars"` DailyActiveUsers uint `json:"daily_active_users"` WeeklyActiveUsers uint `json:"weekly_active_users"` MonthlyActiveUsers uint `json:"monthly_active_users"` }
TeamStats is struct for team status
type UpdateCommentParam ¶
type UpdateCommentParam struct { BodyMD *string `json:"body_md"` User *string `json:"user,omitempty"` }
UpdateCommentParam is param for update comment
type UpdatePostParam ¶
type UpdatePostParam struct { Name *string `json:"name,omitempty"` BodyMD *string `json:"body_md,omitempty"` Tags *[]string `json:"tags,omitempty"` Category *string `json:"category,omitempty"` WIP *bool `json:"wip,omitempty"` Message *string `json:"message,omitempty"` CreatedBy *string `json:"created_by,omitempty"` UpdatedBy *string `json:"updated_by,omitempty"` OriginalRevision *OriginalRevision `json:"original_revision,omitempty"` }
UpdatePostParam is param for update post
type UpdatedPost ¶
UpdatedPost is struct for post
type User ¶
type User struct { ID uint `json:"id"` Name string `json:"name"` ScreenName string `json:"screen_name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Icon string `json:"icon"` Email string `json:"email"` }
User is struct for user
type WatchersResp ¶
WatchersResp is resp for watchers