client

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package client implements an HTTP client for the MicroStrategy REST API.

The client provides methods for interacting with the MicroStrategy REST API, handles authentication, and where appropriate returns strongly typed responses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseMicroStrategyError

func ParseMicroStrategyError(resp *http.Response) *types.MstrRestError

ParseMicroStrategyError parses a MicroStrategy REST API error from the given response.

Types

type AuthService added in v0.3.0

type AuthService service

func (*AuthService) Authenticate added in v0.3.0

func (c *AuthService) Authenticate() error

func (*AuthService) CreateAPIToken added in v0.3.0

func (c *AuthService) CreateAPIToken(ctx context.Context, userID string) (*string, error)

Implement API token request

func (*AuthService) DelegateSession added in v0.3.0

func (c *AuthService) DelegateSession(ctx context.Context, identityToken string, codeVerifier *string) error

Delegate session

func (*AuthService) Login added in v0.3.0

func (c *AuthService) Login(ctx context.Context) error

func (*AuthService) Logout added in v0.3.0

func (c *AuthService) Logout(ctx context.Context) error

func (*AuthService) ValidateIdentityToken added in v0.3.0

func (c *AuthService) ValidateIdentityToken(ctx context.Context, identityToken string, codeVerifier *string) (*string, error)

validate identity token

type DataSourceService added in v0.3.0

type DataSourceService service

func (*DataSourceService) CreateDataSource added in v0.3.0

func (c *DataSourceService) CreateDataSource(ctx context.Context, datasource types.MstrRestDataSource) (*types.MstrRestDataSource, error)

func (*DataSourceService) DeleteDataSource added in v0.3.0

func (c *DataSourceService) DeleteDataSource(ctx context.Context, id string) error

func (*DataSourceService) GetDataSource added in v0.3.0

func (c *DataSourceService) GetDataSource(ctx context.Context, id string) (*types.MstrRestDataSource, error)

func (*DataSourceService) GetDataSources added in v0.3.0

func (c *DataSourceService) GetDataSources(ctx context.Context) ([]types.MstrRestDataSource, error)

type MstrRestClient

type MstrRestClient struct {
	http.Client
	AuthToken       *string
	Authentication  types.MstrAuthentication
	BaseURL         string
	ApplicationType *types.MstrApplicationType

	Auth       *AuthService
	DataSource *DataSourceService
	Project    *ProjectService
	// contains filtered or unexported fields
}

func NewAnonymousMstrRestClient

func NewAnonymousMstrRestClient(baseURL string, configs ...func(*types.ClientConfig)) *MstrRestClient

NewAnonymousMstrRestClient creates a new MstrRestClient with anonymous authentication and the given base URL.

func NewMstrRestClient

func NewMstrRestClient(auth types.MstrAuthentication, baseURL string, configs ...func(*types.ClientConfig)) *MstrRestClient

NewMstrRestClient creates a new MstrRestClient with the given authentication and base URL.

func NewStandardMstrRestClient

func NewStandardMstrRestClient(username, password, baseURL string, configs ...func(*types.ClientConfig)) *MstrRestClient

NewStandardMstrRestClient creates a new MstrRestClient with standard authentication and the given username, password, and base URL.

func (*MstrRestClient) CreateAPIRequest

func (c *MstrRestClient) CreateAPIRequest(ctx context.Context, method string, apiPath string, queryParams *map[string]string, body interface{}) (*http.Request, error)

CreateAPIRequest creates an HTTP request for the given method, API path, query parameters, and body.

func (*MstrRestClient) DoAPIRequest

func (c *MstrRestClient) DoAPIRequest(ctx context.Context, requestOptions types.APIRequestInput) (*http.Response, error)

DoAPIRequest performs an API request with the given method, API path, body, query parameters, and parsed response.

func (*MstrRestClient) LoggedIn

func (c *MstrRestClient) LoggedIn() bool

LoggedIn returns true if the client is logged in.

func (*MstrRestClient) Login

func (c *MstrRestClient) Login(ctx context.Context) error

func (*MstrRestClient) Logout

func (c *MstrRestClient) Logout(ctx context.Context) error

type ProjectService added in v0.3.0

type ProjectService service

func (*ProjectService) GetProject added in v0.3.0

func (c *ProjectService) GetProject(ctx context.Context, id string) (*types.MstrProject, error)

func (*ProjectService) GetProjectSettings added in v0.3.0

func (c *ProjectService) GetProjectSettings(ctx context.Context, id string) (types.MstrProjectSettings, error)

func (*ProjectService) GetProjects added in v0.3.0

func (c *ProjectService) GetProjects(ctx context.Context) ([]types.MstrProject, error)

func (*ProjectService) SetProjectSettings added in v0.3.0

func (c *ProjectService) SetProjectSettings(ctx context.Context, id string, settings types.MstrProjectSettings) error

Jump to

Keyboard shortcuts

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