crowi

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

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

Go to latest
Published: Aug 9, 2017 License: MIT Imports: 17 Imported by: 0

README

go-crowi

The official Go client for Crowi.

Getting started

go-crowi supports up to v1.6.1.

$ go get github.com/crowi/go-crowi

Methods currently implemented may be changed or added following the updating of Crowi API

Examples

Please refer to here about how to use each APIs.

License

MIT

Author

b4b4r07

Documentation

Overview

Package crowi provides some Crowi APIs for Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Attachment AttachmentInfo `json:"attachment"`
	Page       interface{}    `json:"page"`
	OK         bool           `json:"ok"`
}

type AttachmentInfo

type AttachmentInfo struct {
	FileFormat   string      `json:"fileFormat"`
	FileName     string      `json:"fileName"`
	OriginalName string      `json:"originalName"`
	FilePath     string      `json:"filePath"`
	Creator      interface{} `json:"creator"`
	ID           string      `json:"_id"`
	CreatedAt    time.Time   `json:"createdAt"`
	PageCreated  bool        `json:"pageCreated"`
	URL          string      `json:"url"`
	FileSize     int         `json:"fileSize"`
	V            int         `json:"__v"`
}

type Attachments

type Attachments struct {
	Attachments []AttachmentInfo `json:"attachments"`
	OK          bool             `json:"ok"`
}

type AttachmentsService

type AttachmentsService service

AttachmentsService handles communication with the Attachments related methods of the Crowi API.

func (*AttachmentsService) Add

func (s *AttachmentsService) Add(ctx context.Context, id, file string) (*Attachment, error)

Add attaches an image file to the page. This request requires page_id and the image file path which you want to attach.

func (*AttachmentsService) List

List shows attachment list of the page. This request requires page_id

type Client

type Client struct {
	http.Client

	Pages       *PagesService
	Attachments *AttachmentsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg Config) (*Client, error)

type Config

type Config struct {
	URL                string
	Token              string
	InsecureSkipVerify bool
}

type ListOptions

type ListOptions struct {
	Pagenation bool
}

type Page

type Page struct {
	Page  PageInfo `json:"page"`
	OK    bool     `json:"ok"`
	Error string   `json:"error"`
}

type PageExtended

type PageExtended struct {
	Slack string `json:"slack"`
}

type PageInfo

type PageInfo struct {
	Revision       PageRevision  `json:"revision"`
	V              int           `json:"__v"`
	RedirectTo     interface{}   `json:"redirectTo"`
	UpdatedAt      time.Time     `json:"updatedAt"`
	LastUpdateUser interface{}   `json:"lastUpdateUser"`
	Creator        interface{}   `json:"creator"`
	Path           string        `json:"path"`
	ID             string        `json:"_id"`
	CreatedAt      time.Time     `json:"createdAt"`
	CommentCount   int           `json:"commentCount"`
	SeenUsers      []interface{} `json:"seenUsers"`
	Liker          []interface{} `json:"liker"`
	GrantedUsers   []string      `json:"grantedUsers"`
	Grant          int           `json:"grant"`
	Status         string        `json:"status"`
	Extended       PageExtended  `json:"extended,omitempty"`
}

type PageRevision

type PageRevision struct {
	ID        string      `json:"_id"`
	Author    interface{} `json:"author"`
	Body      string      `json:"body"`
	Path      string      `json:"path"`
	V         int         `json:"__v"`
	CreatedAt time.Time   `json:"createdAt"`
	Format    string      `json:"format"`
}

type Pages

type Pages struct {
	Pages []PageInfo `json:"pages"`
	OK    bool       `json:"ok"`
	Error string     `json:"error"`
}

type PagesListOptions

type PagesListOptions struct {
	ListOptions
}

PagesListOptions specifies the optional parameters to the PagesService.List methods.

type PagesService

type PagesService service

PagesService handles communication with the Pages related methods of the Crowi API.

func (*PagesService) Create

func (s *PagesService) Create(ctx context.Context, path, body string) (*Page, error)

Create makes a page in your Crowi. The request requires the path and page content used for the page name

func (*PagesService) Get

func (s *PagesService) Get(ctx context.Context, path string) (*Page, error)

func (*PagesService) List

func (s *PagesService) List(ctx context.Context, path, user string, opt *PagesListOptions) (*Pages, error)

List shows the list of pages. A parameter of path or user is required.

func (*PagesService) Update

func (s *PagesService) Update(ctx context.Context, id, body string) (*Page, error)

Update updates the page content. A page_id is necessary to know which page should be updated.

Directories

Path Synopsis
_example

Jump to

Keyboard shortcuts

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