Documentation
¶
Index ¶
- Variables
- func CacheExpires(r *http.Response) time.Time
- type APIClient
- type APIKey
- type APIResponse
- type BasicAuth
- type Configuration
- type Database
- type DatabaseApiService
- type DatabaseDetails
- type DatabaseTable
- type DatasetApiService
- type DatasetQueryConstraints
- type DatasetQueryDsl
- type DatasetQueryDslPage
- type DatasetQueryJsonQuery
- type DatasetQueryNative
- type DatasetQueryOpts
- type DatasetQueryResults
- type DatasetQueryResultsCol
- type DatasetQueryResultsColFingerprint
- type DatasetQueryResultsColFingerprintGlobal
- type DatasetQueryResultsColFingerprintType
- type DatasetQueryResultsColTarget
- type DatasetQueryResultsData
- type DatasetQueryResultsMetadata
- type DatasetQueryResultsMetadataColumn
- type DatasetQueryResultsNativeForm
- type GenericOpenAPIError
- type ListDatabasesOpts
Constants ¶
This section is empty.
Variables ¶
var ( // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. ContextBasicAuth = contextKey("basic") // ContextAccessToken takes a string oauth2 access token as authentication for the request. ContextAccessToken = contextKey("accesstoken") // ContextAPIKey takes an APIKey as authentication for the request ContextAPIKey = contextKey("apikey") )
Functions ¶
Types ¶
type APIClient ¶
type APIClient struct {
DatabaseApi *DatabaseApiService
DatasetApi *DatasetApiService
// contains filtered or unexported fields
}
APIClient manages communication with the Metabase API v1.0.0 In most cases there should be only one, shared, APIClient.
func NewAPIClient ¶
func NewAPIClient(cfg *Configuration) *APIClient
NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.
func (*APIClient) ChangeBasePath ¶
Change base path to allow switching to mocks
func (*APIClient) HTTPClient ¶
type APIKey ¶
APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIResponse ¶
type APIResponse struct {
*http.Response `json:"-"`
Message string `json:"message,omitempty"`
// Operation is the name of the OpenAPI operation.
Operation string `json:"operation,omitempty"`
// RequestURL is the request URL. This value is always available, even if the
// embedded *http.Response is nil.
RequestURL string `json:"url,omitempty"`
// Method is the HTTP method used for the request. This value is always
// available, even if the embedded *http.Response is nil.
Method string `json:"method,omitempty"`
// Payload holds the contents of the response body (which may be nil or empty).
// This is provided here as the raw response.Body() reader will have already
// been drained.
Payload []byte `json:"-"`
}
func NewAPIResponse ¶
func NewAPIResponse(r *http.Response) *APIResponse
func NewAPIResponseWithError ¶
func NewAPIResponseWithError(errorMessage string) *APIResponse
type BasicAuth ¶
type BasicAuth struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type Configuration ¶
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
HTTPClient *http.Client
}
func NewConfiguration ¶
func NewConfiguration() *Configuration
func (*Configuration) AddDefaultHeader ¶
func (c *Configuration) AddDefaultHeader(key string, value string)
type Database ¶
type Database struct {
Id int64 `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Features []string `json:"features,omitempty"`
IsFullSync bool `json:"is_full_sync,omitempty"`
IsSample bool `json:"is_sample,omitempty"`
CacheFieldValuesSchedule string `json:"cache_field_values_schedule,omitempty"`
MetadataSyncSchedule string `json:"metadata_sync_schedule,omitempty"`
// type unknown
Caveats string `json:"caveats,omitempty"`
Engine string `json:"engine,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
NativePermissions string `json:"native_permissions,omitempty"`
// type unknown
PointsOfInterest string `json:"points_of_interest,omitempty"`
Details DatabaseDetails `json:"details,omitempty"`
Tables []DatabaseTable `json:"tables,omitempty"`
}
type DatabaseApiService ¶
type DatabaseApiService service
func (*DatabaseApiService) ListDatabases ¶
func (a *DatabaseApiService) ListDatabases(ctx context.Context, localVarOptionals *ListDatabasesOpts) ([]Database, *http.Response, error)
type DatabaseDetails ¶
type DatabaseDetails struct {
Host string `json:"host,omitempty"`
Port int32 `json:"port,omitempty"`
Dbname string `json:"dbname,omitempty"`
AuthMech int32 `json:"authMech,omitempty"`
User string `json:"user,omitempty"`
Password string `json:"password,omitempty"`
ConnProperties string `json:"connProperties,omitempty"`
LetUserControlScheduling bool `json:"let-user-control-scheduling,omitempty"`
}
type DatabaseTable ¶
type DatabaseTable struct {
Description string `json:"description,omitempty"`
// unknown type
EntityType string `json:"entity_type,omitempty"`
Schema string `json:"schema,omitempty"`
// unknown type
RawTableId string `json:"raw_table_id,omitempty"`
ShowInGettingStarted bool `json:"show_in_getting_started,omitempty"`
Name string `json:"name,omitempty"`
// unknown type
Caveats string `json:"caveats,omitempty"`
Rows int64 `json:"rows,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
// unknown type
EntityName string `json:"entity_name,omitempty"`
Active bool `json:"active,omitempty"`
Id int64 `json:"id,omitempty"`
DbId int64 `json:"db_id,omitempty"`
// unknown type
VisibilityType string `json:"visibility_type,omitempty"`
DisplayName string `json:"display_name,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
// unknown type
PointsOfInterest string `json:"points_of_interest,omitempty"`
}
type DatasetApiService ¶
type DatasetApiService service
func (*DatasetApiService) QueryDatabase ¶
func (a *DatasetApiService) QueryDatabase(ctx context.Context, datasetQueryJsonQuery DatasetQueryJsonQuery) (DatasetQueryResults, *http.Response, error)
DatasetApiService Execute a query Execute a query and retrieve the results in the usual format.
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
- @param datasetQueryJsonQuery
@return DatasetQueryResults
type DatasetQueryConstraints ¶
type DatasetQueryDsl ¶
type DatasetQueryDsl struct {
SourceTable int64 `json:"source_table,omitempty"`
Limit int64 `json:"limit,omitempty"`
Page DatasetQueryDslPage `json:"page,omitempty"`
}
Dataset query request and response object
type DatasetQueryDslPage ¶
type DatasetQueryJsonQuery ¶
type DatasetQueryJsonQuery struct {
Database int64 `json:"database,omitempty"`
Type string `json:"type,omitempty"`
Native DatasetQueryNative `json:"native,omitempty"`
Query DatasetQueryDsl `json:"query,omitempty"`
Constraints DatasetQueryConstraints `json:"constraints,omitempty"`
}
type DatasetQueryNative ¶
type DatasetQueryNative struct {
Query string `json:"query,omitempty"`
}
type DatasetQueryOpts ¶
type DatasetQueryResults ¶
type DatasetQueryResults struct {
StartedAt time.Time `json:"started_at,omitempty"`
JsonQuery DatasetQueryJsonQuery `json:"json_query,omitempty"`
// type unknown
AverageExecutionTime string `json:"average_execution_time,omitempty"`
Status string `json:"status,omitempty"`
Context string `json:"context,omitempty"`
RowCount int64 `json:"row_count,omitempty"`
RunningTime int64 `json:"running_time,omitempty"`
Data DatasetQueryResultsData `json:"data,omitempty"`
}
type DatasetQueryResultsCol ¶
type DatasetQueryResultsCol struct {
Description string `json:"description,omitempty"`
TableId int64 `json:"table_id,omitempty"`
SchemaName string `json:"schema_name,omitempty"`
SpecialType string `json:"special_type,omitempty"`
Name string `json:"name,omitempty"`
Source string `json:"source,omitempty"`
// unknown type
RemappedFrom string `json:"remapped_from,omitempty"`
// can be '{\"target_table_id\":517}'
ExtraInfo map[string]interface{} `json:"extra_info,omitempty"`
// unknown type
FkFieldId string `json:"fk_field_id,omitempty"`
// unknown type
RemappedTo string `json:"remapped_to,omitempty"`
Id int64 `json:"id,omitempty"`
VisibilityType string `json:"visibility_type,omitempty"`
Target DatasetQueryResultsColTarget `json:"target,omitempty"`
DisplayName string `json:"display_name,omitempty"`
Fingerprint DatasetQueryResultsColFingerprint `json:"fingerprint,omitempty"`
BaseType string `json:"base_type,omitempty"`
}
type DatasetQueryResultsColFingerprint ¶
type DatasetQueryResultsColFingerprint struct {
Global DatasetQueryResultsColFingerprintGlobal `json:"global,omitempty"`
// map[string]DatasetQueryResultsColFingerprintType results in map[string]interface{}
Type map[string]interface{} `json:"type,omitempty"`
}
type DatasetQueryResultsColFingerprintGlobal ¶
type DatasetQueryResultsColFingerprintGlobal struct {
DistinctCount int64 `json:"distinct-count,omitempty"`
}
type DatasetQueryResultsColTarget ¶
type DatasetQueryResultsColTarget struct {
Id int64 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
DisplayName string `json:"display_name,omitempty"`
TableId int64 `json:"table_id,omitempty"`
Description string `json:"description,omitempty"`
BaseType string `json:"base_type,omitempty"`
SpecialType string `json:"special_type,omitempty"`
VisibilityType string `json:"visibility_type,omitempty"`
}
type DatasetQueryResultsData ¶
type DatasetQueryResultsData struct {
Columns []string `json:"columns,omitempty"`
Rows [][]interface{} `json:"rows,omitempty"`
NativeForm DatasetQueryResultsNativeForm `json:"native_form,omitempty"`
Cols []DatasetQueryResultsCol `json:"cols,omitempty"`
ResultsMetadata DatasetQueryResultsMetadata `json:"results_metadata,omitempty"`
RowsTruncated int64 `json:"rows_truncated,omitempty"`
}
type DatasetQueryResultsMetadata ¶
type DatasetQueryResultsMetadata struct {
Checksum string `json:"checksum,omitempty"`
Columns []DatasetQueryResultsMetadataColumn `json:"columns,omitempty"`
}
type GenericOpenAPIError ¶
type GenericOpenAPIError struct {
// contains filtered or unexported fields
}
GenericOpenAPIError Provides access to the body, error and model on returned errors.
func (GenericOpenAPIError) Body ¶
func (e GenericOpenAPIError) Body() []byte
Body returns the raw bytes of the response
func (GenericOpenAPIError) Error ¶
func (e GenericOpenAPIError) Error() string
Error returns non-empty string if there was an error.
func (GenericOpenAPIError) Model ¶
func (e GenericOpenAPIError) Model() interface{}
Model returns the unpacked model of the error
Source Files
¶
- api_database.go
- api_dataset.go
- client.go
- configuration.go
- model_database.go
- model_database_details.go
- model_database_table.go
- model_dataset_query_constraints.go
- model_dataset_query_dsl.go
- model_dataset_query_dsl_page.go
- model_dataset_query_json_query.go
- model_dataset_query_native.go
- model_dataset_query_opts.go
- model_dataset_query_results.go
- model_dataset_query_results_col.go
- model_dataset_query_results_col_fingerprint.go
- model_dataset_query_results_col_fingerprint_global.go
- model_dataset_query_results_col_fingerprint_type.go
- model_dataset_query_results_col_target.go
- model_dataset_query_results_data.go
- model_dataset_query_results_metadata.go
- model_dataset_query_results_metadata_column.go
- model_dataset_query_results_native_form.go
- response.go