simplyComClient

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

README

A partial client library for simply.com dns provider's API.

GitHub GitHub go.mod Go version Go Report Card

This is partial implementation of simply.com dns provider's API. Any contribution is welcome in the form of PR's. Further documentation of the API can be found here.

Usage

Add this repository as go dependency.

import (
	"github.com/runnerm/simply-com-client"
)

Create a new client with your API key.

client := CreateSimplyClient("accountName", "apiKey")

Use the client to interact with the API.

// Get record for a domain
records, err := client.GetRecord("example.com")

Implemented methods

  • GetRecord
  • AddRecord
  • RemoveRecord
  • UpdateRecord
  • UpdateDDNS

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateRecordResponse

type CreateRecordResponse struct {
	Record struct {
		Id int `json:"id"`
	} `json:"record"`
	Status  int    `json:"status"`
	Message string `json:"message"`
}

CreateRecordResponse api type

type CreateUpdateRecordBody

type CreateUpdateRecordBody struct {
	Type     RecordType `json:"type"`
	Name     string     `json:"name"`
	Data     string     `json:"data"`
	Priority int        `json:"priority"`
	Ttl      int        `json:"ttl"`
}

CreateUpdateRecordBody api type

type Credentials

type Credentials struct {
	AccountName string `json:"status"`
	ApiKey      string `json:"message"`
}

type RecordResponse

type RecordResponse struct {
	Records []struct {
		RecordId int    `json:"record_id"`
		Name     string `json:"name"`
		Ttl      int    `json:"ttl"`
		Data     string `json:"data"`
		Type     string `json:"type"`
		Priority int    `json:"priority"`
	} `json:"records"`
	Status  int    `json:"status"`
	Message string `json:"message"`
}

RecordResponse api type

type RecordType added in v1.0.0

type RecordType string

type SimplyClient

type SimplyClient struct {
	Credentials Credentials `json:"credentials"`
	Logger      *log.Logger
}

SimplyClient base type

func CreateSimplyClient added in v1.0.0

func CreateSimplyClient(accountName string, apiKey string) SimplyClient

func (*SimplyClient) AddRecord added in v1.0.0

func (c *SimplyClient) AddRecord(FQDNName string, Value string, recordType RecordType) (int, error)

AddRecord Add record to simply

func (*SimplyClient) GetRecord added in v1.0.0

func (c *SimplyClient) GetRecord(FQDNName string, RecordData string, recordType RecordType) (int, string, error)

GetRecord Fetch record by FQDNName, RecordData and RecordType,TTL and priority are ignored, returns id of first record found.

func (*SimplyClient) GetRecords added in v1.0.0

func (c *SimplyClient) GetRecords(FQDNName string) (string, error)

GetRecords Fetch records by FQDNName returns id

func (*SimplyClient) RemoveRecord added in v1.0.0

func (c *SimplyClient) RemoveRecord(RecordId int, DnsName string) bool

RemoveRecord Remove record from simply

func (*SimplyClient) UpdateDDNS added in v1.0.1

func (c *SimplyClient) UpdateDDNS(FQDNName string, Ip string) (bool, error)

DDNS update/create record if Ip omited Simply api will use client IP

func (*SimplyClient) UpdateRecord added in v1.0.0

func (c *SimplyClient) UpdateRecord(RecordId int, FQDNName string, Value string, recordType RecordType) (bool, error)

UpdateRecord Update record by RecordId, FQDNName, Value and RecordType

Jump to

Keyboard shortcuts

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