Skip to content

Commit

Permalink
Document types and funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
thebaer committed Oct 3, 2024
1 parent 77ba0de commit 4872395
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/writeas/go-ghost"
)

// Client wraps a ghost.Client.
type Client struct {
ghost.Client
}
Expand Down
1 change: 1 addition & 0 deletions admin/posts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"net/http"
)

// AddPost creates a post from Markdown in the given ghost.PostParams.
func AddPost(gc *ghost.Client, p ghost.PostParams) error {
c := getC(gc)

Expand Down
1 change: 1 addition & 0 deletions author.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ghost

// Author represents an author on Ghost.
type Author struct {
ID *string `json:"id"`
Name *string `json:"name"`
Expand Down
1 change: 1 addition & 0 deletions error.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ghost

// Error represents an error returned from the Ghost API.
type Error struct {
ID *string `json:"id"`
Message *string `json:"message"`
Expand Down
3 changes: 2 additions & 1 deletion ghost.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"time"
)

// Client stores the necessary values for interacting with the Ghost API.
type Client struct {
URL string
Key string
Expand All @@ -26,7 +27,7 @@ type Client struct {
// defaultHTTPTimeout is the default http.Client timeout.
const defaultHTTPTimeout = 10 * time.Second

// NewClient creates a new API client.
// NewClient creates a new API Client.
func NewClient(url, key string) *Client {
httpClient := &http.Client{Timeout: defaultHTTPTimeout}
return &Client{
Expand Down
2 changes: 2 additions & 0 deletions post.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
)

type (
// Post represents a post on Ghost.
Post struct {
ID *string `json:"id"`
UUID *string `json:"uuid"`
Expand Down Expand Up @@ -34,6 +35,7 @@ type (
Excerpt *string `json:"excerpt"`
}

// PostParams are used for content publishing requests made to the Admin API.
PostParams struct {
Title *string `json:"title"`
HTML *string `json:"html,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"time"
)

// Tag represents a tag on Ghost.
type Tag struct {
ID *string `json:"id"`
Name *string `json:"name"`
Expand Down

0 comments on commit 4872395

Please sign in to comment.