util

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteKey

func DeleteKey(client *api.RESTClient, keyID int) error

func FetchAuthenticatedUser

func FetchAuthenticatedUser(client *api.RESTClient) (string, error)

func FetchScopes

func FetchScopes(client *api.RESTClient) (string, error)

Get scopes available to the auth token.

func FetchToken added in v0.1.0

func FetchToken(ctx context.Context) (*oauth2.Token, error)

func Missing

func Missing(haystack, needle []string) []string

Returns elements of needle not present in haystack

func NewClient

func NewClient(hostname string, authToken string) (*api.RESTClient, error)

func UploadKey added in v0.0.3

func UploadKey(client *api.RESTClient, keyFile io.Reader, title string) error

idempotently upload ssh key adapted from https://github.com/cli/cli/blob/f11f0966959080169dfa7604d8a1a3a60170f417/pkg/cmd/ssh-key/add/http.go#L17

Types

type SSHKey added in v0.2.0

type SSHKey struct {
	ID        int
	Key       string
	Title     string
	CreatedAt time.Time `json:"created_at"`
}

func UserKeys

func UserKeys(client *api.RESTClient) ([]SSHKey, error)

Return keys for the authenticated user

Jump to

Keyboard shortcuts

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