client

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deref

func Deref(s *string) string

Deref safely dereferences a string pointer.

func FormatAssetName

func FormatAssetName(a asset.Asset) string

FormatAssetName returns the display name for an asset.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
}

APIError represents an error response from the Marmot API.

func (*APIError) Error

func (e *APIError) Error() string

type AssetOwnerEntry

type AssetOwnerEntry struct {
	ID             string  `json:"id"`
	Name           string  `json:"name"`
	Type           string  `json:"type"`
	Username       *string `json:"username,omitempty"`
	Email          *string `json:"email,omitempty"`
	ProfilePicture *string `json:"profile_picture,omitempty"`
}

AssetOwnerEntry represents an owner of an asset.

type AssetsSearchResponse

type AssetsSearchResponse struct {
	Assets           []asset.Asset          `json:"assets"`
	Total            int                    `json:"total"`
	Limit            int                    `json:"limit"`
	Offset           int                    `json:"offset"`
	AvailableFilters asset.AvailableFilters `json:"available_filters"`
}

AssetsSearchResponse represents the response from the assets search endpoint.

type Client

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

Client is a lightweight HTTP client for the Marmot API.

func New

func New(baseURL, apiKey string) *Client

New creates a new Marmot API client.

func (*Client) AddTag

func (c *Client) AddTag(ctx context.Context, assetID, tag string) error

AddTag adds a tag to an asset.

func (*Client) CreateAPIKey

func (c *Client) CreateAPIKey(ctx context.Context, name string) (*user.APIKey, error)

CreateAPIKey creates a new API key.

func (*Client) CreateGlossaryTerm

func (c *Client) CreateGlossaryTerm(ctx context.Context, req CreateTermRequest) (*glossary.GlossaryTerm, error)

CreateGlossaryTerm creates a new glossary term.

func (*Client) DeleteAPIKey

func (c *Client) DeleteAPIKey(ctx context.Context, id string) error

DeleteAPIKey deletes an API key by ID.

func (*Client) DeleteAsset

func (c *Client) DeleteAsset(ctx context.Context, id string) error

DeleteAsset deletes an asset by ID.

func (*Client) DeleteGlossaryTerm

func (c *Client) DeleteGlossaryTerm(ctx context.Context, id string) error

DeleteGlossaryTerm deletes a glossary term by ID.

func (*Client) GetAsset

func (c *Client) GetAsset(ctx context.Context, id string) (*asset.Asset, error)

GetAsset retrieves a single asset by ID.

func (*Client) GetAssetLineage

func (c *Client) GetAssetLineage(ctx context.Context, assetID string, depth int) (*lineage.LineageResponse, error)

GetAssetLineage retrieves the lineage graph for an asset.

func (*Client) GetAssetLineageRaw

func (c *Client) GetAssetLineageRaw(ctx context.Context, assetID string, depth int) ([]byte, error)

GetAssetLineageRaw retrieves the lineage graph as raw JSON.

func (*Client) GetAssetRaw

func (c *Client) GetAssetRaw(ctx context.Context, id string) ([]byte, error)

GetAssetRaw retrieves a single asset as raw JSON bytes for json/yaml output.

func (*Client) GetAssetSummary

func (c *Client) GetAssetSummary(ctx context.Context) (*asset.AssetSummary, error)

GetAssetSummary retrieves the asset summary (counts by type, provider, tag).

func (*Client) GetAssetSummaryRaw

func (c *Client) GetAssetSummaryRaw(ctx context.Context) ([]byte, error)

GetAssetSummaryRaw retrieves the asset summary as raw JSON.

func (*Client) GetAssetsByProvider

func (c *Client) GetAssetsByProvider(ctx context.Context) ([]byte, error)

GetAssetsByProvider retrieves asset counts grouped by provider.

func (*Client) GetAssetsByType

func (c *Client) GetAssetsByType(ctx context.Context) ([]byte, error)

GetAssetsByType retrieves asset counts grouped by type.

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser(ctx context.Context) (*user.User, error)

GetCurrentUser retrieves the currently authenticated user.

func (*Client) GetCurrentUserRaw

func (c *Client) GetCurrentUserRaw(ctx context.Context) ([]byte, error)

GetCurrentUserRaw retrieves the current user as raw JSON.

func (*Client) GetGlossaryTerm

func (c *Client) GetGlossaryTerm(ctx context.Context, id string) (*glossary.GlossaryTerm, error)

GetGlossaryTerm retrieves a single glossary term by ID.

func (*Client) GetGlossaryTermRaw

func (c *Client) GetGlossaryTermRaw(ctx context.Context, id string) ([]byte, error)

GetGlossaryTermRaw retrieves a glossary term as raw JSON.

func (*Client) GetMetrics

func (c *Client) GetMetrics(ctx context.Context, start, end time.Time) ([]byte, error)

GetMetrics retrieves aggregated metrics within a time range.

func (*Client) GetReindexStatus

