api

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetSiteFromID        = "SitesManager.getSiteFromId"
	AddSite              = "SitesManager.addSite"
	UpdateSite           = "SitesManager.updateSite"
	DeleteSite           = "SitesManager.deleteSite"
	GetPatternMatchSites = "SitesManager.getPatternMatchSites"
)
View Source
const (
	API = "API"
)
View Source
const (
	LibraryVersion = "0.0.1"
)

Variables

View Source
var (
	ErrNotFound               = errors.New("entity not found")
	ErrApiUrlCannotBeEmpty    = errors.New("api_url cannot be empty")
	ErrTokenAuthCannotBeEmpty = errors.New("auth_token cannot be empty")
)

Exported Errors

Functions

This section is empty.

Types

type ApiClient added in v0.0.4

type ApiClient struct {
	UserAgent string

	Sites *SitesService
	// contains filtered or unexported fields
}

func NewClient added in v0.0.4

func NewClient(httpClient *http.Client, apiUrl string, authToken string) (*ApiClient, error)

func (*ApiClient) SetApiUrl added in v0.0.4

func (c *ApiClient) SetApiUrl(urlStr string) error

func (*ApiClient) SetAuthToken added in v0.0.4

func (c *ApiClient) SetAuthToken(authToken string) error

type GetSitesOptions

type GetSitesOptions struct {
	Pattern *string `url:"pattern"`
}

Site represents a Site resource

type Response

type Response struct {
	*http.Response
}

Response is a Matomo API response. This wraps the standard http.Response returned from Matomo API and provides convenient access to things like errors

type Site

type Site struct {
	ID    string `json:"idSite,omitempty"`
	Name  string `json:"siteName"`
	Value int    `json:"value,omitempty"`
}

Site represents a Site resource

type SiteOptions

type SiteOptions struct {
	ID   string `url:"idSite,omitempty"`
	Name string `url:"siteName"`
}

Site represents a Site resource

type SitesService

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

func (*SitesService) CreateSite

func (p *SitesService) CreateSite(opt *SiteOptions) (*Site, *Response, error)

CreateSite creates a Site

func (*SitesService) DeleteSite

func (p *SitesService) DeleteSite(idSite string) (bool, *Response, error)

DeleteSite deletes the given Site

func (*SitesService) GetSiteByID

func (p *SitesService) GetSiteByID(idSite string) (*Site, *Response, error)

GetSiteByID retrieves a site by ID

func (*SitesService) GetSites

func (p *SitesService) GetSites(opt *GetSitesOptions) (*[]Site, *Response, error)

GetSites retrieves sites by pattern

func (*SitesService) UpdateSite

func (p *SitesService) UpdateSite(opt *SiteOptions) (*Site, *Response, error)

CreateSite updates a Site

type StandardReqOpt

type StandardReqOpt struct {
	Module    string `url:"module"`
	Method    string `url:"method"`
	Format    string `url:"format"`
	AuthToken string `url:"token_auth"`
}

StardardOpt represents the opt present in all queries

Jump to

Keyboard shortcuts

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