internal

package
v4.16.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://api.infomaniak.com"

DefaultBaseURL Default API endpoint.

Variables

This section is empty.

Functions

func OAuthStaticAccessToken added in v4.12.0

func OAuthStaticAccessToken(client *http.Client, accessToken string) *http.Client

Types

type APIErrorResponse

type APIErrorResponse struct {
	Code        string             `json:"code"`
	Description string             `json:"description,omitempty"`
	Context     map[string]string  `json:"context,omitempty"`
	Errors      []APIErrorResponse `json:"errors,omitempty"`
}

func (APIErrorResponse) Error added in v4.3.0

func (a APIErrorResponse) Error() string

type APIResponse

type APIResponse[T any] struct {
	Result      string            `json:"result"`
	Data        T                 `json:"data,omitempty"`
	ErrResponse *APIErrorResponse `json:"error,omitempty"`
}

func (APIResponse[T]) GetError added in v4.12.0

func (a APIResponse[T]) GetError() *APIErrorResponse

func (APIResponse[T]) GetResult added in v4.12.0

func (a APIResponse[T]) GetResult() string

type Client

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

Client the Infomaniak client.

func New

func New(hc *http.Client, apiEndpoint string) (*Client, error)

New Creates a new Infomaniak client.

func (*Client) CreateDNSRecord

func (c *Client) CreateDNSRecord(ctx context.Context, domain *DNSDomain, record Record) (string, error)

func (*Client) DeleteDNSRecord

func (c *Client) DeleteDNSRecord(ctx context.Context, domainID uint64, recordID string) error

func (*Client) GetDomainByName

func (c *Client) GetDomainByName(ctx context.Context, name string) (*DNSDomain, error)

GetDomainByName gets a Domain object from its name.

type DNSDomain

type DNSDomain struct {
	ID           uint64 `json:"id,omitempty"`
	CustomerName string `json:"customer_name,omitempty"`
}

type Record

type Record struct {
	ID     string `json:"id,omitempty"`
	Source string `json:"source,omitempty"`
	Type   string `json:"type,omitempty"`
	TTL    int    `json:"ttl,omitempty"`
	Target string `json:"target,omitempty"`
}

Record a DNS record.

type Response added in v4.12.0

type Response interface {
	GetResult() string
	GetError() *APIErrorResponse
}

Jump to

Keyboard shortcuts

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