func (c *Client) GetReindexStatus(ctx context.Context) (*ReindexStatus, error)

GetReindexStatus retrieves the current reindex status.

func (*Client) GetRun

func (c *Client) GetRun(ctx context.Context, id string) (*plugin.Run, error)

GetRun retrieves a single run by ID.

func (*Client) GetRunEntities

func (c *Client) GetRunEntities(ctx context.Context, id string, limit, offset int) (*RunEntitiesResponse, error)

GetRunEntities retrieves the entities processed in a run.

func (*Client) GetRunEntitiesRaw

func (c *Client) GetRunEntitiesRaw(ctx context.Context, id string, limit, offset int) ([]byte, error)

GetRunEntitiesRaw retrieves run entities as raw JSON.

func (*Client) GetRunRaw

func (c *Client) GetRunRaw(ctx context.Context, id string) ([]byte, error)

GetRunRaw retrieves a run as raw JSON.

func (*Client) GetTeam

func (c *Client) GetTeam(ctx context.Context, id string) (*team.Team, error)

GetTeam retrieves a team by ID.

func (*Client) GetTeamRaw

func (c *Client) GetTeamRaw(ctx context.Context, id string) ([]byte, error)

GetTeamRaw retrieves a team as raw JSON.

func (*Client) GetTopAssets

func (c *Client) GetTopAssets(ctx context.Context, start, end time.Time, limit int) ([]byte, error)

GetTopAssets retrieves the most viewed assets within a time range.

func (*Client) GetTopQueries

func (c *Client) GetTopQueries(ctx context.Context, start, end time.Time, limit int) ([]byte, error)

GetTopQueries retrieves the most popular search queries within a time range.

func (*Client) GetTotalAssets

func (c *Client) GetTotalAssets(ctx context.Context) ([]byte, error)

GetTotalAssets retrieves the total asset count.

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, id string) (*user.User, error)

GetUser retrieves a user by ID.

func (*Client) GetUserRaw

func (c *Client) GetUserRaw(ctx context.Context, id string) ([]byte, error)

GetUserRaw retrieves a user as raw JSON.

func (*Client) ListAPIKeys

func (c *Client) ListAPIKeys(ctx context.Context) ([]user.APIKey, error)

ListAPIKeys lists the current user's API keys.

func (*Client) ListAPIKeysRaw

func (c *Client) ListAPIKeysRaw(ctx context.Context) ([]byte, error)

ListAPIKeysRaw lists API keys and returns raw JSON.

func (*Client) ListAssetOwners

func (c *Client) ListAssetOwners(ctx context.Context, assetID string) ([]AssetOwnerEntry, error)

ListAssetOwners lists the owners of an asset.

func (*Client) ListAssetOwnersRaw

func (c *Client) ListAssetOwnersRaw(ctx context.Context, assetID string) ([]byte, error)

ListAssetOwnersRaw retrieves asset owners as raw JSON.

func (*Client) ListAssets

func (c *Client) ListAssets(ctx context.Context, query string, limit, offset int, assetTypes, providers, tags []string) (*AssetsSearchResponse, error)

ListAssets searches assets with optional query, pagination, and filters.

func (*Client) ListAssetsRaw

func (c *Client) ListAssetsRaw(ctx context.Context, query string, limit, offset int, assetTypes, providers, tags []string) ([]byte, error)

ListAssetsRaw searches assets and returns raw JSON bytes.

func (*Client) ListGlossaryTerms

func (c *Client) ListGlossaryTerms(ctx context.Context, limit, offset int) (*GlossaryListResponse, error)

ListGlossaryTerms lists glossary terms with pagination.

func (*Client) ListGlossaryTermsRaw

func (c *Client) ListGlossaryTermsRaw(ctx context.Context, limit, offset int) ([]byte, error)

ListGlossaryTermsRaw lists glossary terms and returns raw JSON.

func (*Client) ListRuns

func (c *Client) ListRuns(ctx context.Context, pipelines, statuses []string, limit, offset int) (*RunsListResponse, error)

ListRuns lists pipeline runs with optional filters.

func (*Client) ListRunsRaw

func (c *Client) ListRunsRaw(ctx context.Context, pipelines, statuses []string, limit, offset int) ([]byte, error)

ListRunsRaw lists runs and returns raw JSON.

func (*Client) ListTeamMembers

func (c *Client) ListTeamMembers(ctx context.Context, teamID string) ([]team.TeamMemberWithUser, error)

ListTeamMembers lists the members of a team.

func (*Client) ListTeamMembersRaw

func (c *Client) ListTeamMembersRaw(ctx context.Context, teamID string) ([]byte, error)

ListTeamMembersRaw lists team members and returns raw JSON.

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context, limit, offset int) (*TeamsListResponse, error)

ListTeams lists all teams with pagination.

func (*Client) ListTeamsRaw

func (c *Client) ListTeamsRaw(ctx context.Context, limit, offset int) ([]byte, error)

