Documentation ¶
Index ¶
- Constants
- func IsEmpty(input string) bool
- func NotEmpty(input string) error
- func Optional(_ string) error
- type Caller
- func (c *Caller) Call(endpointID string, service *model.Service, fields map[string]Field) (*http.Response, error)
- func (c *Caller) GetFields(endpointID string, service *model.Service) map[string]Field
- func (c *Caller) MergeFields(m1, m2 map[string]Field) map[string]Field
- func (c *Caller) ParseFields(data string) map[string]Field
- func (c *Caller) Pretty(response *http.Response) string
- func (c *Caller) ReplaceVars(data string, fields map[string]Field) string
- type Editor
- type Field
- type File
- type FileSystem
- type FuzzyFinder
- type Gist
- type GistResponse
- type Github
- func (g *Github) Check(ctx context.Context) (OAuth, error)
- func (g *Github) CreateGist(ctx context.Context, gist Gist) (GistResponse, error)
- func (g *Github) DeleteGist(ctx context.Context, id string) (bool, error)
- func (g *Github) GetGist(ctx context.Context, id string) (GistResponse, error)
- func (g *Github) UpdateGist(ctx context.Context, id string, gist Gist) (GistResponse, error)
- type HTTPClient
- func (h *HTTPClient) BuildData(parameters map[string]string) string
- func (h *HTTPClient) BuildParameters(endpoint string, parameters map[string]string) (string, error)
- func (h *HTTPClient) Delete(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
- func (h *HTTPClient) Get(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
- func (h *HTTPClient) GetHeaderValue(response *http.Response, key string) string
- func (h *HTTPClient) GetStatusCode(response *http.Response) int
- func (h *HTTPClient) Patch(ctx context.Context, endpoint string, data string, ...) (*http.Response, error)
- func (h *HTTPClient) Post(ctx context.Context, endpoint string, data string, ...) (*http.Response, error)
- func (h *HTTPClient) Put(ctx context.Context, endpoint string, data string, ...) (*http.Response, error)
- func (h *HTTPClient) ToString(response *http.Response) (string, error)
- type OAuth
- type Prompt
- type VFile
Constants ¶
const DefaultEditor = "vim"
DefaultEditor is vim because we're adults ;)
const GithubAPI = "https://api.github.com"
GithubAPI github api url
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Caller ¶
type Caller struct {
HTTPClient *HTTPClient
}
Caller struct
func NewCaller ¶
func NewCaller(httpClient *HTTPClient) Caller
NewCaller creates an instance of a caller
func (*Caller) Call ¶
func (c *Caller) Call(endpointID string, service *model.Service, fields map[string]Field) (*http.Response, error)
Call calls the remote service
func (*Caller) MergeFields ¶
MergeFields merges two fields list
func (*Caller) ParseFields ¶
ParseFields parses a string to fetch fields
type FileSystem ¶
FileSystem struct
func (*FileSystem) ConvertToJSON ¶
func (f *FileSystem) ConvertToJSON() (string, error)
ConvertToJSON convert object to json
func (*FileSystem) DumpLocally ¶
func (f *FileSystem) DumpLocally(basePath string) error
DumpLocally updates a local path
func (*FileSystem) LoadFromJSON ¶
func (f *FileSystem) LoadFromJSON(data []byte) (bool, error)
LoadFromJSON update object from json
func (*FileSystem) LoadFromLocal ¶
func (f *FileSystem) LoadFromLocal(basePath string, extension string) error
LoadFromLocal gets files from a local path
func (*FileSystem) Sync ¶
func (f *FileSystem) Sync(remoteFs *FileSystem) error
Sync update fs object from remote fs
type FuzzyFinder ¶
type FuzzyFinder struct{}
FuzzyFinder type
func (*FuzzyFinder) Available ¶
func (f *FuzzyFinder) Available() bool
Available validates if fzf installed
type Gist ¶
type Gist struct { Description string `json:"description"` Public bool `json:"public"` Files map[string]File `json:"files"` }
Gist struct
func (*Gist) ConvertToJSON ¶
ConvertToJSON convert object to json
type GistResponse ¶
type GistResponse struct { ID string `json:"id"` Description string `json:"description"` CreatedAt string `json:"created_at"` CreatedTime int64 `json:"created_at_timestamp"` UpdatedAt string `json:"updated_at"` UpdatedTime int64 `json:"updated_at_timestamp"` Public bool `json:"public"` Files map[string]File `json:"files"` }
GistResponse struct
func (*GistResponse) ConvertToJSON ¶
func (g *GistResponse) ConvertToJSON() (string, error)
ConvertToJSON convert object to json
func (*GistResponse) LoadFromJSON ¶
func (g *GistResponse) LoadFromJSON(data []byte) (bool, error)
LoadFromJSON update object from json
type Github ¶
type Github struct { OAuth OAuth HTTPClient *HTTPClient APIURL string }
Github struct
func NewGithubClient ¶
func NewGithubClient(httpClient *HTTPClient, apiURL, username, token string) Github
NewGithubClient creates an instance of github client
func (*Github) CreateGist ¶
CreateGist creates a gist
func (*Github) DeleteGist ¶
DeleteGist deletes a gist
func (*Github) UpdateGist ¶
UpdateGist updates a gist
type HTTPClient ¶
HTTPClient struct
func NewHTTPClient ¶
func NewHTTPClient() *HTTPClient
NewHTTPClient creates an instance of http client
func (*HTTPClient) BuildData ¶
func (h *HTTPClient) BuildData(parameters map[string]string) string
BuildData build body data
func (*HTTPClient) BuildParameters ¶
BuildParameters add parameters to URL
func (*HTTPClient) Delete ¶
func (h *HTTPClient) Delete(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
Delete http call
func (*HTTPClient) Get ¶
func (h *HTTPClient) Get(ctx context.Context, endpoint string, parameters, headers map[string]string) (*http.Response, error)
Get http call
func (*HTTPClient) GetHeaderValue ¶
func (h *HTTPClient) GetHeaderValue(response *http.Response, key string) string
GetHeaderValue get response header value
func (*HTTPClient) GetStatusCode ¶
func (h *HTTPClient) GetStatusCode(response *http.Response) int
GetStatusCode response status code
func (*HTTPClient) Patch ¶
func (h *HTTPClient) Patch(ctx context.Context, endpoint string, data string, parameters, headers map[string]string) (*http.Response, error)
Patch http call
func (*HTTPClient) Post ¶
func (h *HTTPClient) Post(ctx context.Context, endpoint string, data string, parameters, headers map[string]string) (*http.Response, error)
Post http call