porkbun

package module
v0.0.0-...-4988d4a Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 6 Imported by: 1

README

porkbun-go

Porkbun Go SDK - Interact with porkbun DNS API in Go

For more information visit the following links


This is NOT an official SDK

Documentation

Index

Constants

View Source
const PORKBUN_API_BASE = "https://porkbun.com/api/json/v3"
View Source
const PORKBUN_DNS_BASE = PORKBUN_API_BASE + "/dns"
View Source
const PORKBUN_DNS_CREATE = PORKBUN_DNS_BASE + "/create/%s"
View Source
const PORKBUN_DNS_DELETE = PORKBUN_DNS_BASE + "/delete/%s/%s"
View Source
const PORKBUN_DNS_EDIT = PORKBUN_DNS_BASE + "/edit/%s/%s"
View Source
const PORKBUN_DNS_RETRIEVE = PORKBUN_DNS_BASE + "/retrieve/%s"
View Source
const PORKBUN_HTTP_METHOD = "POST"

Currently porkbun uses only POST methods for all APIs

View Source
const STATUS_SUCCESS = "SUCCESS"

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	APIKey       string `json:"apikey,omitempty"`
	SecretAPIKey string `json:"secretapikey,omitempty"`
}

type Client

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

func NewClient

func NewClient(cfg *Config) (*Client, error)

func (*Client) CreateRecord

func (c *Client) CreateRecord(domain string, dnsrecord *DNSRecord) (string, error)

Main function land

func (*Client) DeleteRecord

func (c *Client) DeleteRecord(domain string, id string) error

func (*Client) EditRecord

func (c *Client) EditRecord(domain string, id string, dnsrecord *DNSRecord) error

func (*Client) RetrieveRecords

func (c *Client) RetrieveRecords(domain string) ([]*DNSRecord, error)

type Config

type Config struct {
	Auth   Auth
	Client *http.Client
}

type DNSRecord

type DNSRecord struct {
	ID      string `json:"id,omitempty"`
	Name    string `json:"name,omitempty"`
	Type    string `json:"type,omitempty"`
	Content string `json:"content,omitempty"`
	TTL     string `json:"ttl,omitempty"`
	Prio    string `json:"prio,omitempty"`
	Notes   string `json:"notes,omitempty"`
}

type DNSResponse

type DNSResponse struct {
	Status  string       `json:"status,omitempty"`
	Id      json.Number  `json:"id,omitempty"`
	Records []*DNSRecord `json:"records,omitempty"`
}

Jump to

Keyboard shortcuts

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