Documentation
¶
Index ¶
- type Provider
- func (p *Provider) AddRecord(domain string, record records.Record) error
- func (p *Provider) GetDomains() ([]string, error)
- func (p *Provider) GetRecords(domain string) (records.Records, error)
- func (p *Provider) Login(email, password string) error
- func (p *Provider) RemoveRecord(domain string, recordID int) error
- func (p *Provider) UpdateRecord(domain string, recordID int, record url.Values) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct { BaseURL string // contains filtered or unexported fields }
Provider struct
func (*Provider) AddRecord ¶
AddRecord creates a new record in Njalla. It accepts only those record types defined in records/records
func (*Provider) GetDomains ¶
GetDomains returns an array of available domains in your Njalla account
func (*Provider) GetRecords ¶
GetRecords returns Records with all the available records for a domain
func (*Provider) RemoveRecord ¶
RemoveRecord takes a given Record ID and tries to remove it from Njalla. Because of how Njalla's website works, a "remove" operation is really just an update operation. An update operation that keeps all the records but the one you want to remove.
func (*Provider) UpdateRecord ¶
UpdateRecord takes a given Record ID, and a Record with its fields changed as a url.Values struct. Because of limitations with the website itself, we can't just one or more fields and send that change. We also can't just modify one record and send that only record. An update operation requires updating the fields you want from the record you want to update, but also keep all the fields you haven't modified. Also keep the rest of the records unmodified. But then you have to remove the `type` field of every record. Also convert all the fields into string. Then remove the `id` field and convert it into: {"id": { ...rest of fields... }, } So you end with a JSON that contains ID keys, and the values are the records with the `type` and `id` fields removed, and the remaining fields' values converted to string.
Take a Record you want to modify from GetRecords, call GetURLValues() on it, modify whatever you need, and then pass those url.Values to this function