internal

package
v4.17.3 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TTLRounder

func TTLRounder(ttl int) int

TTLRounder rounds the given TTL in seconds to the next accepted value. Accepted TTL values are:

  • 3600
  • 14400
  • 28800
  • 57600
  • 86400

Types

type Base

type Base struct {
	Code    int    `json:"error"`
	Message string `json:"message"`
}

func (Base) Error

func (b Base) Error() string

type Client

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

Client the Shellrent API client.

func NewClient

func NewClient(username string, token string) *Client

NewClient Creates a new Client.

func (Client) CreateRecord

func (c Client) CreateRecord(ctx context.Context, domainID int, record Record) (int, error)

CreateRecord created a record. https://api.shellrent.com/creazione-record-dns-di-un-dominio

func (Client) DeleteRecord

func (c Client) DeleteRecord(ctx context.Context, domainID int, recordID int) error

DeleteRecord deletes a record. https://api.shellrent.com/eliminazione-record-dns-di-un-dominio

func (Client) GetDomainDetails

func (c Client) GetDomainDetails(ctx context.Context, domainID int) (*DomainDetails, error)

GetDomainDetails gets domain details. https://api.shellrent.com/dettagli-dominio

func (Client) GetServiceDetails

func (c Client) GetServiceDetails(ctx context.Context, serviceID int) (*ServiceDetails, error)

GetServiceDetails gets service details. https://api.shellrent.com/dettagli-servizio-acquistato

func (Client) ListServices

func (c Client) ListServices(ctx context.Context) ([]int, error)

ListServices lists service IDs. https://api.shellrent.com/elenco-dei-servizi-acquistati

type DomainDetails

type DomainDetails struct {
	ID              int    `json:"id"`
	DomainName      string `json:"domain_name"`
	DomainNameASCII string `json:"domain_name_ascii"`
}

type IntOrString

type IntOrString int

func (*IntOrString) UnmarshalJSON

func (m *IntOrString) UnmarshalJSON(data []byte) error

func (*IntOrString) Value

func (m *IntOrString) Value() int

type Record

type Record struct {
	ID          IntOrString `json:"id,omitempty"`
	Type        string      `json:"type,omitempty"`
	Host        string      `json:"host,omitempty"`
	TTL         int         `json:"ttl,omitempty"` // It can be set to the following values (number of seconds): 3600, 14400, 28800, 57600, 86400
	Destination string      `json:"destination,omitempty"`
}

type Response

type Response[T any] struct {
	Base
	Data T `json:"data"`
}

type ServiceDetails

type ServiceDetails struct {
	ID       int    `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	DomainID int    `json:"domain_id,omitempty"`
}

Jump to

Keyboard shortcuts

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