opensrs

package module
v0.0.0-...-b9b3bdd Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 14 Imported by: 0

README

go-opensrs

A Go client for OpenSRS API.

This is Work under progress, please do not use this repo.

Supported API calls

LOOKUP COMMANDS
  • lookup (domain)
  • name_suggest (domain)
  • get_domains_contacts (domain)
PROVISIONING COMMANDS
  • sw_register (domain)
  • modify (domain)
  • redeem (domain)
  • renew (domain)
  • revoke (domain)
  • update_contacts
NAMESERVER COMMANDS
DNSSEC COMMANDS
DNS ZONE COMMANDS
DOMAIN FORWARDING COMMANDS
AUTHENTICATION COMMANDS

Documentation

Overview

Package opensrs provides a client for the OpenSRS API. In order to use this package you will need a OpenSRS account.

Index

Constants

View Source
const (
	Version = "0.0.1"
)

Variables

This section is empty.

Functions

func FromXml

func FromXml(b []byte, v interface{}) error

func String

func String(s string) *string

func ToXml

func ToXml(v interface{}) (b []byte, err error)

Types

type BaseRequest

type BaseRequest struct {
	Action   string `json:"action"`
	Object   string `json:"object"`
	Protocol string `json:"protocol"`
}

type BaseResponse

type BaseResponse struct {
	Action       string `json:"action"`
	Object       string `json:"object"`
	Protocol     string `json:"protocol"`
	IsSuccess    Bool   `json:"is_success"`
	ResponseCode string `json:"response_code"`
	ResponseText string `json:"response_text"`
}

type Body

type Body struct {
	XMLName   xml.Name  `xml:"body"`
	DataBlock DataBlock `xml:"data_block"`
}

type Bool

type Bool bool

func (*Bool) UnmarshalJSON

func (b *Bool) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	HttpClient       *http.Client
	ApiKey           string
	ResellerUsername string
	BaseURL          string
	Debug            bool
	Domains          *DomainsService
}

func NewClient

func NewClient(ResellerUsername, ApiKey string) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, obj interface{}) error

func (*Client) NewRequest

func (c *Client) NewRequest(method, path string, payload interface{}) (*http.Request, error)

type DataBlock

type DataBlock struct {
	XMLName xml.Name `xml:"data_block"`
	DtAssoc *DtAssoc `xml:"dt_assoc,omitempty"`
}

type DomainsService

type DomainsService struct {
	Client *Client
}

func (*DomainsService) Lookup

func (*DomainsService) NameSuggest

type DtArray

type DtArray struct {
	XMLName  xml.Name `xml:"dt_array"`
	ItemList []Item   `xml:"item,omitempty"`
}

type DtAssoc

