monday

package module
v0.0.0-...-15dfd42 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 11 Imported by: 0

README

Monday.com GraphQL API Client for Go

Overview

go-monday is a simple client for the Monday.coms GraphQL API.

Installation

$ go get github.com/manifest-it/go-monday/...

Usage

See the example file examples/query/main.go.

Contributing

Features, Issues, and Pull Requests are always welcome.

To contribute:

  1. Fork it ( http://github.com/manifest-it/go-monday/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Documentation

Index

Constants

View Source
const (
	ColumnValueTitleDate   = "Date"
	ColumnValueTitleStatus = "Status"
)
View Source
const (
	ColumnValueIDLink = "link"
)
View Source
const (
	MondayAPIURL = "https://api.monday.com/v2"
)

Variables

This section is empty.

Functions

func WrapQuery

func WrapQuery(gql string, wrap bool) string

Types

type BoardGroups

type BoardGroups struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Groups []Group `json:"groups"`
}

type BoardItems

type BoardItems struct {
	ID      string   `json:"id"`
	Name    string   `json:"name"`
	Columns []Column `json:"columns"`
	Owners  []struct {
		ID string `json:"id"`
	} `json:"owners"`
	ItemsPage ItemsPage `json:"items_page"`
}

type BoardsResponse

type BoardsResponse struct {
	AccountID int `json:"account_id"`
	Data      struct {
		Boards []BoardGroups `json:"boards"`
	} `json:"data"`
}

type Client

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

func NewClient

func NewClient(token string) Client

func (*Client) CreateItem

func (c *Client) CreateItem(item CreateItemPayload) (*http.Response, *CreateItemResponse, error)

func (*Client) DoGraphQL

func (c *Client) DoGraphQL(gql Query) (*http.Response, error)

func (*Client) DoGraphQLString

func (c *Client) DoGraphQLString(gql string) (*http.Response, error)

func (*Client) DoJSON

func (c *Client) DoJSON(data []byte) (*http.Response, error)

func (*Client) GetAllBoards

func (c *Client) GetAllBoards() (*http.Response, []BoardGroups, error)

func (*Client) GetAllUsers

func (c *Client) GetAllUsers() (*http.Response, []User, error)

func (*Client) GetItemsBetween

func (c *Client) GetItemsBetween(boardID string, startTime, endTime time.Time, limit int) (*http.Response, *ItemsPage, error)

func (*Client) GetNextItems

func (c *Client) GetNextItems(cursor string, limit int) (*http.Response, *ItemsPage, error)

func (*Client) GetUserById

func (c *Client) GetUserById(userId string) (*http.Response, *User, error)

func (*Client) UpdateItem

func (c *Client) UpdateItem(item UpdateItemPayload) (*http.Response, *UpdateItemResponse, error)

type Column

type Column struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
}

type ColumnValue

type ColumnValue struct {
	ID    string  `json:"id"`
	Title string  `json:"title"`
	Value *string `json:"value"`
	Text  *string `json:"text"`
}

type ColumnValueValue

type ColumnValueValue struct {
	URL       string     `json:"url,omitempty"`  // "title":"Link", "id":"link",
	Text      string     `json:"text,omitempty"` // "title":"Link", "id":"link",
	ChangedAt *time.Time `json:"changed_at"`
}

type CreateItemPayload

type CreateItemPayload struct {
	ItemName string `json:"item_name,omitempty"`
	BoardId  string `json:"board_id,omitempty"`
	GroupId  string `json:"group_id,omitempty"`
	Assignee string `json:"person"`
	Status   string `json:"status"`
}

type CreateItemResponse

type CreateItemResponse struct {
	Data struct {
		CreateItem struct {
			ID  string `json:"id"`
			URL string `json:"url"`
		} `json:"create_item"`
	} `json:"data"`
	AccountID int `json:"account_id"`
}

type ErrorResponse

type ErrorResponse struct {
	StatusCode int    `json:"status_code"`
	ErrorCode  string `json:"error_code"`
}

type Group

type Group struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

type Item

type Item struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	URL   string `json:"url"`
	Board struct {
		Name string `json:"name"`
	} `json:"board"`
	Creator struct {
		Name string `json:"name"`
	} `json:"creator"`
	Updates      []Update      `json:"updates"`
	Subscribers  []Subscriber  `json:"subscribers"`
	ColumnValues []ColumnValue `json:"column_values"`
	CreatedAt    *time.Time    `json:"created_at"`
	UpdatedAt    *time.Time    `json:"updated_at"`
}

type ItemsPage

type ItemsPage struct {
	Items  []Item `json:"items"`
	Cursor string `json:"cursor"`
}

type ItemsResponse

type ItemsResponse struct {
	AccountID int `json:"account_id"`
	Data      struct {
		Boards []BoardItems `json:"boards"`
	} `json:"data"`
}

type NextItemsResponse

type NextItemsResponse struct {
	AccountID int `json:"account_id"`
	Data      struct {
		ItemsPage ItemsPage `json:"next_items_page"`
	} `json:"data"`
}

type Queries

type Queries []Query

type Query

type Query struct {
	Object string
	Where  Where
	Select Queries
	Wrap   bool
}

func GetAllBoardsQuery

func GetAllBoardsQuery() Query

func GetAllUsersQuery

func GetAllUsersQuery() Query

func GetItemsQuery

func GetItemsQuery(boardId string, startDate, endDate time.Time, limit int) Query

func GetNextItemsQuery

func GetNextItemsQuery(cursor string, limit int) Query

func GetUserByIdQuery

func GetUserByIdQuery(userId string) Query

func (Query) String

func (q Query) String() string

type QueryRequest

type QueryRequest struct {
	Query string `json:"query"`
}

type Subscriber

type Subscriber struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Update

type Update struct {
	ID      string `json:"id"`
	Creator struct {
		Name string `json:"name"`
	} `json:"creator"`
	Body string `json:"text_body"`
}

type UpdateItemPayload

type UpdateItemPayload struct {
	ID       string `json:"item_id,omitempty"`
	BoardId  string `json:"board_id,omitempty"`
	Assignee string `json:"person"`
	Status   string `json:"status"`
}

type UpdateItemResponse

type UpdateItemResponse struct {
	Data struct {
		UpdateItem struct {
			ID  string `json:"id"`
			URL string `json:"url"`
		} `json:"change_multiple_column_values"`
	} `json:"data"`
	AccountID int `json:"account_id"`
}

type User

type User struct {
	ID           string     `json:"id"`
	Name         string     `json:"name"`
	EmailAddress string     `json:"email"`
	URL          string     `json:"url"`
	Admin        bool       `json:"is_admin"`
	Guest        bool       `json:"is_guest"`
	ViewOnly     bool       `json:"is_view_only"`
	Phone        string     `json:"phone"`
	Title        string     `json:"title"`
	Location     string     `json:"location"`
	CreatedAt    *time.Time `json:"created_at"`
}

type UsersResponse

type UsersResponse struct {
	AccountID int `json:"account_id"`
	Data      struct {
		Users []User `json:"users"`
	} `json:"data"`
}

type Where

type Where map[string]any

func (Where) String

func (w Where) String() string

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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