internal

package
v4.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const StatusSuccess = "success"

StatusSuccess expected status text when success.

Variables

This section is empty.

Functions

func ParseError

func ParseError(resp *Response) error

ParseError extract error from Response.

Types

type APIError

type APIError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*APIError) Error

func (a *APIError) Error() string

type Billing

type Billing struct {
	ID           int    `json:"id"`
	Profile      string `json:"profile"`
	IsDefault    bool   `json:"isDefault"`
	Name         string `json:"name"`
	City         string `json:"city"`
	Street       string `json:"street"`
	CompanyRegID int    `json:"companyRegId"`
	TaxID        int    `json:"taxId"`
	VatID        int    `json:"vatId"`
	Zip          string `json:"zip"`
	Country      string `json:"country"`
	ISIC         string `json:"isic"`
}

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client a Websupport DNS API client.

func NewClient

func NewClient(apiKey, secretKey string) (*Client, error)

NewClient creates a new Client.

func (*Client) AddRecord

func (c *Client) AddRecord(domainName string, record Record) (*Response, error)

AddRecord adds a DNS record. https://rest.websupport.sk/docs/v1.zone#post-record

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(domainName string, recordID int) (*Response, error)

DeleteRecord deletes a DNS record. https://rest.websupport.sk/docs/v1.zone#delete-record

func (*Client) GetRecords

func (c *Client) GetRecords(domainName string, recordID int) (*Record, error)

GetRecords gets a DNS record.

func (*Client) GetUser

func (c *Client) GetUser(userID string) (*User, error)

GetUser gets a user detail. https://rest.websupport.sk/docs/v1.user#user

func (*Client) ListRecords

func (c *Client) ListRecords(domainName string) (*ListResponse, error)

ListRecords lists all records. https://rest.websupport.sk/docs/v1.zone#records

type Errors

type Errors struct {
	Name    []string `json:"name"`
	Content []string `json:"content"`
}

func (*Errors) Error

func (e *Errors) Error() string

type ListResponse

type ListResponse struct {
	Items []Record `json:"items"`
	Pager Pager    `json:"pager"`
}

type Market

type Market struct {
	Name       string `json:"name"`
	Identifier string `json:"identifier"`
	Currency   string `json:"currency"`
}

type Pager

type Pager struct {
	Page     int `json:"page"`
	PageSize int `json:"pagesize"`
	Items    int `json:"items"`
}

type Record

type Record struct {
	ID      int    `json:"id,omitempty"`
	Type    string `json:"type,omitempty"`
	Name    string `json:"name,omitempty"` // subdomain name or @ if you don't want subdomain
	Content string `json:"content,omitempty"`
	TTL     int    `json:"ttl,omitempty"` // default 600
	Zone    *Zone  `json:"zone"`
}

type Response

type Response struct {
	Status string          `json:"status"`
	Item   *Record         `json:"item"`
	Errors json.RawMessage `json:"errors"`
}

type User

type User struct {
	ID                      int       `json:"id"`
	Login                   string    `json:"login"`
	ParentID                int       `json:"parentId"`
	Active                  bool      `json:"active"`
	CreateTime              int       `json:"createTime"`
	Group                   string    `json:"group"`
	Email                   string    `json:"email"`
	Phone                   string    `json:"phone"`
	ContactPerson           string    `json:"contactPerson"`
	AwaitingTosConfirmation string    `json:"awaitingTosConfirmation"`
	UserLanguage            string    `json:"userLanguage"`
	Credit                  int       `json:"credit"`
	VerifyURL               string    `json:"verifyUrl"`
	Billing                 []Billing `json:"billing"`
	Market                  Market    `json:"market"`
}

type Zone

type Zone struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	UpdateTime int    `json:"updateTime"`
}

Jump to

Keyboard shortcuts

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