sdkman

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const BaseURL = "https://api.sdkman.io"

BaseUrl BaseUrl of the remote sdkman api

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Services used for talking to different parts of the SDKMAN API.
	Download *DownloadService
	ListSdks *ListAllSDKService
	// contains filtered or unexported fields
}

Client provides access to the sdkman api

func NewSdkManClient

func NewSdkManClient(options ...ClientOption) *Client

NewSdkManClient creates the default *Client using defaults and then the provided options

func (*Client) NewRequest added in v0.6.0

func (c *Client) NewRequest(ctx context.Context, method, urlStr string, body interface{}) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the ClientIn. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.

type ClientConfig added in v0.6.0

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

ClientConfig contains configurable values for the creation of the sdkman.Client

type ClientIn added in v0.6.0

type ClientIn interface {
	ListCandidates() (candidates []string, resp *http.Response, err error)
	DownloadSDK(filepath, sdk, version string, arch aarch.Arch) (download *SDKDownload, resp *http.Response, err error)
}

ClientIn provides the SDKMAN Api

type ClientOption added in v0.6.0

type ClientOption func(config *ClientConfig) *ClientConfig

ClientOption is a function which configures ClientConfig

func DefaultSdkManOptions added in v0.6.0

func DefaultSdkManOptions() []ClientOption

DefaultSdkManOptions configures the sdkman.Client using defaults

func FileSystemOption added in v0.6.0

func FileSystemOption(fs afero.Fs) ClientOption

FileSystemOption configures the afero.Fs used in the sdkman.Client

func HTTPClientOption added in v0.6.0

func HTTPClientOption(client *http.Client) ClientOption

HttpClientOption configures the internal http.Client for the sdkman.Client

func URLOptions added in v0.6.0

func URLOptions(baseURL string) ClientOption

SdkManUrlOptions configures the api baseurl

type DownloadService

type DownloadService service

DownloadService downloads SDKs to the filesystem

func (*DownloadService) DownloadSDK

func (s *DownloadService) DownloadSDK(ctx context.Context, filepath, sdk, version string, arch aarch.Arch) (*SDKDownload, *http.Response, error)

DownloadSDK downloads the sdk from the sdkman broker. SDK specifies the sdk Version specifies the apiVersion arch specifies the arch [darwinx64,darwin] https://api.sdkman.io/2/broker/download/scala/scala-2.13.4/darwinx64 https://api.sdkman.io/2/broker/download/scala/2.13.4/darwinx64 nolint: lll

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (response *http.Response, err error)
}

HTTPClient Sends http.Request returning http.Response or an error.Error

type HTTPDoFunc

type HTTPDoFunc func(req *http.Request) (*http.Response, error)

type ListAllSDKService

type ListAllSDKService service

func (*ListAllSDKService) ListAllSDK

func (s *ListAllSDKService) ListAllSDK(ctx context.Context) (candidates []string, resp *http.Response, err error)

CreateListAllAvailableSDKURI gets all available SDK and returns them as an array of strings https://api.sdkman.io/2/candidates/all

type SDKDownload

type SDKDownload struct {
	Path   string
	Reader io.Reader
}

Jump to

Keyboard shortcuts

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