snippets

package
v0.0.0-...-8d5cf93 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EndpointSnippets = "/v1/snippets"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a ranna snippets client

func NewClient

func NewClient(instance string) *Client

NewClient creates a new ranna snippets client

func (*Client) Create

func (client *Client) Create(snippet *Snippet) (*Snippet, error)

Create creates a new ranna code snippet

func (*Client) Snippet

func (client *Client) Snippet(ident string) (*Snippet, error)

Snippet requests a code snippet from the ranna snippet service

type Error

type Error struct {
	Type    string `json:"type"`
	Title   string `json:"title"`
	Status  int    `json:"status"`
	TraceID string `json:"traceId"`
}

Error represents a ranna snippets API error

func (Error) Error

func (err Error) Error() string

Error stringifies a ranna API error

type Snippet

type Snippet struct {
	Ident        string `json:"ident"`
	Language     string `json:"language"`
	Code         string `json:"code"`
	ID           string `json:"id"`
	RawTimestamp string `json:"timestamp"`

	Timestamp time.Time `json:"-"`
}

Snippet represents a ranna code snippet

Jump to

Keyboard shortcuts

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