Documentation
¶
Index ¶
- Constants
- Variables
- func AuthRequest(authUrl, username, password string, tlsSkipVerify bool) (*http.Response, error)
- func NewClientSessionId(sessionId string, tlsSkipVerify bool) *http.Client
- func RetrieveQuestions(cu ClientUtil, q2s QuestionsToSlug, dir string) (map[string][]byte, error)
- type AuthResponse
- func NewClientEnv(cfg InitConfig) (*http.Client, *AuthResponse, error)
- func NewClientPassword(baseUrl, username, password string, tlsSkipVerify bool) (*http.Client, *AuthResponse, error)
- func NewClientPasswordWithSessionId(baseUrl, username, password, sessionId string, tlsSkipVerify bool) (*http.Client, *AuthResponse, error)
- type ClientUtil
- type InitConfig
- type QuestionsToSlug
Constants ¶
View Source
const ( MetabaseSessionHeader = "X-Metabase-Session" RelPathApiDatabase = "api/database" RelPathApiSession = "api/session" RelPathApiUserCurrent = "api/user/current" // Example environment variables EnvBaseURL = "METABASE_BASE_URL" EnvSessionId = "METABASE_SESSION_ID" EnvUsername = "METABASE_USERNAME" EnvPassword = "METABASE_PASSWORD" )
Variables ¶
View Source
var (
TLSInsecureSkipVerify = false
)
Functions ¶
func AuthRequest ¶
AuthRequest creates an authentiation request that returns a id that is used in Metabase API requests. It follows the following curl command: curl -v -H "Content-Type: application/json" -d '{"username":"myusername","password":"mypassword"}' -XPOST 'http://example.com/api/session'
func NewClientSessionId ¶
func RetrieveQuestions ¶
func RetrieveQuestions(cu ClientUtil, q2s QuestionsToSlug, dir string) (map[string][]byte, error)
Types ¶
type AuthResponse ¶
type AuthResponse struct {
Id string `json:"id,omitempty"`
}
func NewClientEnv ¶
func NewClientEnv(cfg InitConfig) (*http.Client, *AuthResponse, error)
func NewClientPassword ¶
func NewClientPassword(baseUrl, username, password string, tlsSkipVerify bool) (*http.Client, *AuthResponse, error)
NewClient returns a *http.Client that will add the Metabase Session header to each request.
func NewClientPasswordWithSessionId ¶
func NewClientPasswordWithSessionId(baseUrl, username, password, sessionId string, tlsSkipVerify bool) (*http.Client, *AuthResponse, error)
NewClientPasswordWithSessionId returns a *http.Client first attempting to use the supplied `sessionId` with a fallback to `username` and `password`.
type ClientUtil ¶
func NewClientUtil ¶
func NewClientUtil(baseUrl, username, password string, tlsSkipVerify bool) (*ClientUtil, error)
func (*ClientUtil) BuildMetabaseCardAPI ¶
func (cu *ClientUtil) BuildMetabaseCardAPI(cardId int, format string) string
func (*ClientUtil) GetQuestionData ¶
func (cu *ClientUtil) GetQuestionData(cardId int) ([]byte, error)
func (*ClientUtil) GetStoreQuestionData ¶
type InitConfig ¶ added in v0.3.0
type QuestionsToSlug ¶
Click to show internal directories.
Click to hide internal directories.