diff --git a/README.md b/README.md index e5fe9f8..3a60cd0 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,7 @@ for more information on how to use them. - paste.query - phid.lookup - phid.query +- phriction.create - phriction.info - project.query - remarkup.process diff --git a/phriction.go b/phriction.go index e92c3aa..f7b68bd 100644 --- a/phriction.go +++ b/phriction.go @@ -17,3 +17,16 @@ func (c *Conn) PhrictionInfo( return &res, nil } + +// PhrictionCreate performs a call to phriction.create API endpoint. +func (c *Conn) PhrictionCreate( + req requests.PhrictionCreateRequest, +) (*responses.PhrictionCreateResponse, error) { + var res responses.PhrictionCreateResponse + + if err := c.Call("phriction.create", &req, &res); err != nil { + return nil, err + } + + return &res, nil +} diff --git a/requests/phriction.go b/requests/phriction.go index f1d6dbf..3bf885b 100644 --- a/requests/phriction.go +++ b/requests/phriction.go @@ -1,6 +1,16 @@ package requests +// PhrictionInfoRequest represents a request to phriction.info API endpoint type PhrictionInfoRequest struct { Slug string `json:"slug"` Request } + +// PhrictionCreateRequest represents a request to phriction.create API endpoint +type PhrictionCreateRequest struct { + Slug string `json:"slug"` + Title string `json:"title"` + Content string `json:"content"` + Decription string `json:"description,omitempty"` + Request +} diff --git a/responses/phriction.go b/responses/phriction.go index a026dcb..da49640 100644 --- a/responses/phriction.go +++ b/responses/phriction.go @@ -2,4 +2,8 @@ package responses import "github.com/etcinit/gonduit/entities" +// PhrictionInfoResponse represents response from phriction.info endpoint. type PhrictionInfoResponse entities.PhrictionDocument + +// PhrictionCreateResponse represents response from phriction.create endpoint. +type PhrictionCreateResponse entities.PhrictionDocument