ListTeamsRaw lists teams and returns raw JSON.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, limit, offset int) (*UsersListResponse, error)

ListUsers lists all users with pagination.

func (*Client) ListUsersRaw

func (c *Client) ListUsersRaw(ctx context.Context, limit, offset int) ([]byte, error)

ListUsersRaw lists users and returns raw JSON.

func (*Client) RemoveTag

func (c *Client) RemoveTag(ctx context.Context, assetID, tag string) error

RemoveTag removes a tag from an asset.

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string, types []string, limit, offset int) (*SearchResponse, error)

Search performs a unified search across assets, glossary, teams, and users.

func (*Client) SearchGlossaryTerms

func (c *Client) SearchGlossaryTerms(ctx context.Context, query string, limit, offset int) (*GlossaryListResponse, error)

SearchGlossaryTerms searches glossary terms.

func (*Client) SearchGlossaryTermsRaw

func (c *Client) SearchGlossaryTermsRaw(ctx context.Context, query string, limit, offset int) ([]byte, error)

SearchGlossaryTermsRaw searches glossary terms and returns raw JSON.

func (*Client) SearchRaw

func (c *Client) SearchRaw(ctx context.Context, query string, types []string, limit, offset int) ([]byte, error)

SearchRaw performs a unified search and returns raw JSON bytes.

func (*Client) StartReindex

func (c *Client) StartReindex(ctx context.Context) (*ReindexStatus, error)

StartReindex triggers a search reindex.

func (*Client) UpdateGlossaryTerm

func (c *Client) UpdateGlossaryTerm(ctx context.Context, id string, req UpdateTermRequest) (*glossary.GlossaryTerm, error)

UpdateGlossaryTerm updates an existing glossary term.

type CreateTermRequest

type CreateTermRequest struct {
	Name         string                 `json:"name"`
	Definition   string                 `json:"definition"`
	Description  string                 `json:"description,omitempty"`
	ParentTermID string                 `json:"parent_term_id,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

CreateTermRequest represents the request body for creating a glossary term.

type GlossaryListResponse

type GlossaryListResponse struct {
	Terms []*glossary.GlossaryTerm `json:"terms"`
	Total int                      `json:"total"`
}

GlossaryListResponse represents the response from the glossary list endpoint.

type MetricsSummary

type MetricsSummary struct {
	TotalAssets  int                    `json:"total_assets"`
	AssetsByType map[string]interface{} `json:"assets_by_type"`
}

MetricsSummary combines total assets and by-type breakdowns.

type ReindexStatus

type ReindexStatus struct {
	Status    string `json:"status"`
	Total     int    `json:"total,omitempty"`
	Processed int    `json:"processed,omitempty"`
	Errors    int    `json:"errors,omitempty"`
}

ReindexStatus represents the status of a reindex operation.

type RunEntitiesResponse

type RunEntitiesResponse struct {
	Entities []runs.RunEntity `json:"entities"`
	Total    int              `json:"total"`
}

RunEntitiesResponse represents the response from the run entities endpoint.

type RunsListResponse

type RunsListResponse struct {
	Runs      []*plugin.Run `json:"runs"`
	Total     int           `json:"total"`
	Pipelines []string      `json:"pipelines"`
}

RunsListResponse represents the response from the runs list endpoint.

type SearchResponse

type SearchResponse struct {
	Results []SearchResult `json:"results"`
	Total   int            `json:"total"`
	Limit   int            `json:"limit"`
	Offset  int            `json:"offset"`
}

SearchResponse represents the response from the unified search endpoint.

type SearchResult

type SearchResult struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description,omitempty"`
	// Asset-specific fields
	AssetType string   `json:"asset_type,omitempty"`
	Providers []string `json:"providers,omitempty"`
}

SearchResult represents a single result from the unified search endpoint.

type TeamsListResponse

type TeamsListResponse struct {
	Teams []team.Team `json:"teams"`
	Total int         `json:"total"`
}

TeamsListResponse represents the response from the teams list endpoint.

type TopAssetEntry

type TopAssetEntry struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Type  string `json:"type"`
	Count int    `json:"count"`
}

TopAssetEntry represents a frequently viewed asset.

type TopQueryEntry

type TopQueryEntry struct {
	Query string `json:"query"`
	Count int    `json:"count"`
}

TopQueryEntry represents a popular search query.

type UpdateTermRequest

type UpdateTermRequest struct {
	Name         *string                `json:"name,omitempty"`
	Definition   *string                `json:"definition,omitempty"`
	Description  *string                `json:"description,omitempty"`
	ParentTermID *string                `json:"parent_term_id,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

UpdateTermRequest represents the request body for updating a glossary term.

type UsersListResponse

type UsersListResponse struct {
	Users  []user.User `json:"users"`
	Total  int         `json:"total"`
	Limit  int         `json:"limit"`
	Offset int         `json:"offset"`
}

UsersListResponse represents the response from the users list endpoint.

Jump to

Keyboard shortcuts

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