client

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const InviteResponseAccept = "accept"
View Source
const InviteResponseDecline = "decline"
View Source
const LinkSortNewest = "newest"
View Source
const LinkSortTop = "top"
View Source
const RoleEditor = "editor"
View Source
const RoleOwner = "owner"
View Source
const RoleViewer = "viewer"

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiClient

type ApiClient struct {
	UserId string
	Token  string

	Address string
}

func NewApiClient

func NewApiClient(userId, token, address string) *ApiClient

func (ApiClient) CreateBoard

func (a ApiClient) CreateBoard(newBoard NewBoard) (Board, response, error)

func (ApiClient) CreateInvite

func (a ApiClient) CreateInvite(boardId string, ni NewInvite) (BoardInvite, response, error)
func (a ApiClient) CreateLink(boardId string, nl NewLink) (Link, response, error)

func (ApiClient) DeleteBoard

func (a ApiClient) DeleteBoard(boardId string) (response, error)

func (ApiClient) DeleteInvite

func (a ApiClient) DeleteInvite(boardId string, inviteId string) (response, error)
func (a ApiClient) DeleteLink(boardId string, linkId string) (response, error)

func (ApiClient) EditBoard

func (a ApiClient) EditBoard(boardId string, be BoardEdit) (Board, response, error)

func (ApiClient) EditBoardUser

func (a ApiClient) EditBoardUser(boardId string, userId string, bue BoardUserEdit) (BoardUser, response, error)

func (ApiClient) GetBoard

func (a ApiClient) GetBoard(boardId string) (Board, response, error)

func (ApiClient) GetBoards

func (a ApiClient) GetBoards(qp QueryParams) ([]Board, response, error)

func (ApiClient) GetInvites

func (a ApiClient) GetInvites(qp QueryParams) ([]BoardInvite, response, error)
func (a ApiClient) GetLink(boardId string, linkId string) (Link, response, error)
func (a ApiClient) GetLinks(boardId string, qp LinkQueryParams) ([]Link, response, error)
func (a ApiClient) RateLink(boardId string, linkId string, lr LinkRating) (response, error)

func (ApiClient) RemoveUserFromBoard

func (a ApiClient) RemoveUserFromBoard(boardId string, userId string) (response, error)

func (ApiClient) RespondToInvite

func (a ApiClient) RespondToInvite(boardId string, inviteId string, ir InviteResponse) (response, error)

type Board

type Board struct {
	BoardId      string `json:"boardId"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	CreatedTime  int64  `json:"createdTime"`
	CreatedBy    User   `json:"createdBy"`
	ModifiedTime int64  `json:"modifiedTime"`
	ModifiedBy   User   `json:"modifiedBy"`

	Users   []BoardUser   `json:"users"`
	Invites []BoardInvite `json:"invites"`
}

type BoardEdit

type BoardEdit map[string]interface{}

func (BoardEdit) WithDescription

func (b BoardEdit) WithDescription(description string) BoardEdit

func (BoardEdit) WithName

func (b BoardEdit) WithName(name string) BoardEdit

type BoardInvite

type BoardInvite struct {
	BoardId  string `json:"boardId"`
	InviteId string `json:"inviteId"`

	User User   `json:"user"`
	Role string `json:"role"`

	CreatedTime int64 `json:"createdTime"`
	CreatedBy   User  `json:"createdBy"`

	ExpiresTime int64 `json:"expiresTime"`
}

type BoardUser

type BoardUser struct {
	User         User   `json:"user"`
	Role         string `json:"role"`
	CreatedTime  int64  `json:"createdTime"`
	InvitedBy    User   `json:"invitedBy"`
	Modifiedtime int64  `json:"modifiedTime"`
	ModifiedBy   User   `json:"modifiedBy"`
}

type BoardUserEdit

type BoardUserEdit map[string]interface{}

func (BoardUserEdit) WithRole

func (b BoardUserEdit) WithRole(role string) BoardUserEdit

type InviteResponse

type InviteResponse struct {
	Response string `json:"response,omitempty"`
}
type Link struct {
	BoardId string `json:"boardId"`
	LinkId  string `json:"linkId"`

	Title string `json:"title"`
	Url   string `json:"url"`

	CreatedTime int64 `json:"createdTime"`
	CreatedBy   User  `json:"createdBy"`

	Score     int `json:"score"`
	Upvotes   int `json:"upvotes"`
	Downvotes int `json:"downvotes"`

	UserRating int `json:"userRating"`
}

type LinkQueryParams

type LinkQueryParams struct {
	Limit             int
	Sort              string
	CursorScore       *int
	CursorCreatedTime *int64
}

type LinkRating

type LinkRating struct {
	Rating int `json:"rating"`
}

type NewBoard

type NewBoard struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type NewInvite

type NewInvite struct {
	User User   `json:"user,omitempty"`
	Role string `json:"role,omitempty"`
}
type NewLink struct {
	Title string `json:"title"`
	Url   string `json:"url"`
}

type QueryParams

type QueryParams struct {
	Limit  int
	Cursor int64
}

type User

type User struct {
	UserId string `json:"userId"`
	Name   string `json:"name"`
}

Jump to

Keyboard shortcuts

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