wxaskillsservice

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrBadRequest    = Err("api: bad request")
	ErrUnauthorized  = Err("api: unauthorized request")
	ErrForbidden     = Err("api: forbidden")
	ErrNotFound      = Err("api: resource not found")
	ErrInternalError = Err("api: internal error")
	ErrUnknown       = Err("api: unexpected error occurred")
)

Error Constants

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

Bool is a helper routine that allocates a new bool value to store v and returns a pointer to it.

func String

func String(v string) *string

String is a helper routine that allocates a new string value to store v and returns a pointer to it.

Types

type Client

type Client struct {
	// BaseURL for API.  Set using NewClient or you can set directly.
	BaseURL string

	// DeveloperID is the base64 decoded developer ID
	DeveloperID string

	// Token is the personal access token for interacting with the skills service
	Token string

	//HTTP Client to use for making requests, allowing the user to supply their own if required.
	HTTPClient *http.Client
}

Client is the main client for interacting with the library. It can be created using NewClient

func NewClient

func NewClient(developerID, token string, client *http.Client) (*Client, error)

NewClient is a helper function that returns an new api client given a token and developer ID. Optionally you can provide your own http client or use nil to use the default. This is done to ensure you're aware of the decision you're making to not provide your own http client.

func (*Client) CreateSkill

func (c *Client) CreateSkill(ctx context.Context, skill Skill) (*Skill, error)

CreateSkill will create a new skill

func (*Client) DeleteSkill

func (c *Client) DeleteSkill(ctx context.Context, id string, hardDelete bool) error

DeleteSkill is used delete a skill. It is required to pass the ID.

func (*Client) ListSkills

func (c *Client) ListSkills(ctx context.Context) ([]Skill, error)

ListSkills will list all skills

type Err

type Err string

Err implements the error interface so we can have constant errors.

func (Err) Error

func (e Err) Error() string

type Skill

type Skill struct {
	SkillID                  *string  `json:"skill_id,omitempty"`
	DeveloperID              *string  `json:"developer_id,omitempty"`
	URL                      *string  `json:"url,omitempty"`
	Name                     *string  `json:"name,omitempty"`
	ContactEmail             *string  `json:"contact_email,omitempty"`
	Public                   *bool    `json:"public,omitempty"`
	Deleted                  *bool    `json:"deleted,omitempty"`
	CreatedAt                *string  `json:"created_at,omitempty"`
	DeletedAt                *string  `json:"deleted_at,omitempty"`
	ModifiedAt               *string  `json:"modified_at,omitempty"`
	LastActiveAt             *string  `json:"last_active_at,omitempty"`
	SuggestedInvocationNames []string `json:"suggested_invocation_names,omitempty"`
	Languages                []string `json:"languages,omitempty"`
	HomePage                 *string  `json:"home_page,omitempty"`
	Description              *string  `json:"description,omitempty"`
	Secret                   *string  `json:"secret,omitempty"`
	PublicKey                *string  `json:"public_key,omitempty"`
}

Skill represents a skill service skill TODO: Make helpers to access pointer values to avoid panics

Jump to

Keyboard shortcuts

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