gist

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package gist provides a very minimal client for interacting with the GitHub Gist API.

To use this package, you need to create a Client object with your access token. Then, you can use the Client.Get or Client.Update methods to retrieve or modify Gists.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Token is the GitHub access token used for authentication.
	Token string
	// HTTPClient is an optional custom HTTP client object to use for requests.
	// If not provided, request.DefaultClient will be used.
	HTTPClient *http.Client
	// Scrubber is an optional strings.Replacer that scrubs unwanted data from
	// error messages.
	Scrubber *strings.Replacer
}

Client represents a GitHub Gist API client.

func (*Client) Get

func (c *Client) Get(ctx context.Context, id string) (*Gist, error)

Get retrieves a Gist with the specified ID from GitHub.

func (*Client) Update

func (c *Client) Update(ctx context.Context, id string, gist *Gist) (*Gist, error)

Update modifies an existing Gist with the specified ID on GitHub.

type File

type File struct {
	// Content is the textual content of the file.
	Content string `json:"content"`
}

File represents a file within a Gist.

type Gist

type Gist struct {
	// Files is a map containing file names as keys and their corresponding File
	// data as values.
	Files map[string]File `json:"files"`
}

Gist represents a GitHub Gist data structure.

Jump to

Keyboard shortcuts

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