type DtAssoc struct {
	XMLName  xml.Name `xml:"dt_assoc"`
	ItemList []Item   `xml:"item,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	Err             error
	HttpResponse    *http.Response
	OpenSRSResponse *BaseResponse
}

func (ErrorResponse) Error

func (e ErrorResponse) Error() string
type Header struct {
	XMLName xml.Name `xml:"header"`
	Version string   `xml:"version"`
}

type Item

type Item struct {
	XMLName xml.Name `xml:"item"`
	Key     string   `xml:"key,attr"`
	DtArray *DtArray `xml:"dt_array,omitempty"`
	DtAssoc *DtAssoc `xml:"dt_assoc,omitempty"`
	Value   string   `xml:",chardata"`
}

type LookupRequest

type LookupRequest struct {
	BaseRequest
	Attributes LookupRequestAttributes `json:"attributes"`
}

type LookupRequestAttributes

type LookupRequestAttributes struct {
	Domain  string `json:"domain"`
	NoCache Bool   `json:"no_cache,omitempty"`
}

type LookupResponse

type LookupResponse struct {
	BaseResponse
	Attributes LookupResponseAttributes `json:"attributes"`
}

type LookupResponseAttributes

type LookupResponseAttributes struct {
	EmailAvailable Bool   `json:"email_available"`
	HasClaim       Bool   `json:"has_claim"`
	NoService      Bool   `json:"noservice"`
	PriceStatus    string `json:"price_status"`
	Status         string `json:"status"`
	Reason         string `json:"reason"`
}

type Map

type Map map[string]interface{}

type NameSuggestItem

type NameSuggestItem struct {
	Domain             string `json:"domain"`
	Price              string `json:"price"`
	Status             string `json:"status"`
	HasClaim           Bool   `json:"has_claim"`
	Reason             string `json:"reason"`
	ThirdPartyOfferUrl URL    `json:"third_party_offer_url"`
}

type NameSuggestItems

type NameSuggestItems struct {
	Count        string            `json:"count"`
	ResponseText string            `json:"response_text"`
	ResponseCode string            `json:"response_code"`
	IsSuccess    Bool              `json:"is_success"`
	Items        []NameSuggestItem `json:"items"`
}

type NameSuggestLookup

type NameSuggestLookup struct {
	Maximum    string   `json:"maximum,omitempty"`
	PriceMax   string   `json:"price_max,omitempty"`
	PriceMin   string   `json:"price_min,omitempty"`
	TLDs       []string `json:"tlds,omitempty"`
	NoCacheTld []string `json:"no_cache_tlds,omitempty"`
}

type NameSuggestPremium

type NameSuggestPremium struct {
	Maximum  string   `json:"maximum,omitempty"`
	PriceMax string   `json:"price_max,omitempty"`
	PriceMin string   `json:"price_min,omitempty"`
	TLDs     []string `json:"tlds,omitempty"`
}

type NameSuggestRequest

type NameSuggestRequest struct {
	BaseRequest
	Attributes NameSuggestRequestAttributes `json:"attributes"`
}

Requests

type NameSuggestRequestAttributes

type NameSuggestRequestAttributes struct {
	Languages          []string                   `json:"languages,omitempty"`
	MaxWaitTime        string                     `json:"max_wait_time,omitempty"`
	SearchKey          string                     `json:"search_key,omitempty"`
	SearchString       string                     `json:"searchstring,omitempty"`
	ServiceOverride    NameSuggestServiceOverride `json:"service_override,omitempty"`
	Services           []string                   `json:"services,omitempty"`
	SkipRegistryLookup bool                       `json:"skip_registry_lookup,omitempty"`
	TLDs               []string                   `json:"tlds,omitempty"`
}

type NameSuggestResponse

type NameSuggestResponse struct {
	BaseResponse
	IsSearchComplete Bool                          `json:"is_search_complete"`
	SearchKey        string                        `json:"search_key"`
	Attributes       NameSuggestResponseAttributes `json:"attributes"`
}

Response

type NameSuggestResponseAttributes

type NameSuggestResponseAttributes struct {
	Lookup                  NameSuggestItems                `json:"lookup"`
	PersonalNames           NameSuggestItems                `json:"personal_names"`
	Premium                 NameSuggestItems                `json:"premium"`
	PremiumBrokeredTransfer PremiumBrokeredTransferResponse `json:"premium_brokered_transfer"`
	PremiumMakeOffer        PremiumMakeOfferResponse        `json:"premium_make_offer"`
	Suggestion              NameSuggestItems                `json:"suggestion"`
}

type NameSuggestServiceOverride

type NameSuggestServiceOverride struct {
	Lookup        NameSuggestLookup     `json:"lookup,omitempty"`
	PersonalNames []string              `json:"personal_names,omitempty"`
	Premium       NameSuggestPremium    `json:"premium,omitempty"`
	Suggestion    NameSuggestSuggestion `json:"suggestion,omitempty"`
}

type NameSuggestSuggestion

type NameSuggestSuggestion struct {
	Maximum  string   `json:"maximum,omitempty"`
	PriceMax string   `json:"price_max,omitempty"`
	PriceMin string   `json:"price_min,omitempty"`
	TLDs     []string `json:"tlds,omitempty"`
}

type OPSEnvelope

type OPSEnvelope struct {
	XMLName xml.Name `xml:"OPS_envelope"`
	Header  Header   `xml:"header"`
	Body    Body     `xml:"body"`
}

type PremiumBrokeredTransferResponse

type PremiumBrokeredTransferResponse struct {
	PremiumMakeOfferResponse
}

type PremiumMakeOfferResponse

type PremiumMakeOfferResponse struct {
	Count        string            `json:"count"`
	ResponseText string            `json:"response_text"`
	ResponseCode string            `json:"response_code"`
	Items        []NameSuggestItem `json:"items"`
}

type URL

type URL string

func (*URL) UnmarshalJSON

func (u *URL) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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